Browse Source

update updater

main
Hendrik Langer 3 years ago
parent
commit
35e44cd991
  1. 10
      src/XD0OTA.cpp
  2. 2
      src/XD0OTA.h

10
src/XD0OTA.cpp

@ -105,19 +105,19 @@ int XD0OTA::checkForUpdates() {
} }
void XD0OTA::setClock() { void XD0OTA::setClock() {
configTime(0, 0, "pool.ntp.org", "time.nist.gov"); // UTC configTime(MY_TZ, "pool.ntp.org");
DEBUG_MSG(F("Waiting for NTP time sync: ")); DEBUG_MSG("Waiting for NTP time sync: ");
time_t now = time(nullptr); time_t now = time(nullptr);
while (now < 8 * 3600 * 2) { while (now < 8 * 3600 * 2) {
yield(); yield();
delay(500); delay(500);
DEBUG_MSG(F(".")); DEBUG_MSG(".");
now = time(nullptr); now = time(nullptr);
} }
DEBUG_MSG(F("")); DEBUG_MSG("");
struct tm timeinfo; struct tm timeinfo;
gmtime_r(&now, &timeinfo); gmtime_r(&now, &timeinfo);
DEBUG_MSG(F("Current time: ")); DEBUG_MSG("Current time: ");
Serial.print(asctime(&timeinfo)); Serial.print(asctime(&timeinfo));
} }

2
src/XD0OTA.h

@ -8,6 +8,8 @@
#include <time.h> #include <time.h>
#define MY_TZ "CET-1CEST,M3.5.0,M10.5.0/3" // https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
//const int FW_VERSION = 13; // see main.h //const int FW_VERSION = 13; // see main.h
class XD0OTA { class XD0OTA {

Loading…
Cancel
Save