diff options
author | Florian <fgrauper@gmail.com> | 2021-05-20 20:43:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 20:43:54 +0200 |
commit | 13e3463276114dff838fc8fe281754eecfbe9538 (patch) | |
tree | 55ded8860f26ff7f5f1ffb585d35a252f36f9148 /src/systemtask/SystemTask.cpp | |
parent | 8c3b250dbfe17be61462adc8f84760ce9a648e55 (diff) |
Timer App (#355)
* built timer app
* Style improvements
* making sure buttons stay hidden when the app is reopened and reappear after the timer runs out
* more sensible calculations of time deltas. eliminated that mysterious scaling factor
* changing the timer icon
Diffstat (limited to 'src/systemtask/SystemTask.cpp')
-rw-r--r-- | src/systemtask/SystemTask.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 80f4d5db..58377764 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -56,6 +56,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, heartRateController {*this}, bleController {bleController}, dateTimeController {*this}, + timerController {*this}, watchdog {}, watchdogView {watchdog}, motorController {motorController}, @@ -83,6 +84,8 @@ void SystemTask::Work() { NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason())); APP_GPIOTE_INIT(2); + app_timer_init(); + spi.Init(); spiNorFlash.Init(); spiNorFlash.Wakeup(); @@ -96,6 +99,7 @@ void SystemTask::Work() { batteryController.Init(); motorController.Init(); motionSensor.SoftReset(); + timerController.Init(); // Reset the TWI device because the motion sensor chip most probably crashed it... twiMaster.Sleep(); @@ -116,7 +120,8 @@ void SystemTask::Work() { heartRateController, settingsController, motorController, - motionController); + motionController, + timerController); displayApp->Start(); displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); @@ -233,11 +238,19 @@ void SystemTask::Work() { displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateDateTime); break; case Messages::OnNewNotification: - if (isSleeping && !isWakingUp) + if (isSleeping && !isWakingUp) { GoToRunning(); + } motorController.SetDuration(35); displayApp->PushMessage(Pinetime::Applications::Display::Messages::NewNotification); break; + case Messages::OnTimerDone: + if (isSleeping && !isWakingUp) { + GoToRunning(); + } + motorController.SetDuration(35); + displayApp->PushMessage(Pinetime::Applications::Display::Messages::TimerDone); + break; case Messages::BleConnected: ReloadIdleTimer(); isBleDiscoveryTimerRunning = true; |