Several fixes.

master
Holger Wirtz 4 years ago
parent 5bac9a25ac
commit ee97fb2fd1
  1. 62
      WLAN_Thermometer.ino

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

Loading…
Cancel
Save