-
Notifications
You must be signed in to change notification settings - Fork 225
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 UART passthrough on v6 #232
Conversation
Reviewer's Guide by SourceryThis pull request fixes UART passthrough functionality for version 6 devices and simplifies the interface. The main changes include implementing version-specific methods for UART passthrough, removing the persist parameter, and updating related constants and method signatures. The changes primarily affect the ScienceLab class, protocol constants, and UART bus handling. File-Level Changes
Tips
|
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 @bessman - I've reviewed your changes - here's some feedback:
Overall Comments:
- Could you explain the removal of the 'persist' parameter and the associated timeout feature? This change might affect existing functionality.
- What's the reason for changing the 'passthrough' value from 15 to 12 in the v6 implementation? A brief comment explaining this would be helpful.
- Consider adding a comment to explain the baudrate calculation (((64e6 / baudrate) / 4) - 1). This would improve code readability.
Here's what I looked at during the review
- 🟡 General issues: 1 issue 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 to tell me if it was helpful.
8dc9bf7
to
25abd00
Compare
@sourcery-ai review |
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 @bessman - I've reviewed your changes - here's some feedback:
Overall Comments:
- Could you provide more context on the removal of the 'persist' parameter in the enable_uart_passthrough method? Are there any use cases that might be affected by this change?
- In the _write_byte method, the ACK check has been removed for newer firmware versions. Can you explain the reasoning behind this change and confirm that it doesn't introduce any potential race conditions or error scenarios?
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 to tell me if it was helpful.
The legacy firmware has an option to exit passthrough mode and return to application mode if no traffic is passed through in a certain time. The timeout is not configurable, and is based on letting the firmware watchdog hard-reset the device. This is not a good approach because it may leave the device in an unknown state. The new firmware does not have this option. The
Keeping the ACK byte to avoid race conditions where the host writes too quickly is a good point. But that would require a change to the firmware, which will have to be handled in separate pull requests to both pslab-firmware and pslab-python. The scope of the current PR is to support the current firmware behavior. |
Summary by Sourcery
Fix UART passthrough on v6 by removing the persist parameter and implementing separate methods for legacy and current firmware versions. Refactor baud rate constants to improve code clarity and compatibility.
Bug Fixes:
Enhancements: