-
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
feat: added Oscilloscope functionality #2630
feat: added Oscilloscope functionality #2630
Conversation
Reviewer's Guide by SourceryThis pull request introduces the Oscilloscope feature, which includes functionality for capturing and displaying waveforms, XY plots, and data analysis tools. The implementation involves changes to the Sequence diagram for capturing tracessequenceDiagram
participant User
participant OscilloscopeStateProvider
participant ScienceLab
User->>OscilloscopeStateProvider: Selects channels and capture settings
OscilloscopeStateProvider->>ScienceLab: captureTraces(channels, samples, timeGap, isTriggerSelected, triggerChannel)
activate ScienceLab
ScienceLab-->>OscilloscopeStateProvider: Returns captured data
deactivate ScienceLab
OscilloscopeStateProvider->>OscilloscopeStateProvider: processData(capturedData)
OscilloscopeStateProvider->>OscilloscopeStateProvider: notifyListeners()
Sequence diagram for XY Plot TasksequenceDiagram
participant User
participant OscilloscopeStateProvider
participant ScienceLab
User->>OscilloscopeStateProvider: Selects XY Plot and channels
OscilloscopeStateProvider->>ScienceLab: captureTraces(noOfChannels, samples, timeGap, analogInput1, isTriggerSelected, null)
activate ScienceLab
ScienceLab-->>OscilloscopeStateProvider: Returns captured data
deactivate ScienceLab
OscilloscopeStateProvider->>OscilloscopeStateProvider: processXYPlotData(capturedData)
OscilloscopeStateProvider->>OscilloscopeStateProvider: notifyListeners()
Updated class diagram for OscilloscopeStateProviderclassDiagram
class OscilloscopeStateProvider {
- AudioJack _audioJack
- int _selectedIndex
- String selectedChannelOffset
- bool isCH1Selected
- bool isCH2Selected
- bool isCH3Selected
- bool isAudioInputSelected
- bool isInBuiltMICSelected
- bool isMICSelected
- bool isFourierTransformSelected
- bool isXYPlotSelected
- bool isTriggerSelected
- bool sineFit
- bool squareFit
- String triggerChannel
- String triggerMode
- int timebase
- int samples
- int timeGap
- bool _isProcessing
- int timebaseSlider
- int oscillscopeRangeSelection
- Map~String, int~ _channelIndexMap
- String curveFittingChannel1
- String curveFittingChannel2
- Map~String, double~ xOffsets
- Map~String, double~ yOffsets
- double trigger
- ScienceLab _scienceLab
- AnalyticsClass _analyticsClass
- bool _monitor
- double _maxAmp
- double _maxFreq
- bool _isRecording
- bool _isRunning
- String xyPlotAxis1
- String xyPlotAxis2
- List~List~FlSpot~~ dataEntries
- List~List~FlSpot~~ dataEntriesXYPlot
- List~List~FlSpot~~ dataEntriesCurveFit
- List~String~ dataParamsChannels
- int _timebaseDivisions
- Timer _timer
- OscillscopeAxesScale oscillscopeAxesScale
+ int get selectedIndex
+ int get timebaseDivisions
+ OscilloscopeStateProvider()
+ Future~void~ monitor()
+ Future~void~ xyPlotTask(String xyPlotAxis1, String xyPlotAxis2)
+ Future~void~ captureTask(List~String~ channels)
+ void setTimebaseDivisions(int divisions)
+ void setTimebase(int time)
+ void setTimebaseSlider(int time)
+ List~LineChartBarData~ createPlots()
+ List~LineChartBarData~ createXYPlot()
}
class AudioJack
class ScienceLab
class AnalyticsClass
class OscillscopeAxesScale {
- double _yAxisScale
- double _yAxisScaleMin
- double _yAxisScaleMax
- double _xAxisScale
+ OscillscopeAxesScale()
+ double get yAxisScale
+ double get yAxisScaleMin
+ double get yAxisScaleMax
+ double get xAxisScale
+ void setYAxisScale(double value)
+ void setYAxisScaleMin(double value)
+ void setYAxisScaleMax(double value)
+ void setXAxisScale(double value)
+ double getTimebaseInterval()
}
OscilloscopeStateProvider -- AudioJack
OscilloscopeStateProvider -- ScienceLab
OscilloscopeStateProvider -- AnalyticsClass
OscilloscopeStateProvider -- OscillscopeAxesScale
note for OscilloscopeStateProvider "Manages the state of the oscilloscope, including channel selections, trigger settings, and data entries."
note for OscillscopeAxesScale "Manages the scales of the axes of the oscilloscope."
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/13346070962/artifacts/2597200373 |
1403c6e
to
a7b6391
Compare
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 logic for creating
DropdownMenuEntry
widgets into a separate helper function to improve readability. - The
clamp
calls in_DataAnalysisState
could be extracted to a separate function.
Here's what I looked at during the review
- 🟡 General issues: 2 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.
@@ -86,9 +84,12 @@ class OscilloscopeStateProvider extends ChangeNotifier { | |||
|
|||
late Timer _timer; | |||
|
|||
late OscillscopeAxesScale oscillscopeAxesScale; |
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.
nitpick (typo): The member name 'oscillscopeAxesScale' appears to be misspelled.
Renaming it to 'oscilloscopeAxesScale' (with the correct spelling) would improve code readability and reduce confusion.
late OscillscopeAxesScale oscillscopeAxesScale; | |
late OscilloscopeAxesScale oscilloscopeAxesScale; |
@@ -0,0 +1,61 @@ | |||
class OscillscopeAxesScale { |
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.
nitpick (typo): Typo in the class name 'OscillscopeAxesScale'.
Using the correct spelling ('OscilloscopeAxesScale') would help maintain consistency with the rest of the codebase.
class OscillscopeAxesScale { | |
class OscilloscopeAxesScale { |
Adds functionality for the Oscilloscope.
Screenshots / Recordings
N/A
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Add support for XY plotting, curve fitting, offsets, triggering, FFT, multiple channels, built-in and external microphones, various timebase and Y-axis ranges, trigger modes, curve fitting options, channel parameters, data analysis settings, and oscilloscope settings.
New Features: