Skip to content

Commit

Permalink
Added more checks in code
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberneel committed Dec 22, 2024
1 parent 7b8339c commit 37351cf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/displayapp/screens/Sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,9 @@ void Sleep::SnoozeWakeAlarm() {
const uint16_t totalAlarmMinutes = infiniSleepController.GetCurrentHour() * 60 + infiniSleepController.GetCurrentMinute();
const uint16_t newSnoozeMinutes = totalAlarmMinutes + SNOOZE_MINUTES;

infiniSleepController.SetPreSnoozeTime();
if (infiniSleepController.isSnoozing != true) {
infiniSleepController.SetPreSnoozeTime();
}
infiniSleepController.isSnoozing = true;

infiniSleepController.SetWakeAlarmTime(newSnoozeMinutes / 60, newSnoozeMinutes % 60);
Expand Down Expand Up @@ -683,6 +685,10 @@ void Sleep::SetAlerting() {
lv_obj_set_hidden(iconSuggestedAlarm, true);
NRF_LOG_INFO("Alarm is alerting");
if (!infiniSleepController.infiniSleepSettings.naturalWake) {
if (taskSnoozeWakeAlarm != nullptr) {
lv_task_del(taskSnoozeWakeAlarm);
taskSnoozeWakeAlarm = nullptr;
}
taskSnoozeWakeAlarm = lv_task_create(SnoozeAlarmTaskCallback, 120 * 1000, LV_TASK_PRIO_MID, this);
}
if (infiniSleepController.infiniSleepSettings.naturalWake) {
Expand Down

0 comments on commit 37351cf

Please sign in to comment.