Fixed webserver update time and modified webstat website content.

This commit is contained in:
Kai Lauterbach 2022-05-16 13:34:33 +02:00
parent 747724c2ed
commit 676a67c3c0
2 changed files with 25 additions and 12 deletions

View file

@ -19,8 +19,8 @@
#define WIFI_AUTOCONNECT_TIMEOUT_S 120 #define WIFI_AUTOCONNECT_TIMEOUT_S 120
#define WIFI_CONFIG_PORTAL_TIMEOUT_S 120 #define WIFI_CONFIG_PORTAL_TIMEOUT_S 120
#define UPDATE_SENSOR_INTERVAL_S 300 #define UPDATE_SENSOR_INTERVAL_S 300
#define UPDATE_WEBSERVER_INTVERVAL_S 1 #define UPDATE_WEBSERVER_INTVERVAL_S 1 // Do not change, bigger values will prevent using the webinterface
#define DELAY_LOOP_MS 60 #define DELAY_LOOP_MS 50
#define POWERSAVING_SLEEP_S 600 #define POWERSAVING_SLEEP_S 600
#define EMERGENCY_SLEEP_S 172800 // Sleep for 2 days to recover #define EMERGENCY_SLEEP_S 172800 // Sleep for 2 days to recover
#define ENERGY_SAVING_ITERATIONS 30 #define ENERGY_SAVING_ITERATIONS 30

View file

@ -83,16 +83,29 @@ void showHTMLMain(void)
void hb_webstat_send(void) void hb_webstat_send(void)
{ {
httpServer.send(200, "text/html", hb_ws_msg_start + unsigned int timestamp = 0;
hb_ws_msg_temp + for (int i = 0; i < VALUES; i++)
String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) + ", " + {
hb_ws_msg_humi + timestamp += int(_webUpdater_sensValues[i]) + millis();
String(int(_webUpdater_sensValues[SENSOR_HUMIDITY]), 2) + ", " + }
hb_ws_msg_light + String msg = hb_ws_msg_start +
String(int(_webUpdater_sensValues[SENSOR_LIGHT]), 2) + ", " + hb_ws_msg_temp +
hb_ws_msg_windspeed + String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) +
String(_webUpdater_sensValues[SENSOR_WINDSPEED], 2) + ", " +
hb_ws_msg_end); hb_ws_msg_humi +
String(_webUpdater_sensValues[SENSOR_HUMIDITY], 2) +
", " +
hb_ws_msg_light +
String(_webUpdater_sensValues[SENSOR_LIGHT], 2) +
", " +
hb_ws_msg_windspeed +
String(_webUpdater_sensValues[SENSOR_WINDSPEED], 2) +
", " +
"\"timestamp\": " +
String(timestamp) +
hb_ws_msg_end;
httpServer.send(200, "text/html", msg);
} }
void resetWifiManager() void resetWifiManager()