From 241cff203ab428fbd0a3f1f2164bbf5a66a11e1c Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Mon, 27 Aug 2018 21:16:30 -0400 Subject: [PATCH 1/2] fix delay after sleep, fix byte string in example --- adafruit_rfm9x.py | 5 +---- examples/rfm9x_simpletest.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/adafruit_rfm9x.py b/adafruit_rfm9x.py index 62eb246..c09173e 100644 --- a/adafruit_rfm9x.py +++ b/adafruit_rfm9x.py @@ -353,11 +353,8 @@ def __init__(self, spi, cs, reset, frequency, *, preamble_length=8, # Set sleep mode, wait 10s and confirm in sleep mode (basic device check). # Also set long range mode (LoRa mode) as it can only be done in sleep. self.sleep() - self.long_range_mode = True - #self._write_u8(_RH_RF95_REG_01_OP_MODE, 0b10001000) time.sleep(0.01) - #val = self._read_u8(_RH_RF95_REG_01_OP_MODE) - #print('op mode: {0}'.format(bin(val))) + self.long_range_mode = True if self.operation_mode != SLEEP_MODE or not self.long_range_mode: raise RuntimeError('Failed to configure radio for LoRa mode, check wiring!') except OSError: diff --git a/examples/rfm9x_simpletest.py b/examples/rfm9x_simpletest.py index a9b4220..77b7d95 100644 --- a/examples/rfm9x_simpletest.py +++ b/examples/rfm9x_simpletest.py @@ -36,7 +36,7 @@ # This is a limitation of the radio packet size, so if you need to send larger # amounts of data you will need to break it into smaller send calls. Each send # call will wait for the previous one to finish before continuing. -rfm9x.send('Hello world!\r\n') +rfm9x.send(bytes("Hello world!\r\n","utf-8")) print('Sent hello world message!') # Wait to receive packets. Note that this library can't receive data at a fast From 80af9a26ad6455027a509cf6fe7e9bc701113b9e Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Mon, 27 Aug 2018 21:23:44 -0400 Subject: [PATCH 2/2] minor tweak to force travis build --- examples/rfm9x_simpletest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rfm9x_simpletest.py b/examples/rfm9x_simpletest.py index 77b7d95..95bb1f9 100644 --- a/examples/rfm9x_simpletest.py +++ b/examples/rfm9x_simpletest.py @@ -37,7 +37,7 @@ # amounts of data you will need to break it into smaller send calls. Each send # call will wait for the previous one to finish before continuing. rfm9x.send(bytes("Hello world!\r\n","utf-8")) -print('Sent hello world message!') +print('Sent Hello World message!') # Wait to receive packets. Note that this library can't receive data at a fast # rate, in fact it can only receive and process one 252 byte packet at a time.