diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-05-10 18:20:34 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-05-10 19:16:02 (GMT) |
| commit | 2f0858fa0561d09d59ab4435c0b4342794738a77 (patch) | |
| tree | 79ede703faa72c0b2ff95a21fb0a6702b4e1a70e | |
| parent | 3744e655fa94cc2efece15c3196cf8b398354ca2 (diff) | |
Fix for stopping timer alert and simplifying code.
| -rw-r--r-- | src/components/timer/TimerController.cpp | 3 | ||||
| -rw-r--r-- | src/displayapp/screens/Timer.cpp | 3 | ||||
| -rw-r--r-- | src/displayapp/screens/Timer.h | 7 |
3 files changed, 4 insertions, 9 deletions
diff --git a/src/components/timer/TimerController.cpp b/src/components/timer/TimerController.cpp index 9456909..5b0d828 100644 --- a/src/components/timer/TimerController.cpp +++ b/src/components/timer/TimerController.cpp @@ -45,6 +45,9 @@ int32_t TimerController::GetSecondsRemaining() { void TimerController::StopTimer() { xTimerStop(timerAppTimer, 0); timerRunning = false; + if (overtime) { + StopAlerting(); + } overtime = false; } diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index 91e6f49..935dbe2 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -60,7 +60,6 @@ void Timer::Stop() { secondsToSet = secondsRemaining % 60; } timerController.StopTimer(); - timerController.StopAlerting(); RefreshRunning(); } @@ -94,7 +93,6 @@ Timer::~Timer() { lv_obj_clean(lv_scr_act()); if (timerController.IsRunning() && timerController.IsOvertime()) { timerController.StopTimer(); - timerController.StopAlerting(); } } @@ -129,4 +127,3 @@ void Timer::RefreshRunning() { CreateButtons(); } } - diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index 9b1431e..cb5aeb2 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -32,12 +32,7 @@ namespace Pinetime::Applications::Screens { if (event == LV_EVENT_CLICKED) { if (obj == btnPlayPause) { if (timerController.IsRunning()) { - uint32_t seconds = timerController.GetSecondsRemaining(); - minutesToSet = seconds / 60; - secondsToSet = seconds % 60; - timerController.StopTimer(); - CreateButtons(); - RefreshRunning(); + Stop(); } else if (secondsToSet + minutesToSet > 0) { timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000); RefreshRunning(); |
