Add accelerometer interrupts and option to update the watch face less frequently

This commit is contained in:
Lewis Jackson 2023-05-30 03:21:16 +03:00
parent 6609a3ab13
commit ca117ea3fc
6 changed files with 112 additions and 14 deletions

View file

@ -17,9 +17,19 @@ void WatchyRTC::config(String datetime) { // String datetime format is YYYY:MM:D
void WatchyRTC::clearAlarm() {
int nextAlarmMinute = 0;
rtc_pcf.clearAlarm(); // resets the alarm flag in the RTC
nextAlarmMinute = rtc_pcf.getMinute();
nextAlarmMinute = (nextAlarmMinute == 59) ? 0 : (nextAlarmMinute + 1); // set alarm to trigger 1 minute from now
rtc_pcf.setAlarm(nextAlarmMinute, 99, 99, 99);
int second = rtc_pcf.getSecond();
int minute = rtc_pcf.getMinute();
int hour = rtc_pcf.getHour();
minute += UPDATE_INTERVAL;
if (minute >= 60) {
hour += minute / 60;
minute = minute % 60;
}
rtc_pcf.setAlarm(minute, hour, 99, 99);
}
void WatchyRTC::read(tmElements_t & tm, int offsetInSeconds)