From e2213ec4b2cc56c63b1b232e378e44f392b9f20a Mon Sep 17 00:00:00 2001 From: lewisxhe Date: Sat, 25 May 2024 11:07:30 +0800 Subject: [PATCH] Fixed SX128X setOutputPower --- lib/RadioLib/src/modules/SX128x/SX128x.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/RadioLib/src/modules/SX128x/SX128x.cpp b/lib/RadioLib/src/modules/SX128x/SX128x.cpp index 58ba3b2..19c1ecd 100644 --- a/lib/RadioLib/src/modules/SX128x/SX128x.cpp +++ b/lib/RadioLib/src/modules/SX128x/SX128x.cpp @@ -781,18 +781,19 @@ int16_t SX128x::setCodingRate(uint8_t cr, bool longInterleaving) { int16_t SX128x::setOutputPower(int8_t pwr) { // check if power value is configurable - int16_t state = checkOutputPower(power, NULL); + int16_t state = checkOutputPower(pwr, NULL); + Serial.println(state); RADIOLIB_ASSERT(state); this->power = pwr + 18; return(setTxParams(this->power)); } -int16_t SX128x::checkOutputPower(int8_t power, int8_t* clipped) { +int16_t SX128x::checkOutputPower(int8_t pwr, int8_t* clipped) { if(clipped) { - *clipped = RADIOLIB_MAX(-18, RADIOLIB_MIN(13, power)); + *clipped = RADIOLIB_MAX(-18, RADIOLIB_MIN(13, pwr)); } - RADIOLIB_CHECK_RANGE(power, -18, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER); + RADIOLIB_CHECK_RANGE(pwr, -18, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER); return(RADIOLIB_ERR_NONE); }