diff --git a/README.md b/README.md index ccaa9da..b93a192 100644 --- a/README.md +++ b/README.md @@ -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 3. Check out the examples under ```Examples``` -> ```Watchy``` 4. Compile & Upload with these board settings: - * Board: "ESP32 Dev Module" + * Board: "Watchy" * Partition Scheme: "Huge App" + * Board Revision: Choose your Watchy version * 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. diff --git a/examples/WatchFaces/7_SEG/settings.h b/examples/WatchFaces/7_SEG/settings.h index 98369de..808a79b 100644 --- a/examples/WatchFaces/7_SEG/settings.h +++ b/examples/WatchFaces/7_SEG/settings.h @@ -13,14 +13,15 @@ #define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ - CITY_ID, - OPENWEATHERMAP_APIKEY, - OPENWEATHERMAP_URL, - TEMP_UNIT, - TEMP_LANG, - WEATHER_UPDATE_INTERVAL, - NTP_SERVER, - GMT_OFFSET_SEC + .cityID = CITY_ID, + .weatherAPIKey = OPENWEATHERMAP_APIKEY, + .weatherURL = OPENWEATHERMAP_URL, + .weatherUnit = TEMP_UNIT, + .weatherLang = TEMP_LANG, + .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, + .ntpServer = NTP_SERVER, + .gmtOffset = GMT_OFFSET_SEC, + .vibrateOClock = true, }; #endif diff --git a/examples/WatchFaces/Basic/settings.h b/examples/WatchFaces/Basic/settings.h index 98369de..fa537fa 100644 --- a/examples/WatchFaces/Basic/settings.h +++ b/examples/WatchFaces/Basic/settings.h @@ -13,14 +13,14 @@ #define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ - CITY_ID, - OPENWEATHERMAP_APIKEY, - OPENWEATHERMAP_URL, - TEMP_UNIT, - TEMP_LANG, - WEATHER_UPDATE_INTERVAL, - NTP_SERVER, - GMT_OFFSET_SEC + .cityID = CITY_ID, + .weatherAPIKey = OPENWEATHERMAP_APIKEY, + .weatherURL = OPENWEATHERMAP_URL, + .weatherUnit = TEMP_UNIT, + .weatherLang = TEMP_LANG, + .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, + .ntpServer = NTP_SERVER, + .gmtOffset = GMT_OFFSET_SEC, }; #endif diff --git a/examples/WatchFaces/DOS/settings.h b/examples/WatchFaces/DOS/settings.h index 98369de..fa537fa 100644 --- a/examples/WatchFaces/DOS/settings.h +++ b/examples/WatchFaces/DOS/settings.h @@ -13,14 +13,14 @@ #define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ - CITY_ID, - OPENWEATHERMAP_APIKEY, - OPENWEATHERMAP_URL, - TEMP_UNIT, - TEMP_LANG, - WEATHER_UPDATE_INTERVAL, - NTP_SERVER, - GMT_OFFSET_SEC + .cityID = CITY_ID, + .weatherAPIKey = OPENWEATHERMAP_APIKEY, + .weatherURL = OPENWEATHERMAP_URL, + .weatherUnit = TEMP_UNIT, + .weatherLang = TEMP_LANG, + .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, + .ntpServer = NTP_SERVER, + .gmtOffset = GMT_OFFSET_SEC, }; #endif diff --git a/examples/WatchFaces/MacPaint/settings.h b/examples/WatchFaces/MacPaint/settings.h index 98369de..fa537fa 100644 --- a/examples/WatchFaces/MacPaint/settings.h +++ b/examples/WatchFaces/MacPaint/settings.h @@ -13,14 +13,14 @@ #define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ - CITY_ID, - OPENWEATHERMAP_APIKEY, - OPENWEATHERMAP_URL, - TEMP_UNIT, - TEMP_LANG, - WEATHER_UPDATE_INTERVAL, - NTP_SERVER, - GMT_OFFSET_SEC + .cityID = CITY_ID, + .weatherAPIKey = OPENWEATHERMAP_APIKEY, + .weatherURL = OPENWEATHERMAP_URL, + .weatherUnit = TEMP_UNIT, + .weatherLang = TEMP_LANG, + .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, + .ntpServer = NTP_SERVER, + .gmtOffset = GMT_OFFSET_SEC, }; #endif diff --git a/examples/WatchFaces/Pokemon/settings.h b/examples/WatchFaces/Pokemon/settings.h index 98369de..fa537fa 100644 --- a/examples/WatchFaces/Pokemon/settings.h +++ b/examples/WatchFaces/Pokemon/settings.h @@ -13,14 +13,14 @@ #define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ - CITY_ID, - OPENWEATHERMAP_APIKEY, - OPENWEATHERMAP_URL, - TEMP_UNIT, - TEMP_LANG, - WEATHER_UPDATE_INTERVAL, - NTP_SERVER, - GMT_OFFSET_SEC + .cityID = CITY_ID, + .weatherAPIKey = OPENWEATHERMAP_APIKEY, + .weatherURL = OPENWEATHERMAP_URL, + .weatherUnit = TEMP_UNIT, + .weatherLang = TEMP_LANG, + .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, + .ntpServer = NTP_SERVER, + .gmtOffset = GMT_OFFSET_SEC, }; #endif diff --git a/examples/WatchFaces/StarryHorizon/settings.h b/examples/WatchFaces/StarryHorizon/settings.h index 98369de..fa537fa 100644 --- a/examples/WatchFaces/StarryHorizon/settings.h +++ b/examples/WatchFaces/StarryHorizon/settings.h @@ -13,14 +13,14 @@ #define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ - CITY_ID, - OPENWEATHERMAP_APIKEY, - OPENWEATHERMAP_URL, - TEMP_UNIT, - TEMP_LANG, - WEATHER_UPDATE_INTERVAL, - NTP_SERVER, - GMT_OFFSET_SEC + .cityID = CITY_ID, + .weatherAPIKey = OPENWEATHERMAP_APIKEY, + .weatherURL = OPENWEATHERMAP_URL, + .weatherUnit = TEMP_UNIT, + .weatherLang = TEMP_LANG, + .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, + .ntpServer = NTP_SERVER, + .gmtOffset = GMT_OFFSET_SEC, }; #endif diff --git a/examples/WatchFaces/Tetris/settings.h b/examples/WatchFaces/Tetris/settings.h index 98369de..fa537fa 100644 --- a/examples/WatchFaces/Tetris/settings.h +++ b/examples/WatchFaces/Tetris/settings.h @@ -13,14 +13,14 @@ #define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data watchySettings settings{ - CITY_ID, - OPENWEATHERMAP_APIKEY, - OPENWEATHERMAP_URL, - TEMP_UNIT, - TEMP_LANG, - WEATHER_UPDATE_INTERVAL, - NTP_SERVER, - GMT_OFFSET_SEC + .cityID = CITY_ID, + .weatherAPIKey = OPENWEATHERMAP_APIKEY, + .weatherURL = OPENWEATHERMAP_URL, + .weatherUnit = TEMP_UNIT, + .weatherLang = TEMP_LANG, + .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, + .ntpServer = NTP_SERVER, + .gmtOffset = GMT_OFFSET_SEC, }; #endif diff --git a/src/Watchy.cpp b/src/Watchy.cpp index a334d65..0ffb0a2 100644 --- a/src/Watchy.cpp +++ b/src/Watchy.cpp @@ -13,6 +13,7 @@ RTC_DATA_ATTR weatherData currentWeather; RTC_DATA_ATTR int weatherIntervalCounter = -1; RTC_DATA_ATTR bool displayFullInit = true; RTC_DATA_ATTR long gmtOffset = 0; +RTC_DATA_ATTR bool alreadyInMenu = true; void Watchy::init(String datetime) { esp_sleep_wakeup_cause_t wakeup_reason; @@ -28,9 +29,26 @@ void Watchy::init(String datetime) { switch (wakeup_reason) { 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 + 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; case ESP_SLEEP_WAKEUP_EXT1: // button Press @@ -42,6 +60,7 @@ void Watchy::init(String datetime) { gmtOffset = settings.gmtOffset; RTC.read(currentTime); showWatchFace(false); // full update on reset + vibMotor(75, 4); break; } deepSleep(); @@ -259,6 +278,7 @@ void Watchy::showMenu(byte menuIndex, bool partialRefresh) { display.display(partialRefresh); guiState = MAIN_MENU_STATE; + alreadyInMenu = false; } void Watchy::showFastMenu(byte menuIndex) { diff --git a/src/Watchy.h b/src/Watchy.h index af6ae29..74140c9 100644 --- a/src/Watchy.h +++ b/src/Watchy.h @@ -35,6 +35,8 @@ typedef struct watchySettings { String ntpServer; int gmtOffset; int dstOffset; + // + bool vibrateOClock; } watchySettings; class Watchy {