Use a better name for the parameter so that it is clear that it's dBm that are expected here

This commit is contained in:
obones 2022-08-24 15:38:12 +02:00
parent 9a76aa1c84
commit a7b42b61b2
4 changed files with 10 additions and 10 deletions

View file

@ -872,11 +872,11 @@ float RF69::getRSSI() {
return(-1.0 * (_mod->SPIgetRegValue(RADIOLIB_RF69_REG_RSSI_VALUE)/2.0));
}
int16_t RF69::setRSSIThreshold(float value) {
if (value < 127.5 || value > 0)
int16_t RF69::setRSSIThreshold(float dbm) {
if (dbm < 127.5 || dbm > 0)
return RADIOLIB_ERR_INVALID_RSSI_THRESHOLD;
return _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, (uint8_t)(-2.0 * value), 7, 0);
return _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
}
void RF69::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {

View file

@ -964,11 +964,11 @@ class RF69: public PhysicalLayer {
/*!
\brief Sets the RSSI value above which the RSSI interrupt is signaled
\param value A value between -127.5 and 0 inclusive
\param dbm A dBm value between -127.5 and 0 inclusive
\returns \ref status_codes
*/
int16_t setRSSIThreshold(float value);
int16_t setRSSIThreshold(float dbm);
/*!
\brief Some modules contain external RF switch controlled by two pins. This function gives RadioLib control over those two pins to automatically switch Rx and Tx state.

View file

@ -1184,11 +1184,11 @@ int16_t SX127x::setCrcFiltering(bool crcOn) {
}
}
int16_t SX127x::setRSSIThreshold(float value) {
if (value < 127.5 || value > 0)
int16_t SX127x::setRSSIThreshold(float dbm) {
if (dbm < 127.5 || dbm > 0)
return RADIOLIB_ERR_INVALID_RSSI_THRESHOLD;
return _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RSSI_THRESH, (uint8_t)(-2.0 * value), 7, 0);
return _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
}
int16_t SX127x::setRSSIConfig(uint8_t smoothingSamples, int8_t offset) {

View file

@ -1230,11 +1230,11 @@ class SX127x: public PhysicalLayer {
/*!
\brief Sets the RSSI value above which the RSSI interrupt is signaled
\param value A value between -127.5 and 0 inclusive
\param dbm A dBm value between -127.5 and 0 inclusive
\returns \ref status_codes
*/
int16_t setRSSIThreshold(float value);
int16_t setRSSIThreshold(float dbm);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
protected: