diff options
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
-rw-r--r-- | src/displayapp/DisplayApp.cpp | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index fdc6376c..32280615 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -49,7 +49,7 @@ #include "displayapp/screens/settings/SettingSetTime.h" #include "displayapp/screens/settings/SettingChimes.h" #include "displayapp/screens/settings/SettingShakeThreshold.h" -#include "displayapp/screens/settings/SettingAirplaneMode.h" +#include "displayapp/screens/settings/SettingBluetooth.h" #include "libs/lv_conf.h" @@ -60,28 +60,6 @@ namespace { static inline bool in_isr(void) { return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0; } - - TouchEvents ConvertGesture(Pinetime::Drivers::Cst816S::Gestures gesture) { - switch (gesture) { - case Pinetime::Drivers::Cst816S::Gestures::SingleTap: - return TouchEvents::Tap; - case Pinetime::Drivers::Cst816S::Gestures::LongPress: - return TouchEvents::LongTap; - case Pinetime::Drivers::Cst816S::Gestures::DoubleTap: - return TouchEvents::DoubleTap; - case Pinetime::Drivers::Cst816S::Gestures::SlideRight: - return TouchEvents::SwipeRight; - case Pinetime::Drivers::Cst816S::Gestures::SlideLeft: - return TouchEvents::SwipeLeft; - case Pinetime::Drivers::Cst816S::Gestures::SlideDown: - return TouchEvents::SwipeDown; - case Pinetime::Drivers::Cst816S::Gestures::SlideUp: - return TouchEvents::SwipeUp; - case Pinetime::Drivers::Cst816S::Gestures::None: - default: - return TouchEvents::None; - } - } } DisplayApp::DisplayApp(Drivers::St7789& lcd, @@ -207,7 +185,7 @@ void DisplayApp::Refresh() { case Messages::TimerDone: if (currentApp == Apps::Timer) { auto* timer = static_cast<Screens::Timer*>(currentScreen.get()); - timer->setDone(); + timer->SetDone(); } else { LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down); } @@ -227,7 +205,7 @@ void DisplayApp::Refresh() { if (state != States::Running) { break; } - auto gesture = ConvertGesture(touchHandler.GestureGet()); + auto gesture = touchHandler.GestureGet(); if (gesture == TouchEvents::None) { break; } @@ -306,14 +284,14 @@ void DisplayApp::Refresh() { } } + if (touchHandler.IsTouching()) { + currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY()); + } + if (nextApp != Apps::None) { LoadApp(nextApp, nextDirection); nextApp = Apps::None; } - - if (touchHandler.IsTouching()) { - currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY()); - } } void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) { @@ -434,8 +412,8 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) currentScreen = std::make_unique<Screens::SettingShakeThreshold>(this, settingsController, motionController, *systemTask); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; - case Apps::SettingAirplaneMode: - currentScreen = std::make_unique<Screens::SettingAirplaneMode>(this, settingsController); + case Apps::SettingBluetooth: + currentScreen = std::make_unique<Screens::SettingBluetooth>(this, settingsController); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::BatteryInfo: |