@@ -499,8 +499,8 @@ def tx_power(self):
499
499
power devices. Only integer power levels are actually set (i.e. 12.5
500
500
will result in a value of 12 dBm).
501
501
The actual maximum setting for high_power=True is 20dBm but for values > 20
502
- the PA_BOOST will be enabled resultiung in ad additonla gain of 3dBm.
503
- Theactual setting is reduced by 3dBm.
502
+ the PA_BOOST will be enabled resultiung in an additonal gain of 3dBm.
503
+ The actual setting is reduced by 3dBm.
504
504
The reported value will reflect the reduced setting.
505
505
"""
506
506
if self .high_power :
@@ -534,7 +534,7 @@ def rssi(self):
534
534
# Remember in LoRa mode the payload register changes function to RSSI!
535
535
return self ._read_u8 (_RH_RF95_REG_1A_PKT_RSSI_VALUE ) - 137
536
536
537
- def send (self , data , timeout_s = 2. ):
537
+ def send (self , data , timeout = 2. ):
538
538
"""Send a string of data using the transmitter. You can only send 252
539
539
bytes at a time (limited by chip's FIFO size and appended headers). Note
540
540
this appends a 4 byte header to be compatible with the RadioHead library.
@@ -566,14 +566,16 @@ def send(self, data, timeout_s=2.):
566
566
start = time .monotonic ()
567
567
timed_out = False
568
568
while not timed_out and not self .tx_done :
569
- if (time .monotonic () - start ) >= timeout_s :
569
+ if (time .monotonic () - start ) >= timeout :
570
570
timed_out = True
571
571
# Go back to idle mode after transmit.
572
572
self .idle ()
573
573
# Clear interrupts.
574
574
self ._write_u8 (_RH_RF95_REG_12_IRQ_FLAGS , 0xFF )
575
+ if timed_out :
576
+ raise RuntimeError ('Timeout during packet send' )
575
577
576
- def receive (self , timeout_s = 0.5 , keep_listening = True ):
578
+ def receive (self , timeout = 0.5 , keep_listening = True ):
577
579
"""Wait to receive a packet from the receiver. Will wait for up to
578
580
timeout_s amount of seconds for a packet to be received and decoded. If
579
581
a packet is found the payload bytes are returned, otherwise None is
@@ -593,7 +595,7 @@ def receive(self, timeout_s=0.5, keep_listening=True):
593
595
start = time .monotonic ()
594
596
timed_out = False
595
597
while not timed_out and not self .rx_done :
596
- if (time .monotonic () - start ) >= timeout_s :
598
+ if (time .monotonic () - start ) >= timeout :
597
599
timed_out = True
598
600
# Payload ready is set, a packet is in the FIFO.
599
601
packet = None
0 commit comments