From a5e41308febedf7291b5ccb116806fb2344ddc39 Mon Sep 17 00:00:00 2001 From: Mario Mariete <11509521+melkati@users.noreply.github.com> Date: Fri, 10 May 2024 07:02:46 +0200 Subject: [PATCH] Add mainDeviceSelected field to CO2_Gadget_WIFI.h and update status.html to display the selected sensor --- CO2_Gadget_Preferences.h | 1 + CO2_Gadget_WIFI.h | 3 ++- data/status.html | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CO2_Gadget_Preferences.h b/CO2_Gadget_Preferences.h index ed2ec3df..ae5d9e52 100644 --- a/CO2_Gadget_Preferences.h +++ b/CO2_Gadget_Preferences.h @@ -292,6 +292,7 @@ void initPreferences() { displayReverse = preferences.getBool("displayReverse", false); showFahrenheit = preferences.getBool("showFahrenheit", false); measurementInterval = preferences.getUInt("measInterval", 10); + if (sampleInterval < 10) sampleInterval = 2; // Minimum sample interval is 2 seconds sampleInterval = preferences.getUInt("sampInterval", 60); outputsModeRelay = preferences.getBool("outModeRelay", false); channelESPNow = preferences.getUInt("channelESPNow", ESPNOW_WIFI_CH); diff --git a/CO2_Gadget_WIFI.h b/CO2_Gadget_WIFI.h index 66ef6fe6..02dc2bd5 100644 --- a/CO2_Gadget_WIFI.h +++ b/CO2_Gadget_WIFI.h @@ -710,7 +710,8 @@ void WiFiStationDisconnected(WiFiEvent_t event, WiFiEventInfo_t info) { } String getCO2GadgetStatusAsJson() { - StaticJsonDocument<512> doc; + StaticJsonDocument<512> doc; + doc["mainDeviceSelected"] = mainDeviceSelected; doc["CO2"] = co2; doc["Temperature"] = temp; doc["Humidity"] = hum; diff --git a/data/status.html b/data/status.html index c7c306f2..f3897db5 100644 --- a/data/status.html +++ b/data/status.html @@ -19,7 +19,9 @@