diff options
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
-rw-r--r-- | src/displayapp/DisplayApp.cpp | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 13ee0045..672bcb34 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -1,9 +1,9 @@ -#include "DisplayApp.h" +#include "displayapp/DisplayApp.h" #include <libraries/log/nrf_log.h> -#include <displayapp/screens/HeartRate.h> -#include <displayapp/screens/Motion.h> -#include <displayapp/screens/Timer.h> -#include <displayapp/screens/Alarm.h> +#include "displayapp/screens/HeartRate.h" +#include "displayapp/screens/Motion.h" +#include "displayapp/screens/Timer.h" +#include "displayapp/screens/Alarm.h" #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" #include "components/datetime/DateTimeController.h" @@ -29,6 +29,7 @@ #include "displayapp/screens/FlashLight.h" #include "displayapp/screens/BatteryInfo.h" #include "displayapp/screens/Steps.h" +#include "displayapp/screens/PassKey.h" #include "displayapp/screens/Error.h" #include "drivers/Cst816s.h" @@ -44,9 +45,10 @@ #include "displayapp/screens/settings/SettingWakeUp.h" #include "displayapp/screens/settings/SettingDisplay.h" #include "displayapp/screens/settings/SettingSteps.h" -#include "displayapp/screens/settings/SettingPineTimeStyle.h" #include "displayapp/screens/settings/SettingSetDate.h" #include "displayapp/screens/settings/SettingSetTime.h" +#include "displayapp/screens/settings/SettingChimes.h" +#include "displayapp/screens/settings/SettingShakeThreshold.h" #include "libs/lv_conf.h" @@ -214,6 +216,10 @@ void DisplayApp::Refresh() { } else { LoadApp(Apps::Alarm, DisplayApp::FullRefreshDirections::None); } + break; + case Messages::ShowPairingKey: + LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up); + break; case Messages::TouchEvent: { if (state != States::Running) { break; @@ -250,10 +256,10 @@ void DisplayApp::Refresh() { } } break; case Messages::ButtonPushed: - if (currentApp == Apps::Clock) { - PushMessageToSystemTask(System::Messages::GoToSleep); - } else { - if (!currentScreen->OnButtonPushed()) { + if (!currentScreen->OnButtonPushed()) { + if (currentApp == Apps::Clock) { + PushMessageToSystemTask(System::Messages::GoToSleep); + } else { LoadApp(returnToApp, returnDirection); brightnessController.Set(settingsController.GetBrightness()); brightnessController.Backup(); @@ -262,7 +268,13 @@ void DisplayApp::Refresh() { break; case Messages::ButtonLongPressed: if (currentApp != Apps::Clock) { - LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Down); + if (currentApp == Apps::Notifications) { + LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Up); + } else if (currentApp == Apps::QuickSettings) { + LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim); + } else { + LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Down); + } } break; case Messages::ButtonLongerPressed: @@ -282,6 +294,9 @@ void DisplayApp::Refresh() { // Added to remove warning // What should happen here? break; + case Messages::Clock: + LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None); + break; } } @@ -345,21 +360,26 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); break; + case Apps::PassKey: + currentScreen = std::make_unique<Screens::PassKey>(this, bleController.GetPairingKey()); + ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); + break; + case Apps::Notifications: currentScreen = std::make_unique<Screens::Notifications>( - this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Normal); + this, notificationManager, systemTask->nimble().alertService(), motorController, *systemTask, Screens::Notifications::Modes::Normal); ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; case Apps::NotificationsPreview: currentScreen = std::make_unique<Screens::Notifications>( - this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Preview); + this, notificationManager, systemTask->nimble().alertService(), motorController, *systemTask, Screens::Notifications::Modes::Preview); ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; case Apps::Timer: currentScreen = std::make_unique<Screens::Timer>(this, timerController); break; case Apps::Alarm: - currentScreen = std::make_unique<Screens::Alarm>(this, alarmController); + currentScreen = std::make_unique<Screens::Alarm>(this, alarmController, settingsController); break; // Settings @@ -397,11 +417,15 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingSetTime: - currentScreen = std::make_unique<Screens::SettingSetTime>(this, dateTimeController); + currentScreen = std::make_unique<Screens::SettingSetTime>(this, dateTimeController, settingsController); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; - case Apps::SettingPineTimeStyle: - currentScreen = std::make_unique<Screens::SettingPineTimeStyle>(this, settingsController); + case Apps::SettingChimes: + currentScreen = std::make_unique<Screens::SettingChimes>(this, settingsController); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + break; + case Apps::SettingShakeThreshold: + currentScreen = std::make_unique<Screens::SettingShakeThreshold>(this, settingsController, motionController, *systemTask); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::BatteryInfo: @@ -424,7 +448,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) currentScreen = std::make_unique<Screens::Twos>(this); break; case Apps::Paint: - currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl); + currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl, motorController); break; case Apps::Paddle: currentScreen = std::make_unique<Screens::Paddle>(this, lvgl); @@ -491,8 +515,9 @@ void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) { } void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) { - if (systemTask != nullptr) + if (systemTask != nullptr) { systemTask->PushMessage(message); + } } void DisplayApp::Register(Pinetime::System::SystemTask* systemTask) { |