diff options
| author | Florian <fgrauper@gmail.com> | 2021-05-20 18:43:54 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-20 18:43:54 (GMT) |
| commit | 13e3463276114dff838fc8fe281754eecfbe9538 (patch) | |
| tree | 55ded8860f26ff7f5f1ffb585d35a252f36f9148 /src/displayapp/DisplayApp.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/displayapp/DisplayApp.cpp')
| -rw-r--r-- | src/displayapp/DisplayApp.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index a6c4a3e..419b9f6 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -2,6 +2,7 @@ #include <libraries/log/nrf_log.h> #include <displayapp/screens/HeartRate.h> #include <displayapp/screens/Motion.h> +#include <displayapp/screens/Timer.h> #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" #include "components/datetime/DateTimeController.h" @@ -55,7 +56,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::HeartRateController& heartRateController, Controllers::Settings& settingsController, Pinetime::Controllers::MotorController& motorController, - Pinetime::Controllers::MotionController& motionController) + Pinetime::Controllers::MotionController& motionController, + Pinetime::Controllers::TimerController& timerController) : lcd {lcd}, lvgl {lvgl}, touchPanel {touchPanel}, @@ -68,7 +70,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, heartRateController {heartRateController}, settingsController {settingsController}, motorController {motorController}, - motionController {motionController} { + motionController {motionController}, + timerController {timerController} { msgQueue = xQueueCreate(queueSize, itemSize); // Start clock when smartwatch boots LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None); @@ -148,6 +151,14 @@ void DisplayApp::Refresh() { case Messages::NewNotification: LoadApp(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down); break; + case Messages::TimerDone: + if (currentApp == Apps::Timer) { + auto *timer = dynamic_cast<Screens::Timer*>(currentScreen.get()); + timer->setDone(); + } else { + LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down); + } + break; case Messages::TouchEvent: { if (state != States::Running) break; @@ -264,6 +275,9 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview); ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; + case Apps::Timer: + currentScreen = std::make_unique<Screens::Timer>(this, timerController); + break; // Settings case Apps::QuickSettings: |
