From b21f93342ed1f5c9eef346a48252415c1b4c147b Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 6 Jul 2020 11:48:25 +0200 Subject: [PATCH] [SX126x] Synced parameters of all LoRa modules --- examples/SX126x/SX126x_Settings/SX126x_Settings.ino | 3 +-- src/modules/SX126x/SX1262.cpp | 4 ++-- src/modules/SX126x/SX1262.h | 6 ++---- src/modules/SX126x/SX1268.cpp | 4 ++-- src/modules/SX126x/SX1268.h | 4 +--- src/modules/SX126x/SX126x.cpp | 8 ++++---- src/modules/SX126x/SX126x.h | 4 +--- 7 files changed, 13 insertions(+), 20 deletions(-) diff --git a/examples/SX126x/SX126x_Settings/SX126x_Settings.ino b/examples/SX126x/SX126x_Settings/SX126x_Settings.ino index 2e500dee..f485284f 100644 --- a/examples/SX126x/SX126x_Settings/SX126x_Settings.ino +++ b/examples/SX126x/SX126x_Settings/SX126x_Settings.ino @@ -70,9 +70,8 @@ void setup() { // coding rate: 5 // sync word: 0x34 (public network/LoRaWAN) // output power: 2 dBm - // current limit: 50 mA // preamble length: 20 symbols - state = radio2.begin(915.0, 500.0, 6, 5, 0x34, 50, 20); + state = radio2.begin(915.0, 500.0, 6, 5, 0x34, 20); if (state == ERR_NONE) { Serial.println(F("success!")); } else { diff --git a/src/modules/SX126x/SX1262.cpp b/src/modules/SX126x/SX1262.cpp index 70bb7c44..b67cf949 100644 --- a/src/modules/SX126x/SX1262.cpp +++ b/src/modules/SX126x/SX1262.cpp @@ -5,9 +5,9 @@ SX1262::SX1262(Module* mod) : SX126x(mod) { } -int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, float currentLimit, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { +int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { // execute common part - int16_t state = SX126x::begin(bw, sf, cr, syncWord, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO); + int16_t state = SX126x::begin(bw, sf, cr, syncWord, tcxoVoltage, useRegulatorLDO); RADIOLIB_ASSERT(state); // configure publicly accessible settings diff --git a/src/modules/SX126x/SX1262.h b/src/modules/SX126x/SX1262.h index 110b4611..616cd407 100644 --- a/src/modules/SX126x/SX1262.h +++ b/src/modules/SX126x/SX1262.h @@ -42,13 +42,13 @@ class SX1262: public SX126x { \param power Output power in dBm. Defaults to 10 dBm. - \param preambleLength LoRa preamble length in symbols.Defaults to 8 symbols. + \param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \returns \ref status_codes */ - int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, float currentLimit = 60.0, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); + int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); /*! \brief Initialization method for FSK modem. @@ -63,8 +63,6 @@ class SX1262: public SX126x { \param power Output power in dBm. Defaults to 10 dBm. - \param currentLimit Current protection limit in mA. Defaults to 60.0 mA. - \parma preambleLength FSK preamble length in bits. Defaults to 16 bits. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. diff --git a/src/modules/SX126x/SX1268.cpp b/src/modules/SX126x/SX1268.cpp index 44923333..673f5853 100644 --- a/src/modules/SX126x/SX1268.cpp +++ b/src/modules/SX126x/SX1268.cpp @@ -5,9 +5,9 @@ SX1268::SX1268(Module* mod) : SX126x(mod) { } -int16_t SX1268::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, float currentLimit, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { +int16_t SX1268::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { // execute common part - int16_t state = SX126x::begin(bw, sf, cr, syncWord, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO); + int16_t state = SX126x::begin(bw, sf, cr, syncWord, preambleLength, tcxoVoltage, useRegulatorLDO); RADIOLIB_ASSERT(state); // configure publicly accessible settings diff --git a/src/modules/SX126x/SX1268.h b/src/modules/SX126x/SX1268.h index 8d289c72..909dd334 100644 --- a/src/modules/SX126x/SX1268.h +++ b/src/modules/SX126x/SX1268.h @@ -42,15 +42,13 @@ class SX1268: public SX126x { \param power Output power in dBm. Defaults to 10 dBm. - \param currentLimit Current protection limit in mA. Defaults to 60.0 mA. - \param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \returns \ref status_codes */ - int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, float currentLimit = 60.0, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); + int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); /*! \brief Initialization method for FSK modem. diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 3b89bdd7..b5b0d8b9 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -5,7 +5,7 @@ SX126x::SX126x(Module* mod) : PhysicalLayer(SX126X_FREQUENCY_STEP_SIZE, SX126X_M _mod = mod; } -int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float currentLimit, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { +int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { // set module properties _mod->init(RADIOLIB_USE_SPI); Module::pinMode(_mod->getIrq(), INPUT); @@ -56,13 +56,13 @@ int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float state = setSyncWord(syncWord); RADIOLIB_ASSERT(state); - state = setCurrentLimit(currentLimit); - RADIOLIB_ASSERT(state); - state = setPreambleLength(preambleLength); RADIOLIB_ASSERT(state); // set publicly accessible settings that are not a part of begin method + state = setCurrentLimit(60.0); + RADIOLIB_ASSERT(state); + state = setDio2AsRfSwitch(true); RADIOLIB_ASSERT(state); diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index faf3ae8b..0461e10b 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -367,8 +367,6 @@ class SX126x: public PhysicalLayer { \param syncWord 1-byte LoRa sync word. - \param currentLimit Current protection limit in mA. - \param preambleLength LoRa preamble length in symbols. Allowed values range from 1 to 65535. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. @@ -377,7 +375,7 @@ class SX126x: public PhysicalLayer { \returns \ref status_codes */ - int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float currentLimit, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false); + int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false); /*! \brief Initialization method for FSK modem.