-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: initialization of scienceLabCommon and In-Built MIC #2629
fix: initialization of scienceLabCommon and In-Built MIC #2629
Conversation
Reviewer's Guide by SourceryThis pull request refactors and updates the initialization logic for the in-built MIC and scienceLabCommon components, along with some UI adjustments in the timebase trigger widget. The changes include moving from a nullable AudioJack to a late initialized instance with proper state checks, improving USB event handling, and streamlining widget build logic. Sequence Diagram for USB Event Handling in BoardStateProvidersequenceDiagram
participant USB as UsbSerial Event Stream
participant Board as BoardStateProvider
participant Device as scienceLabCommon
participant UI as User Interface
Note right of Board: USB event listener waits for events
USB->>Board: ACTION_USB_ATTACHED
Board-->>Board: if (attemptToConnectPSLab())
Board->>Device: openDevice()
Board->>Board: setPSLabVersionIDs()
USB->>Board: ACTION_USB_DETACHED
Board->>Device: setConnected(false)
Board-->>Board: update pslabIsConnected, pslabVersionID
Board->>UI: notifyListeners()
Updated Class Diagram for AudioJackclassDiagram
class AudioJack {
+FlutterAudioCapture flutterAudioCapture
-bool _isListening
-List~double~ _audioBuffer
+AudioJack()
+Future<void> initialize()
+Future<void> start()
+Future<void> close()
+List<double> read()
+bool isListening()
}
AudioJack ..> FlutterAudioCapture : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @AsCress - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the large
build
method in_TimebaseTriggerState
into smaller, more manageable widgets. - It looks like you're initializing
_audioJack
inOscilloscopeStateProvider
's constructor now, which is good, but make sure it's properly disposed of in thedispose
method to prevent memory leaks.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/13264005897/artifacts/2571609485 |
Summary by Sourcery
Initialize the audio jack and ScienceLabCommon classes when the respective features are used, rather than at startup.
Bug Fixes:
ScienceLabCommon
and in-built microphone.Enhancements: