mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 18:09:01 +08:00
Use correct calculation for signal/RSSI
if (RSSI <= -100) return 0; if (RSSI >= -50) return 100; return (2* (RSSI+100));
This commit is contained in:
parent
014839f953
commit
af283c8f23
@ -266,7 +266,7 @@ void CONFIG::print_config()
|
||||
if (byte(bbuf) == CLIENT_MODE) {
|
||||
Serial.println(F("Station"));
|
||||
Serial.print(F("Signal: "));
|
||||
Serial.print(100+WiFi.RSSI());
|
||||
Serial.print(wifi_config.getSignal(WiFi.RSSI()));
|
||||
Serial.println(F("%"));
|
||||
} else if (byte(bbuf)==AP_MODE) {
|
||||
Serial.println(F("Access Point"));
|
||||
|
@ -1020,7 +1020,7 @@ void handle_web_interface_home()
|
||||
}
|
||||
//Signal strength
|
||||
KeysList.add(FPSTR(KEY_STA_SIGNAL));
|
||||
ValuesList.add(intTostr(100+WiFi.RSSI()));
|
||||
ValuesList.add(intTostr(wifi_config.getSignal(WiFi.RSSI())));
|
||||
//DHCP Client status
|
||||
GetDHCPStatus(KeysList, ValuesList);
|
||||
//IP address
|
||||
@ -1955,7 +1955,7 @@ void handle_web_interface_configSTA()
|
||||
//signal strength
|
||||
stmp = "$AP_SIGNAL["+String(i)+"]$";
|
||||
KeysList.add(stmp);
|
||||
stmp = intTostr(100+WiFi.RSSI(i)) ;
|
||||
stmp = intTostr(wifi_config.getSignal(WiFi.RSSI(i))) ;
|
||||
stmp += "%";
|
||||
ValuesList.add(stmp);
|
||||
//is protected
|
||||
|
@ -41,6 +41,13 @@ WIFI_CONFIG::WIFI_CONFIG()
|
||||
_hostname[0]=0;
|
||||
}
|
||||
|
||||
int32_t WIFI_CONFIG::getSignal(int32_t RSSI)
|
||||
{
|
||||
if (RSSI <= -100) return 0;
|
||||
if (RSSI >= -50) return 100;
|
||||
return (2* (RSSI+100));
|
||||
}
|
||||
|
||||
const char * WIFI_CONFIG::get_hostname()
|
||||
{
|
||||
if (WiFi.hostname().length()==0) {
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
int idata_port;
|
||||
long baud_rate;
|
||||
int sleep_mode;
|
||||
int32_t getSignal(int32_t RSSI);
|
||||
bool Setup();
|
||||
void Safe_Setup();
|
||||
char * mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user