@@ -239,11 +239,11 @@ def __set__(self, obj, val):
239
239
240
240
rx_bw_exponent = _RegisterBits (_REG_RX_BW , offset = 0 , bits = 3 )
241
241
242
- rx_afc_dcc_freq = _RegisterBits (_REG_AFC_BW , offset = 5 , bits = 3 )
242
+ afc_bw_dcc_freq = _RegisterBits (_REG_AFC_BW , offset = 5 , bits = 3 )
243
243
244
- rx_afc_mantissa = _RegisterBits (_REG_AFC_BW , offset = 3 , bits = 2 )
244
+ afc_bw_mantissa = _RegisterBits (_REG_AFC_BW , offset = 3 , bits = 2 )
245
245
246
- rx_afc_exponent = _RegisterBits (_REG_AFC_BW , offset = 0 , bits = 3 )
246
+ afc_bw_exponent = _RegisterBits (_REG_AFC_BW , offset = 0 , bits = 3 )
247
247
248
248
packet_format = _RegisterBits (_REG_PACKET_CONFIG1 , offset = 7 , bits = 1 )
249
249
@@ -267,7 +267,7 @@ def __set__(self, obj, val):
267
267
268
268
payload_ready = _RegisterBits (_REG_IRQ_FLAGS2 , offset = 2 )
269
269
270
- def __init__ (self , spi , cs , reset , frequency , * , sync_word = ' \x2d \xd4 ' ,
270
+ def __init__ (self , spi , cs , reset , frequency , * , sync_word = b' \x2D \xD4 ' ,
271
271
preamble_length = 4 , encryption_key = None , high_power = True ):
272
272
self ._tx_power = 13
273
273
self .high_power = high_power
@@ -351,7 +351,7 @@ def _write_from(self, address, buf, length=None):
351
351
with self ._device as device :
352
352
self ._BUFFER [0 ] = (address | 0x80 ) & 0xFF # Set top bit to 1 to
353
353
# indicate a write.
354
- device .write (self ._BUFFER , end = 2 )
354
+ device .write (self ._BUFFER , end = 1 )
355
355
device .write (buf , end = length )
356
356
357
357
def _write_u8 (self , address , val ):
@@ -511,7 +511,7 @@ def frequency_mhz(self):
511
511
msb = self ._read_u8 (_REG_FRF_MSB )
512
512
mid = self ._read_u8 (_REG_FRF_MID )
513
513
lsb = self ._read_u8 (_REG_FRF_LSB )
514
- frf = (msb << 16 ) | (mid << 8 ) | lsb
514
+ frf = (( msb << 16 ) | (mid << 8 ) | lsb ) & 0xFFFFFF
515
515
frequency = (frf * _FSTEP ) / 1000000.0
516
516
return frequency
517
517
@@ -740,7 +740,7 @@ def receive(self, timeout_s=0.5, keep_listening=True):
740
740
packet = None
741
741
else :
742
742
# Read the 4 bytes of the RadioHead header.
743
- device .readinto (self ._BUFFER , end = 5 )
743
+ device .readinto (self ._BUFFER , end = 4 )
744
744
# Ignore validating any of the header bytes.
745
745
# Now read the remaining packet payload as the result.
746
746
fifo_length -= 4
0 commit comments