Skip to content
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

Update protocol definitions #229

Closed
wants to merge 1 commit into from

Conversation

bessman
Copy link
Collaborator

@bessman bessman commented Jul 27, 2024

Summary by Sourcery

This pull request updates the protocol definitions by removing outdated baud rate and NRFL01 radio module definitions, and adding new definitions for UART passthrough and various sensors.

  • Enhancements:
    • Reorganized and updated protocol definitions for UART passthrough and sensor modules.

Copy link

sourcery-ai bot commented Jul 27, 2024

Reviewer's Guide by Sourcery

This pull request updates the protocol definitions in the pslab/protocol.py file. The changes primarily involve removing outdated baud rate settings and NRF radio module definitions, and introducing new sensor definitions and a UART passthrough setting.

File-Level Changes

Files Changes
pslab/protocol.py Updated protocol definitions by removing outdated baud rate and NRF radio module settings, and adding new sensor definitions and a UART passthrough setting.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a 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:

  • Please provide more context and documentation for these changes. Why are the NRF-related definitions being removed? What's the rationale behind replacing multiple baud rate definitions with UART_PASSTHROUGH?
  • Consider adding inline comments or updating the PR description to explain the new sensor definitions and how they improve the system's functionality.
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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines 181 to +182
SETBAUD = Byte.pack(12)
BAUD9600 = Byte.pack(1)
BAUD14400 = Byte.pack(2)
BAUD19200 = Byte.pack(3)
BAUD28800 = Byte.pack(4)
BAUD38400 = Byte.pack(5)
BAUD57600 = Byte.pack(6)
BAUD115200 = Byte.pack(7)
BAUD230400 = Byte.pack(8)
BAUD1000000 = Byte.pack(9)

# /*-----------NRFL01 radio module----------*/
NRFL01 = Byte.pack(13)
NRF_SETUP = Byte.pack(1)
NRF_RXMODE = Byte.pack(2)
NRF_TXMODE = Byte.pack(3)
NRF_POWER_DOWN = Byte.pack(4)
NRF_RXCHAR = Byte.pack(5)
NRF_TXCHAR = Byte.pack(6)
NRF_HASDATA = Byte.pack(7)
NRF_FLUSH = Byte.pack(8)
NRF_WRITEREG = Byte.pack(9)
NRF_READREG = Byte.pack(10)
NRF_GETSTATUS = Byte.pack(11)
NRF_WRITECOMMAND = Byte.pack(12)
NRF_WRITEPAYLOAD = Byte.pack(13)
NRF_READPAYLOAD = Byte.pack(14)
NRF_WRITEADDRESS = Byte.pack(15)
NRF_TRANSACTION = Byte.pack(16)
NRF_START_TOKEN_MANAGER = Byte.pack(17)
NRF_STOP_TOKEN_MANAGER = Byte.pack(18)
NRF_TOTAL_TOKENS = Byte.pack(19)
NRF_REPORTS = Byte.pack(20)
NRF_WRITE_REPORT = Byte.pack(21)
NRF_DELETE_REPORT_ROW = Byte.pack(22)

NRF_WRITEADDRESSES = Byte.pack(23)

# ---------Non standard IO protocols--------

NONSTANDARD_IO = Byte.pack(14)
# HX711_HEADER = Byte.pack(1)
HCSR04_HEADER = Byte.pack(2)
# AM2302_HEADER = Byte.pack(3)
# TCD1304_HEADER = Byte.pack(4)
# STEPPER_MOTOR = Byte.pack(5)
UART_PASSTHROUGH = Byte.pack(1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider explaining the purpose and usage of UART_PASSTHROUGH

Adding a brief comment about how UART_PASSTHROUGH is used would improve code clarity and maintainability.

Suggested change
SETBAUD = Byte.pack(12)
BAUD9600 = Byte.pack(1)
BAUD14400 = Byte.pack(2)
BAUD19200 = Byte.pack(3)
BAUD28800 = Byte.pack(4)
BAUD38400 = Byte.pack(5)
BAUD57600 = Byte.pack(6)
BAUD115200 = Byte.pack(7)
BAUD230400 = Byte.pack(8)
BAUD1000000 = Byte.pack(9)
# /*-----------NRFL01 radio module----------*/
NRFL01 = Byte.pack(13)
NRF_SETUP = Byte.pack(1)
NRF_RXMODE = Byte.pack(2)
NRF_TXMODE = Byte.pack(3)
NRF_POWER_DOWN = Byte.pack(4)
NRF_RXCHAR = Byte.pack(5)
NRF_TXCHAR = Byte.pack(6)
NRF_HASDATA = Byte.pack(7)
NRF_FLUSH = Byte.pack(8)
NRF_WRITEREG = Byte.pack(9)
NRF_READREG = Byte.pack(10)
NRF_GETSTATUS = Byte.pack(11)
NRF_WRITECOMMAND = Byte.pack(12)
NRF_WRITEPAYLOAD = Byte.pack(13)
NRF_READPAYLOAD = Byte.pack(14)
NRF_WRITEADDRESS = Byte.pack(15)
NRF_TRANSACTION = Byte.pack(16)
NRF_START_TOKEN_MANAGER = Byte.pack(17)
NRF_STOP_TOKEN_MANAGER = Byte.pack(18)
NRF_TOTAL_TOKENS = Byte.pack(19)
NRF_REPORTS = Byte.pack(20)
NRF_WRITE_REPORT = Byte.pack(21)
NRF_DELETE_REPORT_ROW = Byte.pack(22)
NRF_WRITEADDRESSES = Byte.pack(23)
# ---------Non standard IO protocols--------
NONSTANDARD_IO = Byte.pack(14)
# HX711_HEADER = Byte.pack(1)
HCSR04_HEADER = Byte.pack(2)
# AM2302_HEADER = Byte.pack(3)
# TCD1304_HEADER = Byte.pack(4)
# STEPPER_MOTOR = Byte.pack(5)
UART_PASSTHROUGH = Byte.pack(1)
# SETBAUD is used to set the baud rate for serial communication
SETBAUD = Byte.pack(12)
# UART_PASSTHROUGH enables UART passthrough mode
UART_PASSTHROUGH = Byte.pack(1)

@bessman bessman closed this Jul 27, 2024
@bessman bessman deleted the update/protocol branch July 27, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant