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_CONFIG_PORTAL_TIMEOUT_S 120
#define UPDATE_SENSOR_INTERVAL_S 300
#define UPDATE_WEBSERVER_INTVERVAL_S 1
#define DELAY_LOOP_MS 60
#define UPDATE_WEBSERVER_INTVERVAL_S 1 // Do not change, bigger values will prevent using the webinterface
#define DELAY_LOOP_MS 50
#define POWERSAVING_SLEEP_S 600
#define EMERGENCY_SLEEP_S 172800 // Sleep for 2 days to recover
#define ENERGY_SAVING_ITERATIONS 30

View file

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