Added check_datetime().

master
Holger Wirtz 4 years ago
parent e49e58fbbb
commit 7a8580d9ab
  1. 14
      WLAN_Thermometer.ino

@ -24,6 +24,7 @@
#define KRATE_TEMP 5000
#define KRATE_TIME 500
#define KRATE_RESET_AP_DATA 5000
#define KRATE_CHECK_DATETIME 250000
#define ONBOARD_LED 2
#define NTP_TIMEOUT 15000
#define WIFI_CONNECT_TIMEOUT 30
@ -157,6 +158,7 @@ void setup()
sched.addJob(show_temperature, KRATE_TEMP);
sched.addJob(show_time, KRATE_TIME);
sched.addJob(check_reset_ap_data, KRATE_RESET_AP_DATA);
sched.addJob(check_datetime, KRATE_CHECK_DATETIME);
get_sensor_data();
temp[MIN] = temp[ACT];
@ -377,7 +379,6 @@ void show_time(void)
{
strcpy(date_string, "--:--:----");
strcpy(time_string, "--:--:--");
DateTime.forceUpdate();
}
if (strcmp(date_string, date_string_old))
@ -576,3 +577,14 @@ void ap_data_reset(void)
delay(1000);
ESP.restart();
}
void check_datetime(void)
{
if (!DateTime.isTimeValid())
{
lcd.setCursor(0, 0);
lcd.print(" Time update ");
DateTime.forceUpdate();
show_time();
}
}

Loading…
Cancel
Save