fix: Crash in XY plot of Oscilloscope screen #2580#2582
fix: Crash in XY plot of Oscilloscope screen #2580#2582Surajkumar5050 wants to merge 1 commit intofossasia:developmentfrom
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.
Hey @Surajkumar5050 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please fill out the PR description with details about what issue #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. |
AsCress
left a comment
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| private boolean fetchData(int channelNumber) { | ||
| int samples = this.aChannels.get(channelNumber - 1).length; |
There was a problem hiding this comment.
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.
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.
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.
|
@Surajkumar5050 Still on this ? |
|
I'm closing this as the target is native. We are currently working with flutter. |
Fixed issue - #2580
Fixes #2580
Changes
fetchdata()method inScienceLab.javaclassScreenshots / Recordings
Checklist:
strings.xml,dimens.xmlandcolors.xmlwithout hard coding any value.strings.xml,dimens.xmlorcolors.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: