Skip to content

Commit

Permalink
Undid some edits that were for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberneel committed Nov 24, 2024
1 parent 1a6f3cd commit 17b5160
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/infinisleep/InfiniSleepController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ void InfiniSleepController::SetOffGradualWakeNow() {
// isGradualWakeAlerting = true;

systemTask->PushMessage(System::Messages::SetOffGradualWake);
}

void InfiniSleepController::UpdateGradualWake() {
// make sure graudal wake steps are possible
while (gradualWakeStep > 0 && SecondsToWakeAlarm() <= gradualWakeSteps[gradualWakeStep - 1]) {
gradualWakeStep--;
Expand Down
3 changes: 2 additions & 1 deletion src/components/infinisleep/InfiniSleepController.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace Pinetime {
void EnableWakeAlarm();
void SetOffWakeAlarmNow();
void SetOffGradualWakeNow();
void UpdateGradualWake();
uint32_t SecondsToWakeAlarm() const;
void StopAlerting();
// enum class RecurType { None, Daily, Weekdays };
Expand Down Expand Up @@ -164,7 +165,7 @@ namespace Pinetime {

uint16_t GetSleepCycles() {
uint16_t totalMinutes = GetTotalSleep();
return (totalMinutes * 100 / SLEEP_CYCLE_DURATION);
return (totalMinutes * 100 / infiniSleepSettings.sleepCycleDuration);
}

uint16_t GetTotalSleep() const {
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ void DisplayApp::Refresh() {
}
motorController.RunForDuration(infiniSleepController.gradualWakeVibrationDurations[-1 + infiniSleepController.gradualWakeStep]);

infiniSleepController.UpdateGradualWake();

NRF_LOG_INFO("Gradual wake triggered");

break;
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/Sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ void Sleep::UpdateWakeAlarmTime() {
void Sleep::SetAlerting() {
lv_obj_set_hidden(enableSwitch, true);
lv_obj_set_hidden(btnStop, false);
taskSnoozeWakeAlarm = lv_task_create(SnoozeAlarmTaskCallback, pdMS_TO_TICKS(5 * 1000), LV_TASK_PRIO_MID, this);
taskSnoozeWakeAlarm = lv_task_create(SnoozeAlarmTaskCallback, pdMS_TO_TICKS(120 * 1000), LV_TASK_PRIO_MID, this);
motorController.StartAlarm();
wakeLock.Lock();
}
Expand Down

0 comments on commit 17b5160

Please sign in to comment.