|
|
|
@ -3,7 +3,7 @@ |
|
|
|
|
//
|
|
|
|
|
// Use from 0 to 4. Higher number, more debugging messages and memory usage.
|
|
|
|
|
//#define _WIFIMGR_LOGLEVEL_ 4
|
|
|
|
|
#define DEBUG 1 |
|
|
|
|
// #define DEBUG 1
|
|
|
|
|
|
|
|
|
|
#include <WiFi.h> |
|
|
|
|
#include <WiFiManager.h> |
|
|
|
@ -54,7 +54,7 @@ const uint8_t degree_sign[8] = { B00010, B00101, B00010, B00000, B00000, B00000, |
|
|
|
|
uint8_t add_summertime = 0; |
|
|
|
|
bool last_reset_ap_check = false; |
|
|
|
|
//bool minmax_enabled = false;
|
|
|
|
|
char date_string_old[9]; |
|
|
|
|
char date_string_old[11]; |
|
|
|
|
char uptime_string[23]; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
@ -146,7 +146,7 @@ void setup() |
|
|
|
|
|
|
|
|
|
lcd.setCursor(0, 3); |
|
|
|
|
lcd.print("Getting time..."); |
|
|
|
|
DateTime.setTimeZone("CET-2"); |
|
|
|
|
DateTime.setTimeZone("CET-1"); |
|
|
|
|
DateTime.setServer(NTP_SERVER); |
|
|
|
|
DateTime.begin(NTP_TIMEOUT); |
|
|
|
|
/* while (!DateTime.isTimeValid())
|
|
|
|
@ -157,9 +157,16 @@ void setup() |
|
|
|
|
if (DateTime.isTimeValid()) |
|
|
|
|
{ |
|
|
|
|
if (is_wintertime(DateTime.getTime()) == false) |
|
|
|
|
{ |
|
|
|
|
add_summertime = 1; |
|
|
|
|
DEBUG_MSG("Summertime\n"); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
add_summertime = 0; |
|
|
|
|
DEBUG_MSG("Wintertime\n"); |
|
|
|
|
} |
|
|
|
|
DEBUG_MSG("add_summertime=%d\n", add_summertime); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// create a degree sign
|
|
|
|
@ -189,6 +196,9 @@ void setup() |
|
|
|
|
setup_screen(); |
|
|
|
|
show_time(); |
|
|
|
|
show_temperature(); |
|
|
|
|
|
|
|
|
|
DEBUG_MSG("10add_summertime=%d\n", add_summertime); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void loop() |
|
|
|
@ -200,12 +210,20 @@ void loop() |
|
|
|
|
if (!DateTime.isTimeValid() && millis() - 10000 > next_time_check) |
|
|
|
|
{ |
|
|
|
|
next_time_check = millis(); |
|
|
|
|
DateTime.setTimeZone("CET-2"); |
|
|
|
|
DateTime.setTimeZone("CET-1"); |
|
|
|
|
DateTime.forceUpdate(); |
|
|
|
|
|
|
|
|
|
if (is_wintertime(DateTime.getTime()) == false) |
|
|
|
|
{ |
|
|
|
|
add_summertime = 1; |
|
|
|
|
DEBUG_MSG("Summertime\n"); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
add_summertime = 0; |
|
|
|
|
DEBUG_MSG("Wintertime\n"); |
|
|
|
|
} |
|
|
|
|
DEBUG_MSG("add_summertime=%d\n", add_summertime); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
WiFiClient client = server.available(); // Listen for incoming clients
|
|
|
|
@ -410,9 +428,16 @@ void show_time(void) |
|
|
|
|
if ((p.getHours() == 2 || p.getHours() == 3) && p.getMinutes() == 0 && p.getSeconds() == 0) |
|
|
|
|
{ |
|
|
|
|
if (is_wintertime(DateTime.getTime()) == false) |
|
|
|
|
{ |
|
|
|
|
add_summertime = 1; |
|
|
|
|
DEBUG_MSG("Summertime\n"); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
add_summertime = 0; |
|
|
|
|
DEBUG_MSG("Wintertime\n"); |
|
|
|
|
} |
|
|
|
|
DEBUG_MSG("add_summertime=%d\n", add_summertime); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sprintf(date_string, "%02d.%02d.%4d", p.getMonthDay(), p.getMonth() + 1, p.getYear()); |
|
|
|
@ -553,33 +578,6 @@ void get_sensor_data(void) |
|
|
|
|
else |
|
|
|
|
heat[ACT] = NAN; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if (minmax_enabled == false && millis() > FIRST_MIN_MAX) |
|
|
|
|
minmax_enabled = true; |
|
|
|
|
|
|
|
|
|
if (minmax_enabled == false) |
|
|
|
|
{ |
|
|
|
|
if (!isnan(temp[ACT])) |
|
|
|
|
{ |
|
|
|
|
temp[MIN] = temp[ACT]; |
|
|
|
|
temp[MAX] = temp[ACT]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isnan(hum[ACT])) |
|
|
|
|
{ |
|
|
|
|
hum[MIN] = hum[ACT]; |
|
|
|
|
hum[MAX] = hum[ACT]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isnan(heat[ACT])) |
|
|
|
|
{ |
|
|
|
|
heat[MIN] = heat[ACT]; |
|
|
|
|
heat[MIN] = heat[ACT]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
*/ |
|
|
|
|
if (!isnan(temp[ACT])) |
|
|
|
|
{ |
|
|
|
|
if (isnan(temp[MIN])) |
|
|
|
|