-
Notifications
You must be signed in to change notification settings - Fork 810
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
Merged
adityastic
merged 1 commit into
fossasia:flutter
from
AsCress:oscilloscope_functionality
Feb 15, 2025
+721
−284
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
class OscillscopeAxesScale { | ||
late double _yAxisScale; | ||
late double _yAxisScaleMin; | ||
late double _yAxisScaleMax; | ||
late double _xAxisScale; | ||
|
||
OscillscopeAxesScale() { | ||
_yAxisScale = 16; | ||
_yAxisScaleMin = -16; | ||
_yAxisScaleMax = 16; | ||
_xAxisScale = 875; | ||
} | ||
|
||
double get yAxisScale => _yAxisScale; | ||
double get yAxisScaleMin => _yAxisScaleMin; | ||
double get yAxisScaleMax => _yAxisScaleMax; | ||
double get xAxisScale => _xAxisScale; | ||
|
||
void setYAxisScale(double value) { | ||
_yAxisScale = value; | ||
_yAxisScaleMax = value; | ||
_yAxisScaleMin = -value; | ||
} | ||
|
||
void setYAxisScaleMin(double value) { | ||
_yAxisScaleMin = value; | ||
} | ||
|
||
void setYAxisScaleMax(double value) { | ||
_yAxisScaleMax = value; | ||
} | ||
|
||
void setXAxisScale(double value) { | ||
_xAxisScale = value; | ||
} | ||
|
||
double getTimebaseInterval() { | ||
switch (_xAxisScale) { | ||
case 875.00: | ||
return 100; | ||
case 1000.00: | ||
return 0.2; | ||
case 2000.00: | ||
return 0.3; | ||
case 4000.00: | ||
return 0.7; | ||
case 8000.00: | ||
return 1; | ||
case 25600.00: | ||
return 4; | ||
case 38400.00: | ||
return 10; | ||
case 51200.00: | ||
return 10; | ||
case 102400.00: | ||
return 20; | ||
default: | ||
return _xAxisScale / 5000; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.