... ntp time sync merge, moving init the network start

pull/87/head
Hansi, dl9rdz 2021-05-29 13:32:08 +02:00
rodzic 35ed5af1a2
commit faa9fc1630
1 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -46,6 +46,10 @@ String updateBinD = "/devel/update.ino.bin";
String *updateBin = &updateBinM;
#define LOCALUDPPORT 9002
//Get real UTC time from NTP server
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 0; //UTC
const int daylightOffset_sec = 0; //UTC
boolean connected = false;
WiFiUDP udp;
@ -2383,6 +2387,7 @@ void enableNetwork(bool enable) {
sondehub_station_update(&shclient, &sonde.config.sondehub);
}
#endif
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
connected = true;
} else {
MDNS.end();
@ -3054,14 +3059,8 @@ void sondehub_send_data(WiFiClient *client, SondeInfo *s, struct st_sondehub *co
return;
}
//Get real UTC time from NTP server
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 0; //UTC
const int daylightOffset_sec = 0; //UTC
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
struct tm timeinfo;
if(!getLocalTime(&timeinfo)){
if(!getLocalTime(&timeinfo, 0)){
Serial.println("Failed to obtain time");
return;
}