Fix relation between RSSI and signal strength

Fix relation between RSSI and signal strength
This commit is contained in:
Theo Arends 2020-02-20 10:07:00 +01:00
parent 6a84899e10
commit 5e4d8e5641
5 changed files with 12 additions and 6 deletions

View File

@ -75,6 +75,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- Fix PWM flickering at low levels (#7415) - Fix PWM flickering at low levels (#7415)
- Fix Hass sensor discovery part 1/4 by Federico Leoni (#7582, #7548) - Fix Hass sensor discovery part 1/4 by Federico Leoni (#7582, #7548)
- Fix MaxPower functionality (#7647) - Fix MaxPower functionality (#7647)
- Fix relation between RSSI and signal strength
- Add command ``SetOption79 0/1`` to enable reset of counters at teleperiod time by Andre Thomas (#7355) - Add command ``SetOption79 0/1`` to enable reset of counters at teleperiod time by Andre Thomas (#7355)
- Add command ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380 - Add command ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380
- Add command ``SetOption84 1`` to send AWS IoT device shadow updates (alternative to retained) - Add command ``SetOption84 1`` to send AWS IoT device shadow updates (alternative to retained)

View File

@ -5,6 +5,7 @@
- Change MQTT message size with additional 200 characters - Change MQTT message size with additional 200 characters
- Change some wifi code to attempt faster connection (#7621) - Change some wifi code to attempt faster connection (#7621)
- Change display of some date and time messages from "Wed Feb 19 10:45:12 2020" to "2020-02-19T10:45:12" - Change display of some date and time messages from "Wed Feb 19 10:45:12 2020" to "2020-02-19T10:45:12"
- Fix relation between RSSI and signal strength
- Add another new DHT driver based on ESPEasy. The old driver can still be used using define USE_DHT_OLD. The previous new driver can be used with define USE_DHT_V2 (#7717) - Add another new DHT driver based on ESPEasy. The old driver can still be used using define USE_DHT_OLD. The previous new driver can be used with define USE_DHT_V2 (#7717)
### 8.1.0.7 20200210 ### 8.1.0.7 20200210

View File

@ -51,7 +51,8 @@ void OsWatchTicker(void)
uint32_t last_run = abs(t - oswatch_last_loop_time); uint32_t last_run = abs(t - oswatch_last_loop_time);
#ifdef DEBUG_THEO #ifdef DEBUG_THEO
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d %% (%d dBm), last_run %d"), ESP.getFreeHeap(), WifiGetRssiAsQuality(WiFi.RSSI()), WiFi.RSSI(), last_run); int32_t rssi = WiFi.RSSI();
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d %% (%d dBm), last_run %d"), ESP.getFreeHeap(), WifiGetRssiAsQuality(rssi), rssi, last_run);
#endif // DEBUG_THEO #endif // DEBUG_THEO
if (last_run >= (OSWATCH_RESET_TIME * 1000)) { if (last_run >= (OSWATCH_RESET_TIME * 1000)) {
// AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING)); // Save iram space // AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING)); // Save iram space

View File

@ -647,9 +647,10 @@ void MqttShowState(void)
MqttShowPWMState(); MqttShowPWMState();
} }
int32_t rssi = WiFi.RSSI();
ResponseAppend_P(PSTR(",\"" D_JSON_WIFI "\":{\"" D_JSON_AP "\":%d,\"" D_JSON_SSID "\":\"%s\",\"" D_JSON_BSSID "\":\"%s\",\"" D_JSON_CHANNEL "\":%d,\"" D_JSON_RSSI "\":%d,\"" D_JSON_SIGNAL "\":%d,\"" D_JSON_LINK_COUNT "\":%d,\"" D_JSON_DOWNTIME "\":\"%s\"}}"), ResponseAppend_P(PSTR(",\"" D_JSON_WIFI "\":{\"" D_JSON_AP "\":%d,\"" D_JSON_SSID "\":\"%s\",\"" D_JSON_BSSID "\":\"%s\",\"" D_JSON_CHANNEL "\":%d,\"" D_JSON_RSSI "\":%d,\"" D_JSON_SIGNAL "\":%d,\"" D_JSON_LINK_COUNT "\":%d,\"" D_JSON_DOWNTIME "\":\"%s\"}}"),
Settings.sta_active +1, SettingsText(SET_STASSID1 + Settings.sta_active), WiFi.BSSIDstr().c_str(), WiFi.channel(), Settings.sta_active +1, SettingsText(SET_STASSID1 + Settings.sta_active), WiFi.BSSIDstr().c_str(), WiFi.channel(),
WifiGetRssiAsQuality(WiFi.RSSI()), WiFi.RSSI(), WifiLinkCount(), WifiDowntime().c_str()); WifiGetRssiAsQuality(rssi), rssi, WifiLinkCount(), WifiDowntime().c_str());
} }
void MqttPublishTeleState(void) void MqttPublishTeleState(void)

View File

@ -1719,16 +1719,17 @@ void HandleWifiConfiguration(void)
//display networks in page //display networks in page
for (uint32_t i = 0; i < n; i++) { for (uint32_t i = 0; i < n; i++) {
if (-1 == indices[i]) { continue; } // skip dups if (-1 == indices[i]) { continue; } // skip dups
int32_t rssi = WiFi.RSSI(indices[i])
DEBUG_CORE_LOG(PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"), DEBUG_CORE_LOG(PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"),
WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), WiFi.RSSI(indices[i])); WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), rssi);
int quality = WifiGetRssiAsQuality(WiFi.RSSI(indices[i])); int quality = WifiGetRssiAsQuality(rssi);
int auth = WiFi.encryptionType(indices[i]); int auth = WiFi.encryptionType(indices[i]);
char encryption[20]; char encryption[20];
WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a>&nbsp;(%d)&nbsp<span class='q'>%s %d%% (%d dBm)</span></div>"), WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a>&nbsp;(%d)&nbsp<span class='q'>%s %d%% (%d dBm)</span></div>"),
HtmlEscape(WiFi.SSID(indices[i])).c_str(), HtmlEscape(WiFi.SSID(indices[i])).c_str(),
WiFi.channel(indices[i]), WiFi.channel(indices[i]),
GetTextIndexed(encryption, sizeof(encryption), auth +1, kEncryptionType), GetTextIndexed(encryption, sizeof(encryption), auth +1, kEncryptionType),
quality, WiFi.RSSI(indices[i]) quality, rssi
); );
delay(0); delay(0);
@ -2067,7 +2068,8 @@ void HandleInformation(void)
WSContentSend_P(PSTR("}1" D_FRIENDLY_NAME " %d}2%s"), i +1, SettingsText(SET_FRIENDLYNAME1 +i)); WSContentSend_P(PSTR("}1" D_FRIENDLY_NAME " %d}2%s"), i +1, SettingsText(SET_FRIENDLYNAME1 +i));
} }
WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line WSContentSend_P(PSTR("}1}2&nbsp;")); // Empty line
WSContentSend_P(PSTR("}1" D_AP "%d " D_SSID " (" D_RSSI ")}2%s (%d%%, %d dBm)"), Settings.sta_active +1, SettingsText(SET_STASSID1 + Settings.sta_active), WifiGetRssiAsQuality(WiFi.RSSI()), WiFi.RSSI()); int32_t rssi = WiFi.RSSI();
WSContentSend_P(PSTR("}1" D_AP "%d " D_SSID " (" D_RSSI ")}2%s (%d%%, %d dBm)"), Settings.sta_active +1, SettingsText(SET_STASSID1 + Settings.sta_active), WifiGetRssiAsQuality(rssi), rssi);
WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"), my_hostname, (Wifi.mdns_begun) ? ".local" : ""); WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"), my_hostname, (Wifi.mdns_begun) ? ".local" : "");
#if LWIP_IPV6 #if LWIP_IPV6
String ipv6_addr = WifiGetIPv6(); String ipv6_addr = WifiGetIPv6();