diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 8ba3b6e2..8b7d9f11 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -70,6 +70,12 @@ bool RF95Interface::init() int res = lora->begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength); DEBUG_MSG("RF95 init result %d\n", res); + // current limit was removed from module' ctor + // override default value (60 mA) + res = lora->setCurrentLimit(currentLimit); + DEBUG_MSG("Current limit set to %f\n", currentLimit); + DEBUG_MSG("Current limit set result %d\n", res); + if (res == ERR_NONE) res = lora->setCRC(SX126X_LORA_CRC_ON); diff --git a/src/mesh/RadioLibRF95.cpp b/src/mesh/RadioLibRF95.cpp index 1bb2eca4..dcb987d1 100644 --- a/src/mesh/RadioLibRF95.cpp +++ b/src/mesh/RadioLibRF95.cpp @@ -19,6 +19,12 @@ int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_ state = SX127x::begin(RF95_ALT_VERSION, syncWord, preambleLength); RADIOLIB_ASSERT(state); + // current limit was removed from module' ctor + // override default value (60 mA) + state = setCurrentLimit(currentLimit); + DEBUG_MSG("Current limit set to %f\n", currentLimit); + DEBUG_MSG("Current limit set result %d\n", state); + // configure settings not accessible by API state = config(); RADIOLIB_ASSERT(state); diff --git a/src/mesh/RadioLibRF95.h b/src/mesh/RadioLibRF95.h index bfe805f4..d6aeb541 100644 --- a/src/mesh/RadioLibRF95.h +++ b/src/mesh/RadioLibRF95.h @@ -62,6 +62,11 @@ class RadioLibRF95: public SX1278 { /// For debugging uint8_t readReg(uint8_t addr); + protected: + // since default current limit for SX126x/127x in updated RadioLib is 60mA + // use the previous value + float currentLimit = 100; + #ifndef RADIOLIB_GODMODE private: #endif diff --git a/src/mesh/SX1262Interface.cpp b/src/mesh/SX1262Interface.cpp index 0d27bb0b..76d44625 100644 --- a/src/mesh/SX1262Interface.cpp +++ b/src/mesh/SX1262Interface.cpp @@ -53,6 +53,12 @@ bool SX1262Interface::init() int res = lora.begin(freq, bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO); DEBUG_MSG("SX1262 init result %d\n", res); + // current limit was removed from module' ctor + // override default value (60 mA) + res = lora.setCurrentLimit(currentLimit); + DEBUG_MSG("Current limit set to %f\n", currentLimit); + DEBUG_MSG("Current limit set result %d\n", res); + #ifdef SX1262_TXEN // lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX if (res == ERR_NONE)