mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-14 05:15:55 +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) {
|
if (byte(bbuf) == CLIENT_MODE) {
|
||||||
Serial.println(F("Station"));
|
Serial.println(F("Station"));
|
||||||
Serial.print(F("Signal: "));
|
Serial.print(F("Signal: "));
|
||||||
Serial.print(100+WiFi.RSSI());
|
Serial.print(wifi_config.getSignal(WiFi.RSSI()));
|
||||||
Serial.println(F("%"));
|
Serial.println(F("%"));
|
||||||
} else if (byte(bbuf)==AP_MODE) {
|
} else if (byte(bbuf)==AP_MODE) {
|
||||||
Serial.println(F("Access Point"));
|
Serial.println(F("Access Point"));
|
||||||
|
@ -1020,7 +1020,7 @@ void handle_web_interface_home()
|
|||||||
}
|
}
|
||||||
//Signal strength
|
//Signal strength
|
||||||
KeysList.add(FPSTR(KEY_STA_SIGNAL));
|
KeysList.add(FPSTR(KEY_STA_SIGNAL));
|
||||||
ValuesList.add(intTostr(100+WiFi.RSSI()));
|
ValuesList.add(intTostr(wifi_config.getSignal(WiFi.RSSI())));
|
||||||
//DHCP Client status
|
//DHCP Client status
|
||||||
GetDHCPStatus(KeysList, ValuesList);
|
GetDHCPStatus(KeysList, ValuesList);
|
||||||
//IP address
|
//IP address
|
||||||
@ -1955,7 +1955,7 @@ void handle_web_interface_configSTA()
|
|||||||
//signal strength
|
//signal strength
|
||||||
stmp = "$AP_SIGNAL["+String(i)+"]$";
|
stmp = "$AP_SIGNAL["+String(i)+"]$";
|
||||||
KeysList.add(stmp);
|
KeysList.add(stmp);
|
||||||
stmp = intTostr(100+WiFi.RSSI(i)) ;
|
stmp = intTostr(wifi_config.getSignal(WiFi.RSSI(i))) ;
|
||||||
stmp += "%";
|
stmp += "%";
|
||||||
ValuesList.add(stmp);
|
ValuesList.add(stmp);
|
||||||
//is protected
|
//is protected
|
||||||
|
@ -41,6 +41,13 @@ WIFI_CONFIG::WIFI_CONFIG()
|
|||||||
_hostname[0]=0;
|
_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()
|
const char * WIFI_CONFIG::get_hostname()
|
||||||
{
|
{
|
||||||
if (WiFi.hostname().length()==0) {
|
if (WiFi.hostname().length()==0) {
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
int idata_port;
|
int idata_port;
|
||||||
long baud_rate;
|
long baud_rate;
|
||||||
int sleep_mode;
|
int sleep_mode;
|
||||||
|
int32_t getSignal(int32_t RSSI);
|
||||||
bool Setup();
|
bool Setup();
|
||||||
void Safe_Setup();
|
void Safe_Setup();
|
||||||
char * mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]);
|
char * mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user