Code cleanup

Clean up code for version 1.0.9
This commit is contained in:
Robert Strouse 2023-02-02 14:17:02 -08:00
parent 92ea0f6c99
commit 0ab2444104
7 changed files with 35 additions and 16 deletions

View file

@ -48,10 +48,9 @@ void Network::loop() {
}
void Network::emitSockets() {
if(WiFi.status() == WL_CONNECTED) {
if(abs(abs(WiFi.RSSI()) - abs(this->lastRSSI)) > 2 || WiFi.channel() != this->lastChannel) {
char buf[128];
sprintf(buf, "{\"ssid\":\"%s\",\"strength\":%d,\"channel\":%d}", WiFi.SSID(), WiFi.RSSI(), WiFi.channel());
snprintf(buf, sizeof(buf), "{\"ssid\":\"%s\",\"strength\":%d,\"channel\":%d}", WiFi.SSID(), WiFi.RSSI(), WiFi.channel());
sockEmit.sendToClients("wifiStrength", buf);
this->lastRSSI = WiFi.RSSI();
this->lastChannel = WiFi.channel();