diff --git a/examples/WatchFaces/7_SEG/settings.h b/examples/WatchFaces/7_SEG/settings.h index 654a219..98369de 100644 --- a/examples/WatchFaces/7_SEG/settings.h +++ b/examples/WatchFaces/7_SEG/settings.h @@ -10,7 +10,7 @@ #define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes //NTP Settings #define NTP_SERVER "pool.ntp.org" -#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT +#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ CITY_ID, @@ -23,4 +23,4 @@ watchySettings settings{ GMT_OFFSET_SEC }; -#endif \ No newline at end of file +#endif diff --git a/examples/WatchFaces/Basic/settings.h b/examples/WatchFaces/Basic/settings.h index 654a219..98369de 100644 --- a/examples/WatchFaces/Basic/settings.h +++ b/examples/WatchFaces/Basic/settings.h @@ -10,7 +10,7 @@ #define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes //NTP Settings #define NTP_SERVER "pool.ntp.org" -#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT +#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ CITY_ID, @@ -23,4 +23,4 @@ watchySettings settings{ GMT_OFFSET_SEC }; -#endif \ No newline at end of file +#endif diff --git a/examples/WatchFaces/DOS/settings.h b/examples/WatchFaces/DOS/settings.h index 654a219..98369de 100644 --- a/examples/WatchFaces/DOS/settings.h +++ b/examples/WatchFaces/DOS/settings.h @@ -10,7 +10,7 @@ #define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes //NTP Settings #define NTP_SERVER "pool.ntp.org" -#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT +#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ CITY_ID, @@ -23,4 +23,4 @@ watchySettings settings{ GMT_OFFSET_SEC }; -#endif \ No newline at end of file +#endif diff --git a/examples/WatchFaces/MacPaint/settings.h b/examples/WatchFaces/MacPaint/settings.h index 654a219..98369de 100644 --- a/examples/WatchFaces/MacPaint/settings.h +++ b/examples/WatchFaces/MacPaint/settings.h @@ -10,7 +10,7 @@ #define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes //NTP Settings #define NTP_SERVER "pool.ntp.org" -#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT +#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ CITY_ID, @@ -23,4 +23,4 @@ watchySettings settings{ GMT_OFFSET_SEC }; -#endif \ No newline at end of file +#endif diff --git a/examples/WatchFaces/Pokemon/settings.h b/examples/WatchFaces/Pokemon/settings.h index 654a219..98369de 100644 --- a/examples/WatchFaces/Pokemon/settings.h +++ b/examples/WatchFaces/Pokemon/settings.h @@ -10,7 +10,7 @@ #define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes //NTP Settings #define NTP_SERVER "pool.ntp.org" -#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT +#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ CITY_ID, @@ -23,4 +23,4 @@ watchySettings settings{ GMT_OFFSET_SEC }; -#endif \ No newline at end of file +#endif diff --git a/examples/WatchFaces/StarryHorizon/settings.h b/examples/WatchFaces/StarryHorizon/settings.h index 654a219..98369de 100644 --- a/examples/WatchFaces/StarryHorizon/settings.h +++ b/examples/WatchFaces/StarryHorizon/settings.h @@ -10,7 +10,7 @@ #define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes //NTP Settings #define NTP_SERVER "pool.ntp.org" -#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT +#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ CITY_ID, @@ -23,4 +23,4 @@ watchySettings settings{ GMT_OFFSET_SEC }; -#endif \ No newline at end of file +#endif diff --git a/examples/WatchFaces/Tetris/settings.h b/examples/WatchFaces/Tetris/settings.h index 654a219..98369de 100644 --- a/examples/WatchFaces/Tetris/settings.h +++ b/examples/WatchFaces/Tetris/settings.h @@ -10,7 +10,7 @@ #define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes //NTP Settings #define NTP_SERVER "pool.ntp.org" -#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT +#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ CITY_ID, @@ -23,4 +23,4 @@ watchySettings settings{ GMT_OFFSET_SEC }; -#endif \ No newline at end of file +#endif diff --git a/src/Watchy.cpp b/src/Watchy.cpp index b95a036..988ef97 100644 --- a/src/Watchy.cpp +++ b/src/Watchy.cpp @@ -12,6 +12,7 @@ RTC_DATA_ATTR bool BLE_CONFIGURED; RTC_DATA_ATTR weatherData currentWeather; RTC_DATA_ATTR int weatherIntervalCounter = -1; RTC_DATA_ATTR bool displayFullInit = true; +RTC_DATA_ATTR long gmtOffset = 0; void Watchy::init(String datetime) { esp_sleep_wakeup_cause_t wakeup_reason; @@ -38,6 +39,7 @@ void Watchy::init(String datetime) { default: // reset RTC.config(datetime); _bmaConfig(); + gmtOffset = settings.gmtOffset; RTC.read(currentTime); showWatchFace(false); // full update on reset break; @@ -619,7 +621,7 @@ weatherData Watchy::getWeatherData(String cityID, String units, String lang, currentWeather.weatherDescription = responseObject["weather"][0]["main"]; // sync NTP during weather API call and use timezone of city - syncNTP(long(responseObject["timezone"])); + gmtOffset = int(responseObject["timezone"]); } else { // http error } @@ -940,6 +942,8 @@ void Watchy::showSyncNTP() { display.setTextColor(GxEPD_WHITE); display.setCursor(0, 30); display.println("Syncing NTP... "); + display.print("GMT offset: "); + display.println(gmtOffset); display.display(false); // full refresh if (connectWiFi()) { if (syncNTP()) { @@ -977,7 +981,7 @@ void Watchy::showSyncNTP() { bool Watchy::syncNTP() { // NTP sync - call after connecting to WiFi and // remember to turn it back off - return syncNTP(settings.gmtOffset, + return syncNTP(gmtOffset, settings.ntpServer.c_str()); }