Don't act like an alarm has been set if there has been a failure
This commit is contained in:
+9
-7
@@ -127,10 +127,6 @@ static void setter_down_click_handler(void *recognizer, void *ctx) {
|
||||
|
||||
static void setter_select_click_handler(void *recognizer, void *ctx) {
|
||||
if (s_highlight_pos == 2) {
|
||||
// copy WIP time to set time
|
||||
s_setter_time.HourSet = s_setter_time.HourWIP;
|
||||
s_setter_time.MinuteSet = s_setter_time.MinuteWIP;
|
||||
|
||||
// schedule wakeup
|
||||
time_t now = time(NULL);
|
||||
struct tm now_tm = *localtime(&now);
|
||||
@@ -143,13 +139,19 @@ static void setter_select_click_handler(void *recognizer, void *ctx) {
|
||||
target += SECONDS_PER_DAY;
|
||||
}
|
||||
wakeup_cancel_all();
|
||||
wakeup_schedule(target, 0, true);
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
WakeupId status;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
status = wakeup_schedule(target, 0, true);
|
||||
if (status < 0) {
|
||||
APP_LOG(APP_LOG_LEVEL_DEBUG, "SCHEDULING ERROR: %d", status);
|
||||
return;
|
||||
}
|
||||
target += SECONDS_PER_DAY;
|
||||
wakeup_schedule(target, 0, true);
|
||||
}
|
||||
|
||||
// persist
|
||||
s_setter_time.HourSet = s_setter_time.HourWIP;
|
||||
s_setter_time.MinuteSet = s_setter_time.MinuteWIP;
|
||||
persist_write_int(STORAGE_KEY_ALARM_HOUR, s_setter_time.HourSet);
|
||||
persist_write_int(STORAGE_KEY_ALARM_MINUTE, s_setter_time.MinuteSet);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user