mirror of https://github.com/sqfmi/Watchy.git
Merge branch 'master' into fix/gmtOffset_from_weather
commit
472eee733d
|
@ -15,8 +15,9 @@ Visit [**https://watchy.sqfmi.com**](https://watchy.sqfmi.com) for documentation
|
||||||
2. Install this library (search for **Watchy** in the library manager), and any other dependencies when prompted
|
2. Install this library (search for **Watchy** in the library manager), and any other dependencies when prompted
|
||||||
3. Check out the examples under ```Examples``` -> ```Watchy```
|
3. Check out the examples under ```Examples``` -> ```Watchy```
|
||||||
4. Compile & Upload with these board settings:
|
4. Compile & Upload with these board settings:
|
||||||
* Board: "ESP32 Dev Module"
|
* Board: "Watchy"
|
||||||
* Partition Scheme: "Huge App"
|
* Partition Scheme: "Huge App"
|
||||||
|
* Board Revision: Choose your Watchy version
|
||||||
* All Other Settings: leave to default
|
* All Other Settings: leave to default
|
||||||
|
|
||||||
You may also have to install the [CP2104 USB to Serial drivers](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) if the port is not automatically detected.
|
You may also have to install the [CP2104 USB to Serial drivers](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) if the port is not automatically detected.
|
||||||
|
|
|
@ -13,14 +13,15 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
.cityID = CITY_ID,
|
||||||
OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
TEMP_LANG,
|
.weatherLang = TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
GMT_OFFSET_SEC
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
.cityID = CITY_ID,
|
||||||
OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
TEMP_LANG,
|
.weatherLang = TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
GMT_OFFSET_SEC
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
.cityID = CITY_ID,
|
||||||
OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
TEMP_LANG,
|
.weatherLang = TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
GMT_OFFSET_SEC
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
.cityID = CITY_ID,
|
||||||
OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
TEMP_LANG,
|
.weatherLang = TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
GMT_OFFSET_SEC
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
.cityID = CITY_ID,
|
||||||
OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
TEMP_LANG,
|
.weatherLang = TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
GMT_OFFSET_SEC
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
.cityID = CITY_ID,
|
||||||
OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
TEMP_LANG,
|
.weatherLang = TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
GMT_OFFSET_SEC
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
CITY_ID,
|
.cityID = CITY_ID,
|
||||||
OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
TEMP_LANG,
|
.weatherLang = TEMP_LANG,
|
||||||
WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
GMT_OFFSET_SEC
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,6 +13,7 @@ RTC_DATA_ATTR weatherData currentWeather;
|
||||||
RTC_DATA_ATTR int weatherIntervalCounter = -1;
|
RTC_DATA_ATTR int weatherIntervalCounter = -1;
|
||||||
RTC_DATA_ATTR bool displayFullInit = true;
|
RTC_DATA_ATTR bool displayFullInit = true;
|
||||||
RTC_DATA_ATTR long gmtOffset = 0;
|
RTC_DATA_ATTR long gmtOffset = 0;
|
||||||
|
RTC_DATA_ATTR bool alreadyInMenu = true;
|
||||||
|
|
||||||
void Watchy::init(String datetime) {
|
void Watchy::init(String datetime) {
|
||||||
esp_sleep_wakeup_cause_t wakeup_reason;
|
esp_sleep_wakeup_cause_t wakeup_reason;
|
||||||
|
@ -28,9 +29,26 @@ void Watchy::init(String datetime) {
|
||||||
|
|
||||||
switch (wakeup_reason) {
|
switch (wakeup_reason) {
|
||||||
case ESP_SLEEP_WAKEUP_EXT0: // RTC Alarm
|
case ESP_SLEEP_WAKEUP_EXT0: // RTC Alarm
|
||||||
if (guiState == WATCHFACE_STATE) {
|
RTC.read(currentTime);
|
||||||
RTC.read(currentTime);
|
switch (guiState) {
|
||||||
|
case WATCHFACE_STATE:
|
||||||
showWatchFace(true); // partial updates on tick
|
showWatchFace(true); // partial updates on tick
|
||||||
|
if (settings.vibrateOClock) {
|
||||||
|
if (currentTime.Minute == 0) {
|
||||||
|
// The RTC wakes us up once per minute
|
||||||
|
vibMotor(75, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MAIN_MENU_STATE:
|
||||||
|
// Return to watchface if in menu for more than one tick
|
||||||
|
if (alreadyInMenu) {
|
||||||
|
guiState = WATCHFACE_STATE;
|
||||||
|
showWatchFace(false);
|
||||||
|
} else {
|
||||||
|
alreadyInMenu = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESP_SLEEP_WAKEUP_EXT1: // button Press
|
case ESP_SLEEP_WAKEUP_EXT1: // button Press
|
||||||
|
@ -42,6 +60,7 @@ void Watchy::init(String datetime) {
|
||||||
gmtOffset = settings.gmtOffset;
|
gmtOffset = settings.gmtOffset;
|
||||||
RTC.read(currentTime);
|
RTC.read(currentTime);
|
||||||
showWatchFace(false); // full update on reset
|
showWatchFace(false); // full update on reset
|
||||||
|
vibMotor(75, 4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
deepSleep();
|
deepSleep();
|
||||||
|
@ -259,6 +278,7 @@ void Watchy::showMenu(byte menuIndex, bool partialRefresh) {
|
||||||
display.display(partialRefresh);
|
display.display(partialRefresh);
|
||||||
|
|
||||||
guiState = MAIN_MENU_STATE;
|
guiState = MAIN_MENU_STATE;
|
||||||
|
alreadyInMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Watchy::showFastMenu(byte menuIndex) {
|
void Watchy::showFastMenu(byte menuIndex) {
|
||||||
|
|
|
@ -35,6 +35,8 @@ typedef struct watchySettings {
|
||||||
String ntpServer;
|
String ntpServer;
|
||||||
int gmtOffset;
|
int gmtOffset;
|
||||||
int dstOffset;
|
int dstOffset;
|
||||||
|
//
|
||||||
|
bool vibrateOClock;
|
||||||
} watchySettings;
|
} watchySettings;
|
||||||
|
|
||||||
class Watchy {
|
class Watchy {
|
||||||
|
|
Loading…
Reference in New Issue