Fixed homebrew stat json data generation.

This commit is contained in:
Kai Lauterbach 2022-05-16 10:25:07 +02:00
parent dea274117c
commit e13d72fa2c
3 changed files with 8 additions and 7 deletions

View file

@ -20,7 +20,7 @@
#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
#define DELAY_LOOP_MS 50 #define DELAY_LOOP_MS 60
#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

@ -165,7 +165,8 @@ void setup()
//*************************************************************************// //*************************************************************************//
#ifdef BATTERY_POWERED #ifdef BATTERY_POWERED
void criticalBatCheck() { void criticalBatCheck()
{
float volt = battery_voltage(); float volt = battery_voltage();
if (volt <= BAT_EMERGENCY_DEEPSLEEP_VOLTAGE) { if (volt <= BAT_EMERGENCY_DEEPSLEEP_VOLTAGE) {
debug("Bat Voltage: " + String(volt) + " V"); debug("Bat Voltage: " + String(volt) + " V");
@ -178,7 +179,8 @@ void criticalBatCheck() {
#endif #endif
void loop() { void loop()
{
#ifdef BATTERY_POWERED #ifdef BATTERY_POWERED
delay(50); delay(50);
return; return;
@ -191,7 +193,6 @@ void loop() {
} }
#endif #endif
_loop(); _loop();
//Needed to give WIFI time to function properly //Needed to give WIFI time to function properly

View file

@ -85,11 +85,11 @@ void hb_webstat_send(void)
{ {
httpServer.send(200, "text/html", hb_ws_msg_start + httpServer.send(200, "text/html", hb_ws_msg_start +
hb_ws_msg_temp + hb_ws_msg_temp +
String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) + String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) + ", " +
hb_ws_msg_humi + hb_ws_msg_humi +
String(_webUpdater_sensValues[SENSOR_HUMIDITY], 2) + String(_webUpdater_sensValues[SENSOR_HUMIDITY], 2) + ", " +
hb_ws_msg_light + hb_ws_msg_light +
String(_webUpdater_sensValues[SENSOR_LIGHT], 2) + String(_webUpdater_sensValues[SENSOR_LIGHT], 2) + ", " +
hb_ws_msg_windspeed + hb_ws_msg_windspeed +
String(_webUpdater_sensValues[SENSOR_WINDSPEED], 2) + String(_webUpdater_sensValues[SENSOR_WINDSPEED], 2) +
hb_ws_msg_end); hb_ws_msg_end);