-
Notifications
You must be signed in to change notification settings - Fork 806
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: Crash in XY plot of Oscilloscope screen #2580 #2582
base: development
Are you sure you want to change the base?
fix: Crash in XY plot of Oscilloscope screen #2580 #2582
Conversation
Fixed issue - fossasia#2580
Reviewer's Guide by SourceryThe changes focus on improving the data handling and error checking in the oscilloscope's fetchData method. The implementation adds bounds checking when processing buffer data and improves code formatting for better readability. Class diagram for ScienceLab class changesclassDiagram
class ScienceLab {
- int[] buffer
- List<Channel> aChannels
- int channelsInBuffer
- int dataSplitting
+ boolean fetchData(int channelNumber)
}
class Channel {
- int length
- int bufferIndex
+ int[] yAxis
+ int[] fixValue(int[] data)
}
ScienceLab --> Channel
note for ScienceLab "Improved data handling and error checking in fetchData method"
File-Level Changes
Possibly linked issues
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 @Surajkumar5050 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please fill out the PR description with details about what issue Crash in XY plot of Oscilloscope screen #2580 is and what specific changes were made to address it. This helps reviewers understand the context and purpose of the changes.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 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/12229974589/artifacts/2292020607 |
@Surajkumar5050 Thank you very much for your work on this issue!
I'll add all the necessary changes in a review to make it easy for you. |
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.
That's everything for ScienceLab.java
, we don't need any changes in here.
In order to fix the issue, you can make the required changes in OscilloscopeActivity.java
, as mentioned above.
@@ -446,52 +446,58 @@ public int[] oscilloscopeProgress() { | |||
} | |||
|
|||
private boolean fetchData(int channelNumber) { | |||
int samples = this.aChannels.get(channelNumber - 1).length; |
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.
Some formatting issues there.
It'd be great if you could format your files after you finish work and before you commit them.
Just select the whole file (Ctrl+A
) and then run reformat (Ctrl+Alt+L
).
|
||
if ((samples % this.dataSplitting) != 0) { |
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.
Same for here. Formatting issues.
} | ||
|
||
for (int i = 0; i < listData.size() / 2; i++) { | ||
if (i * 2 + 1 < listData.size()) { |
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.
We don't need this. We already have checks in place if the amount of data required isn't read properly from the PSLab device.
Fixed issue - #2580
Fixes #2580
Changes
fetchdata()
method inScienceLab.java
classScreenshots / Recordings
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Fix index out of bounds error in the fetchData method and improve code readability by adding braces to control structures.
Bug Fixes:
Enhancements: