From 90944a5b00593fd486600c97912387e6d744572b Mon Sep 17 00:00:00 2001 From: jgromes Date: Tue, 18 Feb 2020 07:35:04 +0100 Subject: [PATCH 01/10] [RF69] Removed redundant null terminator --- src/modules/RF69/RF69.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index aeb1e618..6be42a38 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -326,9 +326,6 @@ int16_t RF69::readData(uint8_t* data, size_t len) { // read packet data _mod->SPIreadRegisterBurst(RF69_REG_FIFO, length, data); - // add terminating null - data[length] = 0; - // update RSSI lastPacketRSSI = -1.0 * (_mod->SPIgetRegValue(RF69_REG_RSSI_VALUE)/2.0); From 99a5a7d1e4eab132b9577ee837d58468d75989d7 Mon Sep 17 00:00:00 2001 From: jgromes Date: Tue, 18 Feb 2020 07:35:41 +0100 Subject: [PATCH 02/10] [nRF24] Removed redundant null terminator --- src/modules/nRF24/nRF24.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/modules/nRF24/nRF24.cpp b/src/modules/nRF24/nRF24.cpp index 14f9a943..3a91862d 100644 --- a/src/modules/nRF24/nRF24.cpp +++ b/src/modules/nRF24/nRF24.cpp @@ -218,9 +218,6 @@ int16_t nRF24::readData(uint8_t* data, size_t len) { // read packet data SPIreadRxPayload(data, length); - // add terminating null - data[length] = 0; - // clear interrupt clearIRQ(); From 885ca868a001c563ebc88aa40d9e1202cc04a23c Mon Sep 17 00:00:00 2001 From: jgromes Date: Tue, 18 Feb 2020 13:36:06 +0100 Subject: [PATCH 03/10] [CC1101] Removed redundant null terminator --- src/modules/CC1101/CC1101.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index 380658bd..022f5eff 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -278,9 +278,6 @@ int16_t CC1101::readData(uint8_t* data, size_t len) { uint8_t val = SPIgetRegValue(CC1101_REG_FIFO); _rawLQI = val & 0x7F; - // add terminating null - data[length] = 0; - // flush Rx FIFO SPIsendCommand(CC1101_CMD_FLUSH_RX); From a60837bb9d01e417b5205a36882489af1b6483b2 Mon Sep 17 00:00:00 2001 From: jgromes Date: Thu, 20 Feb 2020 12:18:52 +0100 Subject: [PATCH 04/10] [CC1101] Removed old call to SPI end --- src/modules/CC1101/CC1101.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index 022f5eff..a207bafb 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -42,7 +42,7 @@ int16_t CC1101::begin(float freq, float br, float freqDev, float rxBw, int8_t po if(!flagFound) { RADIOLIB_DEBUG_PRINTLN(F("No CC1101 found!")); - SPI.end(); + _mod->term(); return(ERR_CHIP_NOT_FOUND); } else { RADIOLIB_DEBUG_PRINTLN(F("Found CC1101! (match by CC1101_REG_VERSION == 0x14)")); From 3054d966a2cec6219c33d2b66bc6370f13a6412a Mon Sep 17 00:00:00 2001 From: jgromes Date: Thu, 20 Feb 2020 12:19:00 +0100 Subject: [PATCH 05/10] [RF69] Removed old call to SPI end --- src/modules/RF69/RF69.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index 6be42a38..b652a5fd 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -47,7 +47,7 @@ int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t powe if(!flagFound) { RADIOLIB_DEBUG_PRINTLN(F("No RF69 found!")); - SPI.end(); + _mod->term(); return(ERR_CHIP_NOT_FOUND); } else { RADIOLIB_DEBUG_PRINTLN(F("Found RF69! (match by RF69_REG_VERSION == 0x24)")); From 4459432998e457317f51c444731f228e4cc445e6 Mon Sep 17 00:00:00 2001 From: jgromes Date: Thu, 20 Feb 2020 12:19:16 +0100 Subject: [PATCH 06/10] [SX1231] Removed old call to SPI end --- src/modules/SX1231/SX1231.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX1231/SX1231.cpp b/src/modules/SX1231/SX1231.cpp index 8c38e8cb..b7412bcb 100644 --- a/src/modules/SX1231/SX1231.cpp +++ b/src/modules/SX1231/SX1231.cpp @@ -37,7 +37,7 @@ int16_t SX1231::begin(float freq, float br, float rxBw, float freqDev, int8_t po if(!flagFound) { RADIOLIB_DEBUG_PRINTLN(F("No SX1231 found!")); - SPI.end(); + _mod->term(); return(ERR_CHIP_NOT_FOUND); } else { RADIOLIB_DEBUG_PRINTLN(F("Found SX1231!")); From 1a75ff837e33b6f8621ebbe734e7b8eeb4727398 Mon Sep 17 00:00:00 2001 From: jgromes Date: Thu, 20 Feb 2020 12:35:44 +0100 Subject: [PATCH 07/10] [Module] Fixed interface termination --- src/Module.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Module.cpp b/src/Module.cpp index 27181535..90075b07 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -73,8 +73,17 @@ void Module::init(uint8_t interface) { } void Module::term() { - // stop SPI - _spi->end(); + // stop hardware interface + switch(interface) { + case RADIOLIB_USE_SPI: + _spi->end(); + break; + case RADIOLIB_USE_UART: + ModuleSerial->end(baudrate, SERIAL_8N1, _rx, _tx); + break; + case RADIOLIB_USE_I2C: + break; + } } void Module::ATemptyBuffer() { From 16073f05ea0464152139e0ed1e695fc135c72c6f Mon Sep 17 00:00:00 2001 From: jgromes Date: Thu, 20 Feb 2020 12:38:51 +0100 Subject: [PATCH 08/10] [Module] Fixed incorrect arguments --- src/Module.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Module.cpp b/src/Module.cpp index 90075b07..bce8abd4 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -73,16 +73,13 @@ void Module::init(uint8_t interface) { } void Module::term() { - // stop hardware interface - switch(interface) { - case RADIOLIB_USE_SPI: - _spi->end(); - break; - case RADIOLIB_USE_UART: - ModuleSerial->end(baudrate, SERIAL_8N1, _rx, _tx); - break; - case RADIOLIB_USE_I2C: - break; + // stop hardware interfaces + if(_spi != nullptr) { + _spi->end(); + } + + if(ModuleSerial != nullptr) { + ModuleSerial->end(); } } From 4426c9174d66946088eafcb164d3762f1a513305 Mon Sep 17 00:00:00 2001 From: 4m1g0 Date: Mon, 24 Feb 2020 15:50:07 +0100 Subject: [PATCH 09/10] [SX127x] Set OOK parameter before setting the bitrate to avoid reading undefined variable --- src/modules/SX127x/SX127x.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 36e4f857..73d796bf 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -74,6 +74,10 @@ int16_t SX127x::beginFSK(uint8_t chipVersion, float br, float freqDev, float rxB RADIOLIB_ASSERT(state); } + // enable/disable OOK + state = setOOK(enableOOK); + RADIOLIB_ASSERT(state); + // set bit rate state = SX127x::setBitRate(br); RADIOLIB_ASSERT(state); @@ -103,10 +107,6 @@ int16_t SX127x::beginFSK(uint8_t chipVersion, float br, float freqDev, float rxB state = disableAddressFiltering(); RADIOLIB_ASSERT(state); - // enable/disable OOK - state = setOOK(enableOOK); - RADIOLIB_ASSERT(state); - // set default RSSI measurement config state = setRSSIConfig(2); RADIOLIB_ASSERT(state); From 1a721715ea974c3410f12b0d2aaad7561ab3f42c Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 24 Feb 2020 16:41:21 +0100 Subject: [PATCH 10/10] Bump version to 3.3.1 --- library.properties | 2 +- src/TypeDef.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index 81829f5b..bee08568 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=RadioLib -version=3.3.0 +version=3.3.1 author=Jan Gromes maintainer=Jan Gromes sentence=Universal wireless communication library for Arduino diff --git a/src/TypeDef.h b/src/TypeDef.h index fb5455ae..8ed5b4ee 100644 --- a/src/TypeDef.h +++ b/src/TypeDef.h @@ -10,7 +10,7 @@ // version definitions #define RADIOLIB_VERSION_MAJOR (0x03) #define RADIOLIB_VERSION_MINOR (0x03) -#define RADIOLIB_VERSION_PATCH (0x00) +#define RADIOLIB_VERSION_PATCH (0x01) #define RADIOLIB_VERSION_EXTRA (0x00) #define RADIOLIB_VERSION ((RADIOLIB_VERSION_MAJOR << 24) | (RADIOLIB_VERSION_MAJOR << 16) | (RADIOLIB_VERSION_MAJOR << 8) | (RADIOLIB_VERSION_EXTRA))