mirror of https://github.com/sqfmi/Watchy.git
Merge branch 'master' into dev
commit
9e5d7ad19c
|
@ -10,8 +10,7 @@
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
//NTP Settings
|
//NTP Settings
|
||||||
#define NTP_SERVER "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT
|
||||||
#define DST_OFFSET_SEC 3600
|
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
CITY_ID,
|
||||||
|
@ -21,8 +20,7 @@ watchySettings settings{
|
||||||
TEMP_LANG,
|
TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
NTP_SERVER,
|
||||||
GMT_OFFSET_SEC,
|
GMT_OFFSET_SEC
|
||||||
DST_OFFSET_SEC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,8 +10,7 @@
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
//NTP Settings
|
//NTP Settings
|
||||||
#define NTP_SERVER "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT
|
||||||
#define DST_OFFSET_SEC 3600
|
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
CITY_ID,
|
||||||
|
@ -21,8 +20,7 @@ watchySettings settings{
|
||||||
TEMP_LANG,
|
TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
NTP_SERVER,
|
||||||
GMT_OFFSET_SEC,
|
GMT_OFFSET_SEC
|
||||||
DST_OFFSET_SEC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,8 +10,7 @@
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
//NTP Settings
|
//NTP Settings
|
||||||
#define NTP_SERVER "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT
|
||||||
#define DST_OFFSET_SEC 3600
|
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
CITY_ID,
|
||||||
|
@ -21,8 +20,7 @@ watchySettings settings{
|
||||||
TEMP_LANG,
|
TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
NTP_SERVER,
|
||||||
GMT_OFFSET_SEC,
|
GMT_OFFSET_SEC
|
||||||
DST_OFFSET_SEC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,8 +10,7 @@
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
//NTP Settings
|
//NTP Settings
|
||||||
#define NTP_SERVER "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT
|
||||||
#define DST_OFFSET_SEC 3600
|
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
CITY_ID,
|
||||||
|
@ -21,8 +20,7 @@ watchySettings settings{
|
||||||
TEMP_LANG,
|
TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
NTP_SERVER,
|
||||||
GMT_OFFSET_SEC,
|
GMT_OFFSET_SEC
|
||||||
DST_OFFSET_SEC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,8 +10,7 @@
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
//NTP Settings
|
//NTP Settings
|
||||||
#define NTP_SERVER "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT
|
||||||
#define DST_OFFSET_SEC 3600
|
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
CITY_ID,
|
||||||
|
@ -21,8 +20,7 @@ watchySettings settings{
|
||||||
TEMP_LANG,
|
TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
NTP_SERVER,
|
||||||
GMT_OFFSET_SEC,
|
GMT_OFFSET_SEC
|
||||||
DST_OFFSET_SEC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,8 +10,7 @@
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
//NTP Settings
|
//NTP Settings
|
||||||
#define NTP_SERVER "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT
|
||||||
#define DST_OFFSET_SEC 3600
|
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
CITY_ID,
|
||||||
|
@ -21,8 +20,7 @@ watchySettings settings{
|
||||||
TEMP_LANG,
|
TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
NTP_SERVER,
|
||||||
GMT_OFFSET_SEC,
|
GMT_OFFSET_SEC
|
||||||
DST_OFFSET_SEC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,8 +10,7 @@
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
//NTP Settings
|
//NTP Settings
|
||||||
#define NTP_SERVER "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT
|
||||||
#define DST_OFFSET_SEC 3600
|
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
CITY_ID,
|
||||||
|
@ -21,8 +20,7 @@ watchySettings settings{
|
||||||
TEMP_LANG,
|
TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
NTP_SERVER,
|
||||||
GMT_OFFSET_SEC,
|
GMT_OFFSET_SEC
|
||||||
DST_OFFSET_SEC
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Watchy",
|
"name": "Watchy",
|
||||||
"version": "1.4.2",
|
"version": "1.4.3",
|
||||||
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
|
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name=Watchy
|
name=Watchy
|
||||||
version=1.4.2
|
version=1.4.3
|
||||||
author=SQFMI
|
author=SQFMI
|
||||||
maintainer=SQFMI
|
maintainer=SQFMI
|
||||||
sentence=Watchy - An Open Source E-Paper Watch by SQFMI
|
sentence=Watchy - An Open Source E-Paper Watch by SQFMI
|
||||||
|
|
|
@ -54,7 +54,7 @@ void Watchy::displayBusyCallback(const void *) {
|
||||||
void Watchy::deepSleep() {
|
void Watchy::deepSleep() {
|
||||||
display.hibernate();
|
display.hibernate();
|
||||||
if (displayFullInit) // For some reason, seems to be enabled on first boot
|
if (displayFullInit) // For some reason, seems to be enabled on first boot
|
||||||
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
|
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
|
||||||
displayFullInit = false; // Notify not to init it again
|
displayFullInit = false; // Notify not to init it again
|
||||||
RTC.clearAlarm(); // resets the alarm flag in the RTC
|
RTC.clearAlarm(); // resets the alarm flag in the RTC
|
||||||
|
|
||||||
|
@ -618,6 +618,8 @@ weatherData Watchy::getWeatherData(String cityID, String units, String lang,
|
||||||
int(responseObject["weather"][0]["id"]);
|
int(responseObject["weather"][0]["id"]);
|
||||||
currentWeather.weatherDescription =
|
currentWeather.weatherDescription =
|
||||||
responseObject["weather"][0]["main"];
|
responseObject["weather"][0]["main"];
|
||||||
|
// sync NTP during weather API call and use timezone of city
|
||||||
|
syncNTP(long(responseObject["timezone"]));
|
||||||
} else {
|
} else {
|
||||||
// http error
|
// http error
|
||||||
}
|
}
|
||||||
|
@ -975,12 +977,16 @@ void Watchy::showSyncNTP() {
|
||||||
|
|
||||||
bool Watchy::syncNTP() { // NTP sync - call after connecting to WiFi and
|
bool Watchy::syncNTP() { // NTP sync - call after connecting to WiFi and
|
||||||
// remember to turn it back off
|
// remember to turn it back off
|
||||||
return syncNTP(settings.gmtOffset, settings.dstOffset,
|
return syncNTP(settings.gmtOffset,
|
||||||
settings.ntpServer.c_str());
|
settings.ntpServer.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Watchy::syncNTP(long gmt, int dst,
|
bool Watchy::syncNTP(long gmt) {
|
||||||
String ntpServer) { // NTP sync - call after connecting to
|
return syncNTP(gmt, settings.ntpServer.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Watchy::syncNTP(long gmt, String ntpServer) {
|
||||||
|
// NTP sync - call after connecting to
|
||||||
// WiFi and remember to turn it back off
|
// WiFi and remember to turn it back off
|
||||||
WiFiUDP ntpUDP;
|
WiFiUDP ntpUDP;
|
||||||
NTPClient timeClient(ntpUDP, ntpServer.c_str(), gmt);
|
NTPClient timeClient(ntpUDP, ntpServer.c_str(), gmt);
|
||||||
|
|
|
@ -62,7 +62,8 @@ public:
|
||||||
void showUpdateFW();
|
void showUpdateFW();
|
||||||
void showSyncNTP();
|
void showSyncNTP();
|
||||||
bool syncNTP();
|
bool syncNTP();
|
||||||
bool syncNTP(long gmt, int dst, String ntpServer);
|
bool syncNTP(long gmt);
|
||||||
|
bool syncNTP(long gmt, String ntpServer);
|
||||||
void setTime();
|
void setTime();
|
||||||
void setupWifi();
|
void setupWifi();
|
||||||
bool connectWiFi();
|
bool connectWiFi();
|
||||||
|
|
Loading…
Reference in New Issue