mirror of https://github.com/sqfmi/Watchy.git
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
parent
b0e405e187
commit
5f07f2ec63
|
@ -21,6 +21,7 @@ watchySettings settings{
|
||||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
.ntpServer = NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
.gmtOffset = GMT_OFFSET_SEC,
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -12,6 +12,7 @@ RTC_DATA_ATTR bool BLE_CONFIGURED;
|
||||||
RTC_DATA_ATTR weatherData currentWeather;
|
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 bool alreadyVibrated = false;
|
||||||
|
|
||||||
void Watchy::init(String datetime) {
|
void Watchy::init(String datetime) {
|
||||||
esp_sleep_wakeup_cause_t wakeup_reason;
|
esp_sleep_wakeup_cause_t wakeup_reason;
|
||||||
|
@ -30,6 +31,15 @@ void Watchy::init(String datetime) {
|
||||||
if (guiState == WATCHFACE_STATE) {
|
if (guiState == WATCHFACE_STATE) {
|
||||||
RTC.read(currentTime);
|
RTC.read(currentTime);
|
||||||
showWatchFace(true); // partial updates on tick
|
showWatchFace(true); // partial updates on tick
|
||||||
|
if (settings.vibrateOClock) {
|
||||||
|
if (currentTime.Minute == 0
|
||||||
|
&& !alreadyVibrated) {
|
||||||
|
vibMotor(75, 4);
|
||||||
|
alreadyVibrated = true;
|
||||||
|
} else {
|
||||||
|
alreadyVibrated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ESP_SLEEP_WAKEUP_EXT1: // button Press
|
case ESP_SLEEP_WAKEUP_EXT1: // button Press
|
||||||
|
@ -40,6 +50,7 @@ void Watchy::init(String datetime) {
|
||||||
_bmaConfig();
|
_bmaConfig();
|
||||||
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();
|
||||||
|
|
|
@ -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