From 5f07f2ec63d5b21fb1877f1c069b55509083c1f1 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Sun, 16 Oct 2022 00:34:52 +1100 Subject: [PATCH] Add opion to vibrate every hour (and on reset) Set watchySettings.vibrateOClock to true Signed-off-by: Olivier Mehani --- examples/WatchFaces/7_SEG/settings.h | 1 + src/Watchy.cpp | 11 +++++++++++ src/Watchy.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/examples/WatchFaces/7_SEG/settings.h b/examples/WatchFaces/7_SEG/settings.h index 53d47e3..e4f2669 100644 --- a/examples/WatchFaces/7_SEG/settings.h +++ b/examples/WatchFaces/7_SEG/settings.h @@ -21,6 +21,7 @@ watchySettings settings{ .weatherUpdateInterval = WEATHER_UPDATE_INTERVAL, .ntpServer = NTP_SERVER, .gmtOffset = GMT_OFFSET_SEC, + .vibrateOClock = true, }; #endif \ No newline at end of file diff --git a/src/Watchy.cpp b/src/Watchy.cpp index b95a036..e26479a 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 bool alreadyVibrated = false; void Watchy::init(String datetime) { esp_sleep_wakeup_cause_t wakeup_reason; @@ -30,6 +31,15 @@ void Watchy::init(String datetime) { if (guiState == WATCHFACE_STATE) { RTC.read(currentTime); showWatchFace(true); // partial updates on tick + if (settings.vibrateOClock) { + if (currentTime.Minute == 0 + && !alreadyVibrated) { + vibMotor(75, 4); + alreadyVibrated = true; + } else { + alreadyVibrated = false; + } + } } break; case ESP_SLEEP_WAKEUP_EXT1: // button Press @@ -40,6 +50,7 @@ void Watchy::init(String datetime) { _bmaConfig(); RTC.read(currentTime); showWatchFace(false); // full update on reset + vibMotor(75, 4); break; } deepSleep(); 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 {