Skip to content

Commit 4490961

Browse files
authored
Merge pull request #63 from jerryneedell/jerryn_crc
Enable CRC by default
2 parents b783e7c + 319c515 commit 4490961

File tree

6 files changed

+7
-15
lines changed

6 files changed

+7
-15
lines changed

adafruit_rfm9x.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class RFM9x:
127127
- baudrate: Baud rate of the SPI connection, default is 10mhz but you might
128128
choose to lower to 1mhz if using long wires or a breadboard.
129129
- agc: Boolean to Enable/Disable Automatic Gain Control - Default=False (AGC off)
130+
- crc: Boolean to Enable/Disable Cyclic Redundancy Check - Default=True (CRC Enabled)
130131
Remember this library makes a best effort at receiving packets with pure
131132
Python code. Trying to receive packets too quickly will result in lost data
132133
so limit yourself to simple scenarios of sending and receiving single
@@ -230,7 +231,8 @@ def __init__(
230231
preamble_length=8,
231232
high_power=True,
232233
baudrate=5000000,
233-
agc=False
234+
agc=False,
235+
crc=True
234236
):
235237
self.high_power = high_power
236238
# Device support SPI mode 0 (polarity & phase = 0) up to a max of 10mhz.
@@ -273,9 +275,10 @@ def __init__(
273275
self.signal_bandwidth = 125000
274276
self.coding_rate = 5
275277
self.spreading_factor = 7
276-
# Default to disable CRC checking on incoming packets.
277-
self.enable_crc = False
278-
# set AGC - Default = True
278+
# Default to enable CRC checking on incoming packets.
279+
self.enable_crc = crc
280+
"""CRC Enable state"""
281+
# set AGC - Default = False
279282
self.auto_agc = agc
280283
"""Automatic Gain Control state"""
281284
# Set transmit power to 13 dBm, a safe value any module supports.

examples/rfm9x_node1.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
# Initialze RFM radio
2828
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)
2929

30-
# enable CRC checking
31-
rfm9x.enable_crc = True
3230
# set node addresses
3331
rfm9x.node = 1
3432
rfm9x.destination = 2

examples/rfm9x_node1_ack.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
# Initialze RFM radio
2828
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)
2929

30-
# enable CRC checking
31-
rfm9x.enable_crc = True
3230
# set delay before sending ACK
3331
rfm9x.ack_delay = 0.1
3432
# set node addresses

examples/rfm9x_node1_bonnet.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@
6666

6767
display.show()
6868

69-
# enable CRC checking
70-
rfm9x.enable_crc = True
71-
7269
# set node addresses
7370
rfm9x.node = 1
7471
rfm9x.destination = 2

examples/rfm9x_node2.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
# Initialze RFM radio
2525
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)
2626

27-
# enable CRC checking
28-
rfm9x.enable_crc = True
2927
# set node addresses
3028
rfm9x.node = 2
3129
rfm9x.destination = 1

examples/rfm9x_node2_ack.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
# Initialze RFM radio
2525
rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ)
2626

27-
# enable CRC checking
28-
rfm9x.enable_crc = True
2927
# set delay before transmitting ACK (seconds)
3028
rfm9x.ack_delay = 0.1
3129
# set node addresses

0 commit comments

Comments
 (0)