Skip to content

Commit

Permalink
Support for USA DST calculations (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoseperez committed Mar 15, 2018
1 parent 6150544 commit c886d9f
Show file tree
Hide file tree
Showing 6 changed files with 2,449 additions and 2,435 deletions.
1 change: 1 addition & 0 deletions code/espurna/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ PROGMEM const char* const custom_reset_string[] = {
#define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
#define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
#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
Expand Down
Binary file modified code/espurna/data/index.html.gz
Binary file not shown.
4 changes: 4 additions & 0 deletions code/espurna/ntp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void _ntpWebSocketOnSend(JsonObject& root) {
root["ntpServer"] = getSetting("ntpServer", NTP_SERVER);
root["ntpOffset"] = getSetting("ntpOffset", NTP_TIME_OFFSET).toInt();
root["ntpDST"] = getSetting("ntpDST", NTP_DAY_LIGHT).toInt() == 1;
root["ntpRegion"] = getSetting("ntpRegion", NTP_DST_REGION).toInt();
if (ntpSynced()) root["now"] = now();
}

Expand Down Expand Up @@ -66,6 +67,9 @@ void _ntpConfigure() {
NTP.setNtpServerName(server);
}

uint8_t dst_region = getSetting("ntpRegion", NTP_DST_REGION).toInt();
NTP.setDSTZone(dst_region);

}

void _ntpUpdate() {
Expand Down
Loading

0 comments on commit c886d9f

Please sign in to comment.