Use wakeup handler to reschedule fallback alarm

This commit is contained in:
2026-08-10 20:59:02 -04:00
parent 95aafa98b9
commit 5911295363
2 changed files with 10 additions and 7 deletions
+2 -2
View File
@@ -18,8 +18,8 @@ WakeupId wakeup_schedule_simple_robust(time_t wakeup_time, int8_t retry_diff, bo
if (result == E_RANGE) {
// E_RANGE means some other app has the same wakeup time +/- 1 minute, so try to set
// the wakeup for a time up to (retry_diff * 5) minutes before/after.
while (result == E_RANGE && try_count++ < 5) {
// the wakeup for a time up to (retry_diff * 8) minutes before/after.
while (result == E_RANGE && try_count++ < 8) {
wakeup_time += retry_diff;
result = wakeup_schedule(wakeup_time, is_fallback, true);
}
+8 -5
View File
@@ -157,11 +157,6 @@ static void add_bar_layers_to_window(Layer *window_layer, bool small_top) {
////////////////////// ALARM //////////////////////
static void alarm_seconds_handler(struct tm *tick_time, TimeUnits units_changed) {
// re-schedule fallback alarm every 15 seconds
if (tick_time->tm_sec % 15 == 0) {
schedule_alarm(true); // output is not captured, as it is not actionable
}
// update stopwatch
if (s_stopwatch_time[1] == 59) {
s_stopwatch_time[1] = 0;
@@ -259,7 +254,15 @@ static void drop_menu_window_unload(Window *window) {
s_drop_menu_layer = NULL;
}
static void live_wakeup_handler_for_alarm(WakeupId id, int32_t reason) {
if (reason == 1) { // if fallback alarm, re-schedule it
schedule_alarm(true); // output is not captured, as it is not actionable
}
}
static void alarm_window_load() {
wakeup_service_subscribe(live_wakeup_handler_for_alarm);
Layer *window_layer = window_get_root_layer(s_window);
// change highlight color to avoid changing color of bottom bar