Reworked the way the rssi percentage is computed

This commit is contained in:
anschrammh 2020-12-09 22:36:02 +01:00
parent 58b8891d41
commit e0bea5fae4
2 changed files with 3 additions and 3 deletions

View File

@ -104,7 +104,7 @@ boolean ConnectivityManager::isAPEnabled()
unsigned char ConnectivityManager::RSSIPercent()
{
int RSSIdBm = RSSI();
return COEF_RSSI * ((double)RSSIdBm - (double)MIN_RSSI);
return (RSSIdBm < MIN_RSSI) ? 0 : COEF_RSSI * ((double)RSSIdBm - (double)MIN_RSSI);
}
unsigned char ConnectivityManager::getError() const

View File

@ -7,9 +7,9 @@
#include "CFGDictionary.h"
#include "definition.h"
#define MIN_RSSI -81
#define MIN_RSSI -90
#define MAX_RSSI -50
#define COEF_RSSI 3.225806452
#define COEF_RSSI 2.5
#define STA_ENABLED_DISABLE_ERR B00001000
#define AP_ENABLED_DISABLE_ERR B00000001