Use the RADIOLIB_CHECK_RANGE macro along with proper lower value (it has to be negative)
This commit is contained in:
parent
a7b42b61b2
commit
40599baef1
2 changed files with 2 additions and 4 deletions
|
@ -873,8 +873,7 @@ float RF69::getRSSI() {
|
|||
}
|
||||
|
||||
int16_t RF69::setRSSIThreshold(float dbm) {
|
||||
if (dbm < 127.5 || dbm > 0)
|
||||
return RADIOLIB_ERR_INVALID_RSSI_THRESHOLD;
|
||||
RADIOLIB_CHECK_RANGE(dbm, -127.5, 0, RADIOLIB_ERR_INVALID_RSSI_THRESHOLD);
|
||||
|
||||
return _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
|
||||
}
|
||||
|
|
|
@ -1185,8 +1185,7 @@ int16_t SX127x::setCrcFiltering(bool crcOn) {
|
|||
}
|
||||
|
||||
int16_t SX127x::setRSSIThreshold(float dbm) {
|
||||
if (dbm < 127.5 || dbm > 0)
|
||||
return RADIOLIB_ERR_INVALID_RSSI_THRESHOLD;
|
||||
RADIOLIB_CHECK_RANGE(dbm, -127.5, 0, RADIOLIB_ERR_INVALID_RSSI_THRESHOLD);
|
||||
|
||||
return _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue