From cd4924370aaca643e88cea7e21004fb4e4ef7017 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:49:25 +0100 Subject: [PATCH 01/13] Update SX1262.h --- src/modules/SX126x/SX1262.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX1262.h b/src/modules/SX126x/SX1262.h index f47b1a813..2588ab3d1 100644 --- a/src/modules/SX126x/SX1262.h +++ b/src/modules/SX126x/SX1262.h @@ -42,9 +42,10 @@ class SX1262: public SX126x { If you are seeing -706/-707 error codes, it likely means you are using non-0 value for module with XTAL. To use XTAL, either set this value to 0, or set SX126x::XTAL to true. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. + \param rampTime The time delayed to allow the PA to ramp up. Defaults to 200 us. \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 = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, 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 = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); /*! \brief Initialization method for FSK modem. From ad799319c5a358a0daf8c8f6dd1d9b5a43a8ae16 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:50:29 +0100 Subject: [PATCH 02/13] Update SX1262.cpp --- src/modules/SX126x/SX1262.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/SX126x/SX1262.cpp b/src/modules/SX126x/SX1262.cpp index 807b80d6d..1bddcf89c 100644 --- a/src/modules/SX126x/SX1262.cpp +++ b/src/modules/SX126x/SX1262.cpp @@ -5,9 +5,9 @@ SX1262::SX1262(Module* mod) : SX126x(mod) { chipType = RADIOLIB_SX1262_CHIP_TYPE; } -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) { +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, int8_t rampTime) { // execute common part - int16_t state = SX126x::begin(cr, syncWord, preambleLength, tcxoVoltage, useRegulatorLDO); + int16_t state = SX126x::begin(cr, syncWord, preambleLength, tcxoVoltage, useRegulatorLDO, rampTime); RADIOLIB_ASSERT(state); // configure publicly accessible settings From e0cd114d66742b6646d3c11148afc8f29f3a2f47 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:52:16 +0100 Subject: [PATCH 03/13] Update SX126x.h --- src/modules/SX126x/SX126x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index d2b9ecfef..462be1aae 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -475,7 +475,7 @@ class SX126x: public PhysicalLayer { \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \returns \ref status_codes */ - int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false); + int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); /*! \brief Initialization method for FSK modem. From 8fcc906275f61e64878af1e9b51e26a4f3bf31bb Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:54:03 +0100 Subject: [PATCH 04/13] Update SX126x.h --- src/modules/SX126x/SX126x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index 462be1aae..d2b9ecfef 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -475,7 +475,7 @@ class SX126x: public PhysicalLayer { \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \returns \ref status_codes */ - int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); + int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false); /*! \brief Initialization method for FSK modem. From 954e1ff9302890382f9aef68c3db28d950e3baf6 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:55:52 +0100 Subject: [PATCH 05/13] Update SX1262.cpp --- src/modules/SX126x/SX1262.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modules/SX126x/SX1262.cpp b/src/modules/SX126x/SX1262.cpp index 1bddcf89c..3aa5b8f22 100644 --- a/src/modules/SX126x/SX1262.cpp +++ b/src/modules/SX126x/SX1262.cpp @@ -23,7 +23,7 @@ int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync state = SX126x::fixPaClamping(); RADIOLIB_ASSERT(state); - state = setOutputPower(power); + state = setOutputPower(power, rampTime); RADIOLIB_ASSERT(state); return(state); @@ -97,7 +97,7 @@ int16_t SX1262::setFrequency(float freq, bool calibrate) { return(SX126x::setFrequencyRaw(freq)); } -int16_t SX1262::setOutputPower(int8_t power) { +int16_t SX1262::setOutputPower(int8_t power, uint8_t rampTime) { RADIOLIB_CHECK_RANGE(power, -9, 22, RADIOLIB_ERR_INVALID_OUTPUT_POWER); // get current OCP configuration @@ -109,9 +109,8 @@ int16_t SX1262::setOutputPower(int8_t power) { state = SX126x::setPaConfig(0x04, RADIOLIB_SX126X_PA_CONFIG_SX1262); RADIOLIB_ASSERT(state); - // set output power - /// \todo power ramp time configuration - state = SX126x::setTxParams(power); + // set output power and PA ramp time + state = SX126x::setTxParams(power, rampTime); RADIOLIB_ASSERT(state); // restore OCP configuration From 9047d4fe4b68442b35885f77f08fff20db618156 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:57:40 +0100 Subject: [PATCH 06/13] Update SX1262.h --- src/modules/SX126x/SX1262.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/SX126x/SX1262.h b/src/modules/SX126x/SX1262.h index 2588ab3d1..385e8199d 100644 --- a/src/modules/SX126x/SX1262.h +++ b/src/modules/SX126x/SX1262.h @@ -61,7 +61,7 @@ class SX1262: public SX126x { \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \returns \ref status_codes */ - int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); + int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U)); // configuration methods @@ -84,9 +84,10 @@ class SX1262: public SX126x { \brief Sets output power. Allowed values are in range from -9 to 22 dBm. This method is virtual to allow override from the SX1261 class. \param power Output power to be set in dBm. + \param rampTime The time delayed to allow the PA to ramp up. \returns \ref status_codes */ - virtual int16_t setOutputPower(int8_t power); + virtual int16_t setOutputPower(int8_t power, uint8_t rampTime); #if !RADIOLIB_GODMODE private: From 6f03d77daddac78f47c50d2f979a3985f4981004 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:59:31 +0100 Subject: [PATCH 07/13] Update SX1262.cpp --- src/modules/SX126x/SX1262.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/SX126x/SX1262.cpp b/src/modules/SX126x/SX1262.cpp index 3aa5b8f22..dbf004552 100644 --- a/src/modules/SX126x/SX1262.cpp +++ b/src/modules/SX126x/SX1262.cpp @@ -5,9 +5,9 @@ SX1262::SX1262(Module* mod) : SX126x(mod) { chipType = RADIOLIB_SX1262_CHIP_TYPE; } -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, int8_t rampTime) { +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, uint8_t rampTime) { // execute common part - int16_t state = SX126x::begin(cr, syncWord, preambleLength, tcxoVoltage, useRegulatorLDO, rampTime); + int16_t state = SX126x::begin(cr, syncWord, preambleLength, tcxoVoltage, useRegulatorLDO); RADIOLIB_ASSERT(state); // configure publicly accessible settings @@ -29,7 +29,7 @@ int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync return(state); } -int16_t SX1262::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { +int16_t SX1262::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO, uint8_t rampTime)) { // execute common part int16_t state = SX126x::beginFSK(br, freqDev, rxBw, preambleLength, tcxoVoltage, useRegulatorLDO); RADIOLIB_ASSERT(state); @@ -41,7 +41,7 @@ int16_t SX1262::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t state = SX126x::fixPaClamping(); RADIOLIB_ASSERT(state); - state = setOutputPower(power); + state = setOutputPower(power, rampTime); RADIOLIB_ASSERT(state); return(state); @@ -110,6 +110,7 @@ int16_t SX1262::setOutputPower(int8_t power, uint8_t rampTime) { RADIOLIB_ASSERT(state); // set output power and PA ramp time + // fixme: perform check to see if rampTime is in valid range? state = SX126x::setTxParams(power, rampTime); RADIOLIB_ASSERT(state); From a75c3f766bb37af1e1b59a72cba3508188300770 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:00:30 +0100 Subject: [PATCH 08/13] Update SX1262.h --- src/modules/SX126x/SX1262.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX1262.h b/src/modules/SX126x/SX1262.h index 385e8199d..d4bcd98cc 100644 --- a/src/modules/SX126x/SX1262.h +++ b/src/modules/SX126x/SX1262.h @@ -87,7 +87,7 @@ class SX1262: public SX126x { \param rampTime The time delayed to allow the PA to ramp up. \returns \ref status_codes */ - virtual int16_t setOutputPower(int8_t power, uint8_t rampTime); + virtual int16_t setOutputPower(int8_t power, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); #if !RADIOLIB_GODMODE private: From 976edd3aee580fa013012be54b97cfd35269239b Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:02:50 +0100 Subject: [PATCH 09/13] Update SX1262.h --- src/modules/SX126x/SX1262.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX1262.h b/src/modules/SX126x/SX1262.h index d4bcd98cc..c6d3deec2 100644 --- a/src/modules/SX126x/SX1262.h +++ b/src/modules/SX126x/SX1262.h @@ -59,6 +59,7 @@ class SX1262: public SX126x { If you are seeing -706/-707 error codes, it likely means you are using non-0 value for module with XTAL. To use XTAL, either set this value to 0, or set SX126x::XTAL to true. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. + \param rampTime The time delayed to allow the PA to ramp up. Defaults to 200 us. \returns \ref status_codes */ int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U)); @@ -84,7 +85,7 @@ class SX1262: public SX126x { \brief Sets output power. Allowed values are in range from -9 to 22 dBm. This method is virtual to allow override from the SX1261 class. \param power Output power to be set in dBm. - \param rampTime The time delayed to allow the PA to ramp up. + \param rampTime The time delayed to allow the PA to ramp up. Defaults to 200 us. \returns \ref status_codes */ virtual int16_t setOutputPower(int8_t power, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); From 229ab2c90e65b5714886ccb7fa3e767f57da25f3 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:10:53 +0100 Subject: [PATCH 10/13] Update SX1262.cpp --- src/modules/SX126x/SX1262.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX1262.cpp b/src/modules/SX126x/SX1262.cpp index dbf004552..179990964 100644 --- a/src/modules/SX126x/SX1262.cpp +++ b/src/modules/SX126x/SX1262.cpp @@ -29,7 +29,7 @@ int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync return(state); } -int16_t SX1262::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO, uint8_t rampTime)) { +int16_t SX1262::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO, uint8_t rampTime) { // execute common part int16_t state = SX126x::beginFSK(br, freqDev, rxBw, preambleLength, tcxoVoltage, useRegulatorLDO); RADIOLIB_ASSERT(state); From 2f1e53ed352687ef66b1b00d4cc48187dc578534 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:11:21 +0100 Subject: [PATCH 11/13] Update SX1262.h --- src/modules/SX126x/SX1262.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX1262.h b/src/modules/SX126x/SX1262.h index c6d3deec2..113baf674 100644 --- a/src/modules/SX126x/SX1262.h +++ b/src/modules/SX126x/SX1262.h @@ -62,7 +62,7 @@ class SX1262: public SX126x { \param rampTime The time delayed to allow the PA to ramp up. Defaults to 200 us. \returns \ref status_codes */ - int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U)); + int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); // configuration methods From e7e1388de44f7abd888f08e2a1c2b6714fc8b899 Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 13:05:33 +0100 Subject: [PATCH 12/13] Update LLCC68.h --- src/modules/LLCC68/LLCC68.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/LLCC68/LLCC68.h b/src/modules/LLCC68/LLCC68.h index 3a737060f..c7b09c6f0 100644 --- a/src/modules/LLCC68/LLCC68.h +++ b/src/modules/LLCC68/LLCC68.h @@ -36,9 +36,10 @@ class LLCC68: public SX1262 { If you are seeing -706/-707 error codes, it likely means you are using a module with TCXO. To use TCXO, either set this value to its reference voltage, or set SX126x::XTAL to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. + \param rampTime The time delayed to allow the PA to ramp up. Defaults to 200 us. \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 = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t pwr = 10, uint16_t preambleLength = 8, float tcxoVoltage = 0, 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 = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t pwr = 10, uint16_t preambleLength = 8, float tcxoVoltage = 0, bool useRegulatorLDO = false, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); // configuration methods From 676754d2575870adc5f4def5c129d9e405054fdd Mon Sep 17 00:00:00 2001 From: S5NC <145265251+S5NC@users.noreply.github.com> Date: Fri, 5 Apr 2024 13:07:44 +0100 Subject: [PATCH 13/13] Update LLCC68.cpp --- src/modules/LLCC68/LLCC68.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/LLCC68/LLCC68.cpp b/src/modules/LLCC68/LLCC68.cpp index f7d458ad9..734d22588 100644 --- a/src/modules/LLCC68/LLCC68.cpp +++ b/src/modules/LLCC68/LLCC68.cpp @@ -6,7 +6,7 @@ LLCC68::LLCC68(Module* mod) : SX1262(mod) { this->XTAL = true; } -int16_t LLCC68::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t pwr, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { +int16_t LLCC68::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t pwr, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO, uint8_t rampTime) { // execute common part int16_t state = SX126x::begin(cr, syncWord, preambleLength, tcxoVoltage, useRegulatorLDO); RADIOLIB_ASSERT(state); @@ -21,7 +21,7 @@ int16_t LLCC68::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync state = setSpreadingFactor(sf); RADIOLIB_ASSERT(state); - state = setOutputPower(pwr); + state = setOutputPower(pwr, rampTime); RADIOLIB_ASSERT(state); state = SX126x::fixPaClamping();