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

Radio modes #1

Open
wants to merge 37 commits into
base: dual_rxtx
Choose a base branch
from
Open

Radio modes #1

wants to merge 37 commits into from

Conversation

tomyyyD
Copy link

@tomyyyD tomyyyD commented Jun 27, 2023

letting a user easily choose between fsk and lora in radio_configuration.

Copy link
Contributor

@jbwillis jbwillis left a 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.

lib/configuration/radio_configuration.py Show resolved Hide resolved
@@ -0,0 +1,689 @@
# SPDX-FileCopyrightText: 2017 Tony DiCola for Adafruit Industries
Copy link
Contributor

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

@@ -687,3 +687,28 @@ def rx_done(self) -> bool:
def crc_error(self) -> bool:
"""crc status"""
return (self._read_u8(Constants._RH_RF95_REG_12_IRQ_FLAGS) & 0x20) >> 5

def write_payload(self, payload) -> bool:
Copy link
Contributor

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
@@ -218,9 +219,14 @@ async def fsk_send(
# efficient and proper way to ensure a precondition that the provided
Copy link
Contributor

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
@@ -218,9 +219,14 @@ async def fsk_send(
# efficient and proper way to ensure a precondition that the provided
# buffer be within an expected range of bounds. Disable this check.
# pylint: disable=len-as-condition
assert 0 < len(data) <= 57 # TODO: Allow longer packets, see pg 76
self.tx_device.check_data(data)

# pylint: enable=len-as-condition
Copy link
Contributor

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)
Copy link
Contributor

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
# Done transmitting - change modes (interrupt automatically cleared on mode change)
if keep_listening:
self.listen()
else:
# 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)
Copy link
Contributor

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.

@tomyyyD tomyyyD marked this pull request as ready for review July 5, 2023 15:06
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.

2 participants