Browse Source

Reset NTP connection from the JustWifi connection callback

fastled
Xose Pérez 7 years ago
parent
commit
4e0e8038b1
2 changed files with 6 additions and 4 deletions
  1. +1
    -4
      code/espurna/ntp.ino
  2. +5
    -0
      code/espurna/wifi.ino

+ 1
- 4
code/espurna/ntp.ino View File

@ -14,7 +14,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
// NTP
// -----------------------------------------------------------------------------
void ntpConnect(WiFiEventStationModeGotIP ipInfo) {
void ntpConnect() {
NTP.begin(NTP_SERVER, NTP_TIME_OFFSET, NTP_DAY_LIGHT);
NTP.setInterval(NTP_UPDATE_INTERVAL);
}
@ -33,9 +33,6 @@ void ntpSetup() {
}
});
static WiFiEventHandler e;
e = WiFi.onStationModeGotIP(ntpConnect);
}
void ntpLoop() {


+ 5
- 0
code/espurna/wifi.ino View File

@ -168,6 +168,11 @@ void wifiSetup() {
dnsServer.stop();
}
// NTP connection reset
if (code == MESSAGE_CONNECTED) {
ntpConnect();
}
// Manage POW
#if ENABLE_POW
if (code == MESSAGE_CONNECTED) {


Loading…
Cancel
Save