summaryrefslogtreecommitdiff
path: root/src/displayapp/DisplayApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
-rw-r--r--src/displayapp/DisplayApp.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 7a73f12..9ce29da 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -49,6 +49,7 @@
#include "displayapp/screens/settings/SettingSetTime.h"
#include "displayapp/screens/settings/SettingChimes.h"
#include "displayapp/screens/settings/SettingShakeThreshold.h"
+#include "displayapp/screens/settings/SettingBluetooth.h"
#include "libs/lv_conf.h"
@@ -97,6 +98,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::MotionController& motionController,
Pinetime::Controllers::TimerController& timerController,
Pinetime::Controllers::AlarmController& alarmController,
+ Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::TouchHandler& touchHandler)
: lcd {lcd},
lvgl {lvgl},
@@ -112,6 +114,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
motionController {motionController},
timerController {timerController},
alarmController {alarmController},
+ brightnessController {brightnessController},
touchHandler {touchHandler} {
}
@@ -204,7 +207,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);
}
@@ -290,6 +293,9 @@ void DisplayApp::Refresh() {
case Messages::BleFirmwareUpdateStarted:
LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);
break;
+ case Messages::BleRadioEnableToggle:
+ PushMessageToSystemTask(System::Messages::BleRadioEnableToggle);
+ break;
case Messages::UpdateDateTime:
// Added to remove warning
// What should happen here?
@@ -300,14 +306,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) {
@@ -367,19 +373,19 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
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, *systemTask);
break;
// Settings
@@ -417,7 +423,7 @@ 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::SettingChimes:
@@ -425,7 +431,11 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SettingShakeThreshold:
- currentScreen = std::make_unique<Screens::SettingShakeThreshold>(this, settingsController,motionController,*systemTask);
+ currentScreen = std::make_unique<Screens::SettingShakeThreshold>(this, settingsController, motionController, *systemTask);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ break;
+ case Apps::SettingBluetooth:
+ currentScreen = std::make_unique<Screens::SettingBluetooth>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::BatteryInfo: