Add opion to vibrate every hour (and on reset)

Set watchySettings.vibrateOClock to true

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
pull/189/head
Olivier Mehani 2022-10-16 00:34:52 +11:00
parent b0e405e187
commit 5f07f2ec63
No known key found for this signature in database
GPG Key ID: A08FAA9B6A81D925
3 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,7 @@ watchySettings settings{
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
.ntpServer = NTP_SERVER,
.gmtOffset = GMT_OFFSET_SEC,
.vibrateOClock = true,
};
#endif

View File

@ -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();

View File

@ -35,6 +35,8 @@ typedef struct watchySettings {
String ntpServer;
int gmtOffset;
int dstOffset;
//
bool vibrateOClock;
} watchySettings;
class Watchy {