Browse Source

Support for USA DST calculations (#664)

rfm69
Xose Pérez 6 years ago
parent
commit
c886d9f1b7
6 changed files with 2449 additions and 2435 deletions
  1. +1
    -0
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +4
    -0
      code/espurna/ntp.ino
  4. +2435
    -2434
      code/espurna/static/index.html.gz.h
  5. +8
    -0
      code/html/index.html
  6. +1
    -1
      code/platformio.ini

+ 1
- 0
code/espurna/config/general.h View File

@ -842,6 +842,7 @@ PROGMEM const char* const custom_reset_string[] = {
#define NTP_SYNC_INTERVAL 60 // NTP initial check every minute #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
#define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
#define NTP_START_DELAY 1000 // Delay NTP start 1 second #define NTP_START_DELAY 1000 // Delay NTP start 1 second
#define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ALEXA // ALEXA


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


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

@ -27,6 +27,7 @@ void _ntpWebSocketOnSend(JsonObject& root) {
root["ntpServer"] = getSetting("ntpServer", NTP_SERVER); root["ntpServer"] = getSetting("ntpServer", NTP_SERVER);
root["ntpOffset"] = getSetting("ntpOffset", NTP_TIME_OFFSET).toInt(); root["ntpOffset"] = getSetting("ntpOffset", NTP_TIME_OFFSET).toInt();
root["ntpDST"] = getSetting("ntpDST", NTP_DAY_LIGHT).toInt() == 1; root["ntpDST"] = getSetting("ntpDST", NTP_DAY_LIGHT).toInt() == 1;
root["ntpRegion"] = getSetting("ntpRegion", NTP_DST_REGION).toInt();
if (ntpSynced()) root["now"] = now(); if (ntpSynced()) root["now"] = now();
} }
@ -66,6 +67,9 @@ void _ntpConfigure() {
NTP.setNtpServerName(server); NTP.setNtpServerName(server);
} }
uint8_t dst_region = getSetting("ntpRegion", NTP_DST_REGION).toInt();
NTP.setDSTZone(dst_region);
} }
void _ntpUpdate() { void _ntpUpdate() {


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


+ 8
- 0
code/html/index.html View File

@ -761,6 +761,14 @@
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="ntpDST" /></div> <div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="ntpDST" /></div>
</div> </div>
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">DST Region</label>
<select class="pure-u-1 pure-u-lg-1-4" name="ntpRegion">
<option value="0">Europe</option>
<option value="1">USA</option>
</select>
</div>
</fieldset> </fieldset>
</div> </div>


+ 1
- 1
code/platformio.ini View File

@ -27,7 +27,7 @@ lib_deps =
https://github.com/madpilot/mDNSResolver#4cfcda1 https://github.com/madpilot/mDNSResolver#4cfcda1
https://github.com/xoseperez/my92xx#3.0.1 https://github.com/xoseperez/my92xx#3.0.1
https://bitbucket.org/xoseperez/nofuss.git#0.2.5 https://bitbucket.org/xoseperez/nofuss.git#0.2.5
https://github.com/gmag11/NtpClient.git#10ece38
https://github.com/gmag11/NtpClient.git#28af3a5
OneWire OneWire
PMS Library PMS Library
PZEM004T PZEM004T


Loading…
Cancel
Save