Browse Source

Changes in NTP

fastled
Xose Pérez 7 years ago
parent
commit
a25a6904b1
4 changed files with 2285 additions and 2286 deletions
  1. BIN
      code/espurna/data/index.html.gz
  2. +6
    -6
      code/espurna/ntp.ino
  3. +2278
    -2279
      code/espurna/static/index.html.gz.h
  4. +1
    -1
      code/html/index.html

BIN
code/espurna/data/index.html.gz View File


+ 6
- 6
code/espurna/ntp.ino View File

@ -31,7 +31,10 @@ void _ntpWebSocketOnSend(JsonObject& root) {
root["ntpDST"] = getSetting("ntpDST", NTP_DAY_LIGHT).toInt() == 1;
}
void _ntpDebug() {
void _ntpUpdate() {
#if WEB_SUPPORT
wsSend(_ntpWebSocketOnSend);
#endif
DEBUG_MSG_P(PSTR("[NTP] Time: %s\n"), (char *) ntpDateTime().c_str());
}
@ -62,7 +65,7 @@ String ntpDateTime() {
int month = value.substring(12, 14).toInt();
int year = value.substring(15, 19).toInt();
char buffer[20];
snprintf_P(buffer, sizeof(buffer), PSTR("%04d/%02d/%02d %02d:%02d:%02d"), year, month, day, hour, minute, second);
snprintf_P(buffer, sizeof(buffer), PSTR("%04d-%02d-%02d %02d:%02d:%02d"), year, month, day, hour, minute, second);
return String(buffer);
}
@ -79,10 +82,7 @@ void ntpSetup() {
DEBUG_MSG_P(PSTR("[NTP] Error: Invalid NTP server address\n"));
}
} else {
#if WEB_SUPPORT
wsSend_P(PSTR("{\"ntpStatus\": true}"));
#endif
_ntp_delay.once_ms(100, _ntpDebug);
_ntp_delay.once_ms(100, _ntpUpdate);
}
});


+ 2278
- 2279
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 1
- 1
code/html/index.html View File

@ -685,7 +685,7 @@
</div>
<div class="pure-g">
<div class="pure-u-1 pure-u-sm-1-4"><label for="ntpDST">Enable Daylight Saving Time</label></div>
<div class="pure-u-1 pure-u-sm-1-4"><label for="ntpDST">Enable DST</label></div>
<div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="ntpDST" /></div>
</div>


Loading…
Cancel
Save