diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index b3405914..291cc715 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -662,6 +662,11 @@ int16_t SX126x::setSyncWord(uint8_t syncWord, uint8_t controlBits) { } int16_t SX126x::setCurrentLimit(float currentLimit) { + // check allowed range + if(!((currentLimit >= 0) && (currentLimit <= 140))) { + return(ERR_INVALID_CURRENT_LIMIT); + } + // calculate raw value uint8_t rawLimit = (uint8_t)(currentLimit / 2.5);