From 14888bca3f920556ce42f50fa8280d4376c54510 Mon Sep 17 00:00:00 2001 From: Slider0007 <115730895+Slider0007@users.noreply.github.com> Date: Sat, 21 Jan 2023 09:24:23 +0100 Subject: [PATCH] Show WIFI signal text labels / Log RSSI value to logfile (#1877) * Overview: WIFI RSSI strength text labels * Log RSSI value (debug level) * Typo --- .../jomjol_tfliteclass/server_tflite.cpp | 10 +++++----- sd-card/html/overview.html | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/code/components/jomjol_tfliteclass/server_tflite.cpp b/code/components/jomjol_tfliteclass/server_tflite.cpp index 53000d9f..2938cc36 100644 --- a/code/components/jomjol_tfliteclass/server_tflite.cpp +++ b/code/components/jomjol_tfliteclass/server_tflite.cpp @@ -870,12 +870,12 @@ void task_autodoFlow(void *pvParameter) LogFile.RemoveOldDataLog(); } - //CPU Temp - float cputmp = temperatureRead(); + //CPU Temp -> Logfile std::stringstream stream; - stream << std::fixed << std::setprecision(1) << cputmp; - string zwtemp = "CPU Temperature: " + stream.str(); - LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zwtemp); + stream << std::fixed << std::setprecision(1) << temperatureRead(); + LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CPU Temperature: " + stream.str() + "°C"); + // WIFI Signal Strength (RSSI) -> Logfile + LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "WIFI Signal (RSSI): " + std::to_string(get_WIFI_RSSI()) + "dBm"); LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Round #" + std::to_string(countRounds) + " completed (" + std::to_string(getUpTime() - roundStartTime) + " seconds)"); diff --git a/sd-card/html/overview.html b/sd-card/html/overview.html index fddab6c3..7f10c72b 100644 --- a/sd-card/html/overview.html +++ b/sd-card/html/overview.html @@ -154,7 +154,22 @@ xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var _rsp = xhttp.responseText; - $('#rssi').html("RSSI: " + _rsp); + var _rspVal = _rsp.split("d")[0] + if (_rspVal >= -55) { + $('#rssi').html("WIFI Signal: Excellent (" + _rsp + ")"); + } + else if (_rspVal < -55 && _rspVal >= -67) { + $('#rssi').html("WIFI Signal: Good (" + _rsp + ")"); + } + else if (_rspVal < -67 && _rspVal >= -78) { + $('#rssi').html("WIFI Signal: Fair (" + _rsp + ")"); + } + else if (_rspVal < -78 && _rspVal >= -85) { + $('#rssi').html("WIFI Signal: Weak (" + _rsp + ")"); + } + else { + $('#rssi').html("WIFI Signal: Unreliable (" + _rsp + ")"); + } } } xhttp.open("GET", url, true);