From b1c98569eaa39a5739f14cda957bbdef96579e9b Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Tue, 16 Mar 2021 15:38:05 +0100 Subject: [PATCH 01/11] RF69::setOOK --- src/modules/RF69/RF69.cpp | 15 +++++++++++++++ src/modules/RF69/RF69.h | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index 65aa67b1..ebd4164c 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -369,6 +369,21 @@ int16_t RF69::readData(uint8_t* data, size_t len) { return(ERR_NONE); } +int16_t RF69::setOOK(bool enableOOK) { + // set OOK and if successful, save the new setting + int16_t state = ERR_NONE; + if(enableOOK) { + state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_OOK, 4, 3, 5); + } else { + state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_FSK, 4, 3, 5); + } + if(state == ERR_NONE) { + _ook = enableOOK; + } + + return(state); +} + int16_t RF69::setFrequency(float freq) { // check allowed frequency range if(!(((freq > 290.0) && (freq < 340.0)) || diff --git a/src/modules/RF69/RF69.h b/src/modules/RF69/RF69.h index 7bb87310..cb2de1ba 100644 --- a/src/modules/RF69/RF69.h +++ b/src/modules/RF69/RF69.h @@ -734,6 +734,15 @@ class RF69: public PhysicalLayer { */ size_t getPacketLength(bool update = true) override; + /*! + \brief Enables/disables OOK modulation instead of FSK. + + \param enableOOK Enable (true) or disable (false) OOK. + + \returns \ref status_codes + */ + int16_t setOOK(bool enableOOK); + /*! \brief Set modem in fixed packet length mode. @@ -848,6 +857,7 @@ class RF69: public PhysicalLayer { float _br = 0; float _rxBw = 0; + bool _ook = false; int16_t _tempOffset = 0; int8_t _power = 0; From 2a01f0785ebf770f3612f92f9d8b16420ac7dfb3 Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Wed, 17 Mar 2021 00:43:35 +0100 Subject: [PATCH 02/11] SX1278::setOokThresholdType() --- src/modules/SX127x/SX127x.cpp | 13 +++++++++++++ src/modules/SX127x/SX127x.h | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 2fac82e7..dc150637 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -836,6 +836,19 @@ int16_t SX127x::disableAddressFiltering() { return(_mod->SPIsetRegValue(SX127X_REG_BROADCAST_ADRS, 0x00)); } +int16_t SX127x::setOokThresholdType(uint8_t type) { + // check active modem + if(getActiveModem() != SX127X_FSK_OOK) { + return(ERR_WRONG_MODEM); + } + + int16_t state = ERR_NONE; + state = _mod->SPIsetRegValue(SX127X_REG_OOK_PEAK, type, 4, 3, 5); + + return(state); +} + + int16_t SX127x::setOOK(bool enableOOK) { // check active modem if(getActiveModem() != SX127X_FSK_OOK) { diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 90425b79..49170d51 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -859,6 +859,16 @@ class SX127x: public PhysicalLayer { */ int16_t setOOK(bool enableOOK); + /*! + \brief Selects the type of threshold in the OOK data slicer + + \param SX127X_OOK_THRESH_FIXED, SX127X_OOK_THRESH_PEAK(default), SX127X_OOK_THRESH_AVERAGE + + \returns \ref status_codes + */ + int16_t setOokThresholdType(uint8_t type); + + /*! \brief Query modem for the packet length of received payload. From f4fac4c09ef5f278f51ff928e33e5c370f363605 Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Wed, 17 Mar 2021 00:56:25 +0100 Subject: [PATCH 03/11] SX127x::setOokFixedOrFloorThreshold --- src/modules/SX127x/SX127x.cpp | 15 ++++++++++++++- src/modules/SX127x/SX127x.h | 9 +++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index dc150637..ef495e67 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -844,10 +844,23 @@ int16_t SX127x::setOokThresholdType(uint8_t type) { int16_t state = ERR_NONE; state = _mod->SPIsetRegValue(SX127X_REG_OOK_PEAK, type, 4, 3, 5); - + return(state); } +int16_t SX127x::setOokFixedOrFloorThreshold(short int value) { + // check active modem + if(getActiveModem() != SX127X_FSK_OOK) { + return(ERR_WRONG_MODEM); + } + + int16_t state = ERR_NONE; + state = _mod->SPIsetRegValue(SX127X_REG_OOK_FIX, value, 7, 0, 5); + + return(state); +} + + int16_t SX127x::setOOK(bool enableOOK) { // check active modem diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 49170d51..94a1bbcf 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -868,6 +868,15 @@ class SX127x: public PhysicalLayer { */ int16_t setOokThresholdType(uint8_t type); + /*! + \brief Fixed threshold for the Data Slicer in OOK mode + Floor threshold for the Data Slicer in OOK when Peak mode is used + + \param value (in DB) + + \returns \ref status_codes + */ + int16_t setOokFixedOrFloorThreshold(short int value); /*! \brief Query modem for the packet length of received payload. From 8a13d1a39525ffac6fd1a1a76eef84eab1a251b5 Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Thu, 18 Mar 2021 18:54:41 +0100 Subject: [PATCH 04/11] SX1278::setGain() added support for FSK_OOK modes --- src/modules/SX127x/SX1278.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/modules/SX127x/SX1278.cpp b/src/modules/SX127x/SX1278.cpp index f9bedb16..d3206f49 100644 --- a/src/modules/SX127x/SX1278.cpp +++ b/src/modules/SX127x/SX1278.cpp @@ -315,8 +315,10 @@ int16_t SX1278::setOutputPower(int8_t power) { } int16_t SX1278::setGain(uint8_t gain) { + int16_t modem = getActiveModem(); + // check active modem - if(getActiveModem() != SX127X_LORA) { + if(modem != SX127X_LORA && modem != SX127X_FSK_OOK) { return(ERR_WRONG_MODEM); } @@ -328,14 +330,27 @@ int16_t SX1278::setGain(uint8_t gain) { // set mode to standby int16_t state = SX127x::standby(); - // set gain - if(gain == 0) { - // gain set to 0, enable AGC loop - state |= _mod->SPIsetRegValue(SX1278_REG_MODEM_CONFIG_3, SX1278_AGC_AUTO_ON, 2, 2); - } else { - state |= _mod->SPIsetRegValue(SX1278_REG_MODEM_CONFIG_3, SX1278_AGC_AUTO_OFF, 2, 2); - state |= _mod->SPIsetRegValue(SX127X_REG_LNA, (gain << 5) | SX127X_LNA_BOOST_ON); + if(modem == SX127X_LORA){ + // set gain + if(gain == 0) { + // gain set to 0, enable AGC loop + state |= _mod->SPIsetRegValue(SX1278_REG_MODEM_CONFIG_3, SX1278_AGC_AUTO_ON, 2, 2); + } else { + state |= _mod->SPIsetRegValue(SX1278_REG_MODEM_CONFIG_3, SX1278_AGC_AUTO_OFF, 2, 2); + state |= _mod->SPIsetRegValue(SX127X_REG_LNA, (gain << 5) | SX127X_LNA_BOOST_ON); + } } + else if(modem == SX127X_FSK_OOK) { + // set gain + if(gain == 0) { + // gain set to 0, enable AGC loop + state |= _mod->SPIsetRegValue(SX127X_REG_RX_CONFIG, SX127X_AGC_AUTO_ON, 3, 3); + } else { + state |= _mod->SPIsetRegValue(SX127X_REG_RX_CONFIG, SX127X_AGC_AUTO_ON, 3, 3); + state |= _mod->SPIsetRegValue(SX127X_REG_LNA, (gain << 5) | SX127X_LNA_BOOST_ON); + } + } + return(state); } From 17a29790627c259a7ce2c380484de354fbd4b671 Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Wed, 17 Mar 2021 14:41:19 +0100 Subject: [PATCH 05/11] ignore jetbrain .idea --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 591da307..f1723db9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ *.tags *.tags1 +# Jetbrain IDEs +.idea + # Debug decoder extras/decoder/log.txt extras/decoder/out.txt From f049a4bc987cfc8c17667ffed003d151b162f47f Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Thu, 18 Mar 2021 22:21:04 +0100 Subject: [PATCH 06/11] SX127x::setOokPeakThresholdDecrement --- src/modules/SX127x/SX127x.cpp | 12 ++++++++++++ src/modules/SX127x/SX127x.h | 11 ++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index ef495e67..21bc79e7 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -860,6 +860,18 @@ int16_t SX127x::setOokFixedOrFloorThreshold(short int value) { return(state); } +int16_t SX127x::setOokPeakThresholdDecrement(short int value) { + // check active modem + if(getActiveModem() != SX127X_FSK_OOK) { + return(ERR_WRONG_MODEM); + } + + int16_t state = ERR_NONE; + state = _mod->SPIsetRegValue(SX127X_REG_OOK_AVG, value, 7, 5, 5); + + return(state); +} + int16_t SX127x::setOOK(bool enableOOK) { diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 94a1bbcf..fae2b2d6 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -862,12 +862,21 @@ class SX127x: public PhysicalLayer { /*! \brief Selects the type of threshold in the OOK data slicer - \param SX127X_OOK_THRESH_FIXED, SX127X_OOK_THRESH_PEAK(default), SX127X_OOK_THRESH_AVERAGE + \param type SX127X_OOK_THRESH_FIXED, SX127X_OOK_THRESH_PEAK(default), SX127X_OOK_THRESH_AVERAGE \returns \ref status_codes */ int16_t setOokThresholdType(uint8_t type); + /*! + \brief Period of decrement of the RSSI threshold in the OOK demodulator + + \param value use defines SX127X_OOK_PEAK_THRESH_DEC_X_X_CHIP + + \returns \ref status_codes + */ + int16_t setOokPeakThresholdDecrement(short int value); + /*! \brief Fixed threshold for the Data Slicer in OOK mode Floor threshold for the Data Slicer in OOK when Peak mode is used From b9e897409e8e8dc3d302b2a8faa21509790652fd Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Fri, 19 Mar 2021 23:29:59 +0100 Subject: [PATCH 07/11] SX1278::getRSSI() modified for OOK so it wont require an activation --- src/modules/SX127x/SX1278.cpp | 8 +++++--- src/modules/SX127x/SX1278.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/SX127x/SX1278.cpp b/src/modules/SX127x/SX1278.cpp index d3206f49..6ff917bc 100644 --- a/src/modules/SX127x/SX1278.cpp +++ b/src/modules/SX127x/SX1278.cpp @@ -416,7 +416,7 @@ int16_t SX1278::setDataShapingOOK(uint8_t sh) { return(state); } -float SX1278::getRSSI() { +float SX1278::getRSSI(bool skip_activation) { if(getActiveModem() == SX127X_LORA) { // for LoRa, get RSSI of the last packet float lastPacketRSSI; @@ -439,13 +439,15 @@ float SX1278::getRSSI() { } else { // enable listen mode - startReceive(); + if(!skip_activation) + startReceive(); // read the value for FSK float rssi = (float)_mod->SPIgetRegValue(SX127X_REG_RSSI_VALUE_FSK) / -2.0; // set mode back to standby - standby(); + if(!skip_activation) + standby(); // return the value return(rssi); diff --git a/src/modules/SX127x/SX1278.h b/src/modules/SX127x/SX1278.h index 70f06092..5be83794 100644 --- a/src/modules/SX127x/SX1278.h +++ b/src/modules/SX127x/SX1278.h @@ -248,9 +248,11 @@ class SX1278: public SX127x { /*! \brief Gets recorded signal strength indicator of the latest received packet for LoRa modem, or current RSSI level for FSK modem. + \param skip_activation in OOK/FSK mode this function will put receiver un receive mode and in standby. Make it TRUE if you don't want this behaviour. + \returns Last packet RSSI for LoRa modem, or current RSSI level for FSK modem. */ - float getRSSI(); + float getRSSI(bool skip_activation=false); /*! \brief Enables/disables CRC check of received packets. From fc3a4a8175bec70d8e70b8174439b79298a91fb3 Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Wed, 24 Mar 2021 08:53:51 +0100 Subject: [PATCH 08/11] doc fix --- src/modules/SX127x/SX127x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index fae2b2d6..fb8f1503 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -881,7 +881,7 @@ class SX127x: public PhysicalLayer { \brief Fixed threshold for the Data Slicer in OOK mode Floor threshold for the Data Slicer in OOK when Peak mode is used - \param value (in DB) + \param value calculation is (128 - value/2) \returns \ref status_codes */ From 97cdce7b645f49ada0bc5cd09abfe8b746f2565d Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Wed, 24 Mar 2021 16:42:29 +0100 Subject: [PATCH 09/11] added RF69::setLnaTestBoost --- src/modules/RF69/RF69.cpp | 7 +++++++ src/modules/RF69/RF69.h | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index ebd4164c..0b98dc0c 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -777,6 +777,13 @@ int16_t RF69::setEncoding(uint8_t encoding) { } } +int16_t RF69::setLnaTestBoost(bool value) { + if(value) + return(_mod->SPIsetRegValue(RF69_REG_TEST_LNA, RF69_TEST_LNA_BOOST_HIGH, 7, 0)); + + return(_mod->SPIsetRegValue(RF69_TEST_LNA_BOOST_NORMAL, RF69_TEST_LNA_BOOST_HIGH, 7, 0)); +} + float RF69::getRSSI() { return(-1.0 * (_mod->SPIgetRegValue(RF69_REG_RSSI_VALUE)/2.0)); } diff --git a/src/modules/RF69/RF69.h b/src/modules/RF69/RF69.h index cb2de1ba..4241526a 100644 --- a/src/modules/RF69/RF69.h +++ b/src/modules/RF69/RF69.h @@ -91,6 +91,7 @@ #define RF69_REG_AES_KEY_16 0x4D #define RF69_REG_TEMP_1 0x4E #define RF69_REG_TEMP_2 0x4F +#define RF69_REG_TEST_LNA 0x58 #define RF69_REG_TEST_PA1 0x5A #define RF69_REG_TEST_PA2 0x5C #define RF69_REG_TEST_DAGC 0x6F @@ -409,6 +410,10 @@ #define RF69_AES_OFF 0b00000000 // 0 0 AES encryption disabled (default) #define RF69_AES_ON 0b00000001 // 0 0 AES encryption enabled, payload size limited to 66 bytes +// RF69_REG_TEST_LNA +#define RF69_TEST_LNA_BOOST_NORMAL 0x1B // 7 0 +#define RF69_TEST_LNA_BOOST_HIGH 0x2D // 7 0 + // RF69_REG_TEMP_1 #define RF69_TEMP_MEAS_START 0b00001000 // 3 3 trigger temperature measurement #define RF69_TEMP_MEAS_RUNNING 0b00000100 // 2 2 temperature measurement status: on-going @@ -815,6 +820,15 @@ class RF69: public PhysicalLayer { */ int16_t setEncoding(uint8_t encoding) override; + /*! + \brief enable/disable LNA Boost mode (disabled by default + + \param value true to enable, false to disable + + \returns \ref status_codes + */ + int16_t setLnaTestBoost(bool value); + /*! \brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. From 7b6f1d075a149666e7583d58008af43e7eb78665 Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Wed, 24 Mar 2021 18:05:32 +0100 Subject: [PATCH 10/11] added RF69::setOokThresholdType --- src/TypeDef.h | 5 +++++ src/modules/RF69/RF69.cpp | 10 ++++++++++ src/modules/RF69/RF69.h | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/src/TypeDef.h b/src/TypeDef.h index 236c7ab4..2d22051d 100644 --- a/src/TypeDef.h +++ b/src/TypeDef.h @@ -325,6 +325,11 @@ */ #define ERR_INVALID_MODULATION -107 +/*! + \brief Supplied Peak type is invalid. +*/ +#define ERR_INVALID_OOK_RSSI_PEAK_TYPE -108 + // ESP8266 status codes /*! diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index 0b98dc0c..80d88f5e 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -384,6 +384,16 @@ int16_t RF69::setOOK(bool enableOOK) { return(state); } +int16_t RF69::setOokThresholdType(uint8_t type) { + if(type != RF69_OOK_THRESH_FIXED && type != RF69_OOK_THRESH_PEAK && RF69_OOK_THRESH_AVERAGE) + return ERR_INVALID_OOK_RSSI_PEAK_TYPE; + + int16_t state = ERR_NONE; + state = _mod->SPIsetRegValue(RF69_REG_OOK_PEAK, type, 7, 3, 5); + + return(state); +} + int16_t RF69::setFrequency(float freq) { // check allowed frequency range if(!(((freq > 290.0) && (freq < 340.0)) || diff --git a/src/modules/RF69/RF69.h b/src/modules/RF69/RF69.h index 4241526a..1474d31c 100644 --- a/src/modules/RF69/RF69.h +++ b/src/modules/RF69/RF69.h @@ -748,6 +748,14 @@ class RF69: public PhysicalLayer { */ int16_t setOOK(bool enableOOK); + /*! + \brief Selects the type of threshold in the OOK data slicer + + \param type RF69_OOK_THRESH_FIXED RF69_OOK_THRESH_PEAK(default) RF69_OOK_THRESH_AVERAGE + \returns \ref status_codes + */ + int16_t setOokThresholdType(uint8_t type); + /*! \brief Set modem in fixed packet length mode. From 3e1088f34ad9c4b1ee6c742910d89d009fcd479f Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Thu, 25 Mar 2021 13:39:44 +0100 Subject: [PATCH 11/11] styles and syntax changes --- keywords.txt | 4 ++++ src/modules/RF69/RF69.cpp | 7 ++++--- src/modules/SX127x/SX1272.cpp | 2 +- src/modules/SX127x/SX1272.h | 4 +++- src/modules/SX127x/SX1278.cpp | 7 +------ src/modules/SX127x/SX1278.h | 2 +- src/modules/SX127x/SX127x.cpp | 4 ++-- src/modules/SX127x/SX127x.h | 4 ++-- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/keywords.txt b/keywords.txt index fd9d2268..34f66d67 100644 --- a/keywords.txt +++ b/keywords.txt @@ -132,6 +132,9 @@ forceLDRO KEYWORD2 autoLDRO KEYWORD2 getChipVersion KEYWORD2 invertIQ KEYWORD2 +setOokThresholdType KEYWORD2 +setOokPeakThresholdDecrement KEYWORD2 +setOokFixedOrFloorThreshold KEYWORD2 # RF69-specific setAESKey KEYWORD2 @@ -139,6 +142,7 @@ enableAES KEYWORD2 disableAES KEYWORD2 getTemperature KEYWORD2 setAmbientTemperature KEYWORD2 +setLnaTestBoost KEYWORD2 # CC1101-specific getLQI KEYWORD2 diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index 80d88f5e..4858380d 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -385,7 +385,7 @@ int16_t RF69::setOOK(bool enableOOK) { } int16_t RF69::setOokThresholdType(uint8_t type) { - if(type != RF69_OOK_THRESH_FIXED && type != RF69_OOK_THRESH_PEAK && RF69_OOK_THRESH_AVERAGE) + if(type != RF69_OOK_THRESH_FIXED && type != RF69_OOK_THRESH_PEAK && type != RF69_OOK_THRESH_AVERAGE) return ERR_INVALID_OOK_RSSI_PEAK_TYPE; int16_t state = ERR_NONE; @@ -788,8 +788,9 @@ int16_t RF69::setEncoding(uint8_t encoding) { } int16_t RF69::setLnaTestBoost(bool value) { - if(value) - return(_mod->SPIsetRegValue(RF69_REG_TEST_LNA, RF69_TEST_LNA_BOOST_HIGH, 7, 0)); + if(value) { + return (_mod->SPIsetRegValue(RF69_REG_TEST_LNA, RF69_TEST_LNA_BOOST_HIGH, 7, 0)); + } return(_mod->SPIsetRegValue(RF69_TEST_LNA_BOOST_NORMAL, RF69_TEST_LNA_BOOST_HIGH, 7, 0)); } diff --git a/src/modules/SX127x/SX1272.cpp b/src/modules/SX127x/SX1272.cpp index 183bbd85..755c39b4 100644 --- a/src/modules/SX127x/SX1272.cpp +++ b/src/modules/SX127x/SX1272.cpp @@ -330,7 +330,7 @@ int16_t SX1272::setDataShapingOOK(uint8_t sh) { return(state); } -float SX1272::getRSSI() { +float SX1272::getRSSI(bool skip_activation) { if(getActiveModem() == SX127X_LORA) { // RSSI calculation uses different constant for low-frequency and high-frequency ports float lastPacketRSSI = -139 + _mod->SPIgetRegValue(SX127X_REG_PKT_RSSI_VALUE); diff --git a/src/modules/SX127x/SX1272.h b/src/modules/SX127x/SX1272.h index 81b84cab..6ec58071 100644 --- a/src/modules/SX127x/SX1272.h +++ b/src/modules/SX127x/SX1272.h @@ -240,9 +240,11 @@ class SX1272: public SX127x { /*! \brief Gets recorded signal strength indicator of the latest received packet for LoRa modem, or current RSSI level for FSK modem. + \param skip_activation in OOK/FSK mode this function will put receiver in receive mode and then in standby. Make it TRUE if you don't want this behaviour. + \returns Last packet RSSI for LoRa modem, or current RSSI level for FSK modem. */ - float getRSSI(); + float getRSSI(bool skip_activation = false); /*! \brief Enables/disables CRC check of received packets. diff --git a/src/modules/SX127x/SX1278.cpp b/src/modules/SX127x/SX1278.cpp index 6ff917bc..3e708bb3 100644 --- a/src/modules/SX127x/SX1278.cpp +++ b/src/modules/SX127x/SX1278.cpp @@ -315,12 +315,7 @@ int16_t SX1278::setOutputPower(int8_t power) { } int16_t SX1278::setGain(uint8_t gain) { - int16_t modem = getActiveModem(); - - // check active modem - if(modem != SX127X_LORA && modem != SX127X_FSK_OOK) { - return(ERR_WRONG_MODEM); - } + int16_t modem = getActiveModem(); // check allowed range if(gain > 6) { diff --git a/src/modules/SX127x/SX1278.h b/src/modules/SX127x/SX1278.h index 5be83794..40bcab66 100644 --- a/src/modules/SX127x/SX1278.h +++ b/src/modules/SX127x/SX1278.h @@ -248,7 +248,7 @@ class SX1278: public SX127x { /*! \brief Gets recorded signal strength indicator of the latest received packet for LoRa modem, or current RSSI level for FSK modem. - \param skip_activation in OOK/FSK mode this function will put receiver un receive mode and in standby. Make it TRUE if you don't want this behaviour. + \param skip_activation in OOK/FSK mode this function will put receiver in receive mode and then in standby. Make it TRUE if you don't want this behaviour. \returns Last packet RSSI for LoRa modem, or current RSSI level for FSK modem. */ diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 21bc79e7..a9127da9 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -848,7 +848,7 @@ int16_t SX127x::setOokThresholdType(uint8_t type) { return(state); } -int16_t SX127x::setOokFixedOrFloorThreshold(short int value) { +int16_t SX127x::setOokFixedOrFloorThreshold(uint8_t value) { // check active modem if(getActiveModem() != SX127X_FSK_OOK) { return(ERR_WRONG_MODEM); @@ -860,7 +860,7 @@ int16_t SX127x::setOokFixedOrFloorThreshold(short int value) { return(state); } -int16_t SX127x::setOokPeakThresholdDecrement(short int value) { +int16_t SX127x::setOokPeakThresholdDecrement(uint8_t value) { // check active modem if(getActiveModem() != SX127X_FSK_OOK) { return(ERR_WRONG_MODEM); diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index fb8f1503..c1d53f0f 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -875,7 +875,7 @@ class SX127x: public PhysicalLayer { \returns \ref status_codes */ - int16_t setOokPeakThresholdDecrement(short int value); + int16_t setOokPeakThresholdDecrement(uint8_t value); /*! \brief Fixed threshold for the Data Slicer in OOK mode @@ -885,7 +885,7 @@ class SX127x: public PhysicalLayer { \returns \ref status_codes */ - int16_t setOokFixedOrFloorThreshold(short int value); + int16_t setOokFixedOrFloorThreshold(uint8_t value); /*! \brief Query modem for the packet length of received payload.