diff options
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
| -rw-r--r-- | src/displayapp/DisplayApp.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 3e25ec83..cc1f6b6c 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -7,6 +7,7 @@ #include "components/datetime/DateTimeController.h" #include "components/ble/NotificationManager.h" #include "components/motion/MotionController.h" +#include "components/motor/MotorController.h" #include "displayapp/screens/ApplicationList.h" #include "displayapp/screens/Brightness.h" #include "displayapp/screens/Clock.h" @@ -53,6 +54,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Controllers::Settings& settingsController, + Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotionController& motionController) : lcd {lcd}, lvgl {lvgl}, @@ -65,6 +67,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, notificationManager {notificationManager}, heartRateController {heartRateController}, settingsController {settingsController}, + motorController {motorController}, motionController {motionController} { msgQueue = xQueueCreate(queueSize, itemSize); // Start clock when smartwatch boots @@ -72,8 +75,9 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, } void DisplayApp::Start() { - if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) + if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); + } } void DisplayApp::Process(void* instance) { @@ -84,7 +88,7 @@ void DisplayApp::Process(void* instance) { // Send a dummy notification to unlock the lvgl display driver for the first iteration xTaskNotifyGive(xTaskGetCurrentTaskHandle()); - while (1) { + while (true) { app->Refresh(); } } @@ -212,7 +216,7 @@ void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) LoadApp(app, direction); } -void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { +void DisplayApp::ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { returnToApp = app; returnDirection = direction; returnTouchEvent = touchEvent; @@ -223,12 +227,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) SetFullRefresh(direction); // default return to launcher - returnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); switch (app) { case Apps::Launcher: currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, dateTimeController); - returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::None: case Apps::Clock: @@ -244,7 +248,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::FirmwareValidation: currentScreen = std::make_unique<Screens::FirmwareValidation>(this, validator); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::FirmwareUpdate: currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController); @@ -253,39 +257,39 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::Notifications: currentScreen = std::make_unique<Screens::Notifications>( this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); - returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; case Apps::NotificationsPreview: currentScreen = std::make_unique<Screens::Notifications>( this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview); - returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; // Settings case Apps::QuickSettings: - currentScreen = - std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, settingsController); - returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); + currentScreen = std::make_unique<Screens::QuickSettings>( + this, batteryController, dateTimeController, brightnessController, motorController, settingsController); + ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); break; case Apps::Settings: currentScreen = std::make_unique<Screens::Settings>(this, settingsController); - returnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingWatchFace: currentScreen = std::make_unique<Screens::SettingWatchFace>(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingTimeFormat: currentScreen = std::make_unique<Screens::SettingTimeFormat>(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingWakeUp: currentScreen = std::make_unique<Screens::SettingWakeUp>(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingDisplay: currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingSteps: currentScreen = std::make_unique<Screens::SettingSteps>(this, settingsController); @@ -293,18 +297,18 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) break; case Apps::BatteryInfo: currentScreen = std::make_unique<Screens::BatteryInfo>(this, batteryController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SysInfo: currentScreen = std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; // case Apps::FlashLight: currentScreen = std::make_unique<Screens::FlashLight>(this, systemTask, brightnessController); - returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); + ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); break; case Apps::StopWatch: currentScreen = std::make_unique<Screens::StopWatch>(this); @@ -355,8 +359,9 @@ TouchEvents DisplayApp::OnTouchEvent() { if (info.isTouch) { switch (info.gesture) { case Pinetime::Drivers::Cst816S::Gestures::SingleTap: - if (touchMode == TouchModes::Gestures) + if (touchMode == TouchModes::Gestures) { lvgl.SetNewTapEvent(info.x, info.y); + } return TouchEvents::Tap; case Pinetime::Drivers::Cst816S::Gestures::LongPress: return TouchEvents::LongTap; |
