Skip to content

Enable CRC by default #63

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

Merged
merged 3 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions adafruit_rfm9x.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class RFM9x:
- baudrate: Baud rate of the SPI connection, default is 10mhz but you might
choose to lower to 1mhz if using long wires or a breadboard.
- agc: Boolean to Enable/Disable Automatic Gain Control - Default=False (AGC off)
- crc: Boolean to Enable/Disable Cyclic Redundancy Check - Default=True (CRC Enabled)
Remember this library makes a best effort at receiving packets with pure
Python code. Trying to receive packets too quickly will result in lost data
so limit yourself to simple scenarios of sending and receiving single
Expand Down Expand Up @@ -230,7 +231,8 @@ def __init__(
preamble_length=8,
high_power=True,
baudrate=5000000,
agc=False
agc=False,
crc=True
):
self.high_power = high_power
# Device support SPI mode 0 (polarity & phase = 0) up to a max of 10mhz.
Expand Down Expand Up @@ -273,9 +275,10 @@ def __init__(
self.signal_bandwidth = 125000
self.coding_rate = 5
self.spreading_factor = 7
# Default to disable CRC checking on incoming packets.
self.enable_crc = False
# set AGC - Default = True
# Default to enable CRC checking on incoming packets.
self.enable_crc = crc
"""CRC Enable state"""
# set AGC - Default = False
self.auto_agc = agc
"""Automatic Gain Control state"""
# Set transmit power to 13 dBm, a safe value any module supports.
Expand Down
2 changes: 0 additions & 2 deletions examples/rfm9x_node1.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
# Initialze RFM radio
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)

# enable CRC checking
rfm9x.enable_crc = True
# set node addresses
rfm9x.node = 1
rfm9x.destination = 2
Expand Down
2 changes: 0 additions & 2 deletions examples/rfm9x_node1_ack.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
# Initialze RFM radio
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)

# enable CRC checking
rfm9x.enable_crc = True
# set delay before sending ACK
rfm9x.ack_delay = 0.1
# set node addresses
Expand Down
3 changes: 0 additions & 3 deletions examples/rfm9x_node1_bonnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@

display.show()

# enable CRC checking
rfm9x.enable_crc = True

# set node addresses
rfm9x.node = 1
rfm9x.destination = 2
Expand Down
2 changes: 0 additions & 2 deletions examples/rfm9x_node2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
# Initialze RFM radio
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)

# enable CRC checking
rfm9x.enable_crc = True
# set node addresses
rfm9x.node = 2
rfm9x.destination = 1
Expand Down
2 changes: 0 additions & 2 deletions examples/rfm9x_node2_ack.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
# Initialze RFM radio
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)

# enable CRC checking
rfm9x.enable_crc = True
# set delay before transmitting ACK (seconds)
rfm9x.ack_delay = 0.1
# set node addresses
Expand Down