-
Couldn't load subscription status.
- Fork 0
Radio modes #1
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
base: dual_rxtx
Are you sure you want to change the base?
Radio modes #1
Conversation
Radiohead should be given a protocol and it will do everything with the given protocol
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.
For the purpose of unifying FSK and LoRa, I think this does the job. There is a lot of duplicated functionality in radiohead.py between the FSK and LoRa send/receive functions. Ultimately I'd like to reduce those down so FSK and LoRa packets are handled by the same code. This is partly to avoid having two diverging packet protocols making it hard to keep track of bugs and where changes need to be made.
| @@ -0,0 +1,689 @@ | |||
| # SPDX-FileCopyrightText: 2017 Tony DiCola for Adafruit Industries | |||
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.
Rename to pycubed_rfm9x_lora.py
| """crc status""" | ||
| return (self._read_u8(Constants._RH_RF95_REG_12_IRQ_FLAGS) & 0x20) >> 5 | ||
|
|
||
| def write_payload(self, payload) -> bool: |
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.
does this actually return a bool?
lib/radiohead.py
Outdated
| """ | ||
| # Disable pylint warning to not use length as a check for zero. | ||
| # This is a puzzling warning as the below code is clearly the most | ||
| # efficient and proper way to ensure a precondition that the provided |
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.
probably delete these comments
lib/radiohead.py
Outdated
| assert 0 < len(data) <= 57 # TODO: Allow longer packets, see pg 76 | ||
| self.tx_device.check_data(data) | ||
|
|
||
| # pylint: enable=len-as-condition |
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.
delete
lib/radiohead.py
Outdated
| if self.protocol == "lora": | ||
| # tells device that FIFO should start at 0. | ||
| # register is used different in fsk | ||
| self.tx_device._write_u8(self.constants._RH_RF95_REG_0D_FIFO_ADDR_PTR, 0x00) |
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.
put this in a function in the lora module
lib/radiohead.py
Outdated
| # Enter idle mode to stop receiving other packets. | ||
| self.idle() | ||
| if self.protocol == "lora": | ||
| self.tx_device._write_u8(self.constants._RH_RF95_REG_12_IRQ_FLAGS, 0xFF) |
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.
put this in a function in the lora module.
letting a user easily choose between fsk and lora in radio_configuration.