summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/Apps.h27
-rw-r--r--src/displayapp/DisplayApp.cpp143
-rw-r--r--src/displayapp/DisplayApp.h135
-rw-r--r--src/displayapp/DisplayAppRecovery.cpp36
-rw-r--r--src/displayapp/DisplayAppRecovery.h18
-rw-r--r--src/displayapp/DummyLittleVgl.h31
-rw-r--r--src/displayapp/LittleVgl.cpp69
-rw-r--r--src/displayapp/LittleVgl.h87
-rw-r--r--src/displayapp/Messages.h12
-rw-r--r--src/displayapp/TouchEvents.h2
-rw-r--r--src/displayapp/fonts/README.md44
-rw-r--r--src/displayapp/fonts/Readme.md41
-rw-r--r--src/displayapp/lv_pinetime_theme.c887
-rw-r--r--src/displayapp/lv_pinetime_theme.h26
-rw-r--r--src/displayapp/screens/ApplicationList.cpp78
-rw-r--r--src/displayapp/screens/ApplicationList.h32
-rw-r--r--src/displayapp/screens/BatteryIcon.cpp19
-rw-r--r--src/displayapp/screens/BatteryIcon.h4
-rw-r--r--src/displayapp/screens/BatteryInfo.cpp93
-rw-r--r--src/displayapp/screens/BatteryInfo.h41
-rw-r--r--src/displayapp/screens/BleIcon.cpp6
-rw-r--r--src/displayapp/screens/Brightness.cpp61
-rw-r--r--src/displayapp/screens/Brightness.h32
-rw-r--r--src/displayapp/screens/Clock.cpp89
-rw-r--r--src/displayapp/screens/Clock.h67
-rw-r--r--src/displayapp/screens/DropDownDemo.cpp34
-rw-r--r--src/displayapp/screens/DropDownDemo.h20
-rw-r--r--src/displayapp/screens/FirmwareUpdate.cpp17
-rw-r--r--src/displayapp/screens/FirmwareUpdate.h35
-rw-r--r--src/displayapp/screens/FirmwareValidation.cpp34
-rw-r--r--src/displayapp/screens/FirmwareValidation.h42
-rw-r--r--src/displayapp/screens/FlashLight.cpp39
-rw-r--r--src/displayapp/screens/FlashLight.h30
-rw-r--r--src/displayapp/screens/HeartRate.cpp33
-rw-r--r--src/displayapp/screens/HeartRate.h9
-rw-r--r--src/displayapp/screens/InfiniPaint.cpp11
-rw-r--r--src/displayapp/screens/InfiniPaint.h1
-rw-r--r--src/displayapp/screens/Label.cpp14
-rw-r--r--src/displayapp/screens/Label.h27
-rw-r--r--src/displayapp/screens/List.cpp48
-rw-r--r--src/displayapp/screens/List.h58
-rw-r--r--src/displayapp/screens/Meter.cpp20
-rw-r--r--src/displayapp/screens/Meter.h20
-rw-r--r--src/displayapp/screens/Motion.cpp10
-rw-r--r--src/displayapp/screens/Motion.h13
-rw-r--r--src/displayapp/screens/Music.cpp80
-rw-r--r--src/displayapp/screens/Music.h57
-rw-r--r--src/displayapp/screens/Navigation.cpp20
-rw-r--r--src/displayapp/screens/Navigation.h196
-rw-r--r--src/displayapp/screens/NotificationIcon.cpp6
-rw-r--r--src/displayapp/screens/Notifications.cpp114
-rw-r--r--src/displayapp/screens/Notifications.h61
-rw-r--r--src/displayapp/screens/Paddle.cpp237
-rw-r--r--src/displayapp/screens/Paddle.h64
-rw-r--r--src/displayapp/screens/Screen.h98
-rw-r--r--src/displayapp/screens/ScreenList.h160
-rw-r--r--src/displayapp/screens/StopWatch.cpp24
-rw-r--r--src/displayapp/screens/Symbols.h17
-rw-r--r--src/displayapp/screens/SystemInfo.cpp218
-rw-r--r--src/displayapp/screens/SystemInfo.h54
-rw-r--r--src/displayapp/screens/Tile.cpp64
-rw-r--r--src/displayapp/screens/Tile.h72
-rw-r--r--src/displayapp/screens/Twos.cpp137
-rw-r--r--src/displayapp/screens/Twos.h42
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.cpp111
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.h103
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp111
-rw-r--r--src/displayapp/screens/WatchFaceDigital.h97
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp86
-rw-r--r--src/displayapp/screens/settings/QuickSettings.h55
-rw-r--r--src/displayapp/screens/settings/SettingDisplay.cpp62
-rw-r--r--src/displayapp/screens/settings/SettingDisplay.h22
-rw-r--r--src/displayapp/screens/settings/SettingTimeFormat.cpp48
-rw-r--r--src/displayapp/screens/settings/SettingTimeFormat.h22
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.cpp64
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.h22
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp38
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.h22
-rw-r--r--src/displayapp/screens/settings/Settings.cpp57
-rw-r--r--src/displayapp/screens/settings/Settings.h29
80 files changed, 2643 insertions, 2622 deletions
diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h
index 358ea1f7..936a3ae8 100644
--- a/src/displayapp/Apps.h
+++ b/src/displayapp/Apps.h
@@ -3,9 +3,30 @@
namespace Pinetime {
namespace Applications {
enum class Apps {
- None, Launcher, Clock, SysInfo, FirmwareUpdate, FirmwareValidation, NotificationsPreview, Notifications, FlashLight, BatteryInfo,
- Music, Paint, Paddle, Twos, HeartRate, Navigation, StopWatch, Motion,
- QuickSettings, Settings, SettingWatchFace, SettingTimeFormat, SettingDisplay, SettingWakeUp
+ None,
+ Launcher,
+ Clock,
+ SysInfo,
+ FirmwareUpdate,
+ FirmwareValidation,
+ NotificationsPreview,
+ Notifications,
+ FlashLight,
+ BatteryInfo,
+ Music,
+ Paint,
+ Paddle,
+ Twos,
+ HeartRate,
+ Navigation,
+ StopWatch,
+ Motion,
+ QuickSettings,
+ Settings,
+ SettingWatchFace,
+ SettingTimeFormat,
+ SettingDisplay,
+ SettingWakeUp
};
}
}
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 36f93a91..68f2d971 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -40,29 +40,33 @@
using namespace Pinetime::Applications;
using namespace Pinetime::Applications::Display;
-DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &touchPanel,
- Controllers::Battery &batteryController, Controllers::Ble &bleController,
- Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
- System::SystemTask &systemTask,
+DisplayApp::DisplayApp(Drivers::St7789& lcd,
+ Components::LittleVgl& lvgl,
+ Drivers::Cst816S& touchPanel,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::DateTime& dateTimeController,
+ Drivers::WatchdogView& watchdog,
+ System::SystemTask& systemTask,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::HeartRateController& heartRateController,
- Controllers::Settings &settingsController,
- Pinetime::Controllers::MotionController& motionController) :
- lcd{lcd},
- lvgl{lvgl},
- touchPanel{touchPanel},
- batteryController{batteryController},
- bleController{bleController},
- dateTimeController{dateTimeController},
- watchdog{watchdog},
- systemTask{systemTask},
- notificationManager{notificationManager},
- heartRateController{heartRateController},
- settingsController{settingsController},
- motionController{motionController} {
+ Controllers::Settings& settingsController,
+ Pinetime::Controllers::MotionController& motionController)
+ : lcd {lcd},
+ lvgl {lvgl},
+ touchPanel {touchPanel},
+ batteryController {batteryController},
+ bleController {bleController},
+ dateTimeController {dateTimeController},
+ watchdog {watchdog},
+ systemTask {systemTask},
+ notificationManager {notificationManager},
+ heartRateController {heartRateController},
+ settingsController {settingsController},
+ motionController {motionController} {
msgQueue = xQueueCreate(queueSize, itemSize);
// Start clock when smartwatch boots
- LoadApp( Apps::Clock, DisplayApp::FullRefreshDirections::None );
+ LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None);
}
void DisplayApp::Start() {
@@ -70,8 +74,8 @@ void DisplayApp::Start() {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
-void DisplayApp::Process(void *instance) {
- auto *app = static_cast<DisplayApp *>(instance);
+void DisplayApp::Process(void* instance) {
+ auto* app = static_cast<DisplayApp*>(instance);
NRF_LOG_INFO("displayapp task started!");
app->InitHw();
@@ -112,7 +116,7 @@ void DisplayApp::Refresh() {
switch (msg) {
case Messages::GoToSleep:
brightnessController.Backup();
- while(brightnessController.Level() != Controllers::BrightnessController::Levels::Off) {
+ while (brightnessController.Level() != Controllers::BrightnessController::Levels::Off) {
brightnessController.Lower();
vTaskDelay(100);
}
@@ -127,30 +131,32 @@ void DisplayApp::Refresh() {
break;
case Messages::UpdateTimeOut:
systemTask.PushMessage(System::SystemTask::Messages::UpdateTimeOut);
- break;
+ break;
case Messages::UpdateBleConnection:
-// clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected : Screens::Clock::BleConnectionStates::NotConnected);
+ // clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected :
+ // Screens::Clock::BleConnectionStates::NotConnected);
break;
case Messages::UpdateBatteryLevel:
batteryController.Update();
break;
case Messages::NewNotification:
- LoadApp( Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down );
+ LoadApp(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down);
break;
case Messages::TouchEvent: {
- if (state != States::Running) break;
+ if (state != States::Running)
+ break;
auto gesture = OnTouchEvent();
- if(!currentScreen->OnTouchEvent(gesture)) {
- if ( currentApp == Apps::Clock ) {
+ if (!currentScreen->OnTouchEvent(gesture)) {
+ if (currentApp == Apps::Clock) {
switch (gesture) {
case TouchEvents::SwipeUp:
- LoadApp( Apps::Launcher, DisplayApp::FullRefreshDirections::Up );
+ LoadApp(Apps::Launcher, DisplayApp::FullRefreshDirections::Up);
break;
case TouchEvents::SwipeDown:
- LoadApp( Apps::Notifications, DisplayApp::FullRefreshDirections::Down );
+ LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
break;
case TouchEvents::SwipeRight:
- LoadApp( Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim );
+ LoadApp(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim);
break;
case TouchEvents::DoubleTap:
systemTask.PushMessage(System::SystemTask::Messages::GoToSleep);
@@ -158,36 +164,35 @@ void DisplayApp::Refresh() {
default:
break;
}
- } else if ( returnTouchEvent == gesture ) {
- LoadApp( returnToApp, returnDirection );
+ } else if (returnTouchEvent == gesture) {
+ LoadApp(returnToApp, returnDirection);
}
}
- }
- break;
+ } break;
case Messages::ButtonPushed:
- if( currentApp == Apps::Clock ) {
+ if (currentApp == Apps::Clock) {
systemTask.PushMessage(System::SystemTask::Messages::GoToSleep);
} else {
- if ( !currentScreen->OnButtonPushed() ) {
- LoadApp( returnToApp, returnDirection );
+ if (!currentScreen->OnButtonPushed()) {
+ LoadApp(returnToApp, returnDirection);
}
}
break;
case Messages::BleFirmwareUpdateStarted:
- LoadApp( Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down );
+ LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);
+ break;
+ case Messages::UpdateDateTime:
+ // Added to remove warning
+ // What should happen here?
break;
- case Messages::UpdateDateTime:
- // Added to remove warning
- // What should happen here?
- break;
}
}
- if(state != States::Idle && touchMode == TouchModes::Polling) {
+ if (state != States::Idle && touchMode == TouchModes::Polling) {
auto info = touchPanel.GetTouchInfo();
- if(info.action == 2) {// 2 = contact
- if(!currentScreen->OnTouchEvent(info.x, info.y)) {
+ if (info.action == 2) { // 2 = contact
+ if (!currentScreen->OnTouchEvent(info.x, info.y)) {
lvgl.SetNewTapEvent(info.x, info.y);
}
}
@@ -195,14 +200,14 @@ void DisplayApp::Refresh() {
}
void DisplayApp::RunningState() {
- if(!currentScreen->Refresh()) {
- LoadApp( returnToApp, returnDirection );
+ if (!currentScreen->Refresh()) {
+ LoadApp(returnToApp, returnDirection);
}
lv_task_handler();
}
void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) {
- LoadApp( app, direction );
+ LoadApp(app, direction);
}
void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) {
@@ -213,19 +218,26 @@ void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction
void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) {
currentScreen.reset(nullptr);
- SetFullRefresh( direction );
+ SetFullRefresh(direction);
// default return to launcher
returnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown);
- switch(app) {
+ switch (app) {
case Apps::Launcher:
currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, dateTimeController);
returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::None:
case Apps::Clock:
- currentScreen = std::make_unique<Screens::Clock>(this, dateTimeController, batteryController, bleController, notificationManager, settingsController, heartRateController, motionController);
+ currentScreen = std::make_unique<Screens::Clock>(this,
+ dateTimeController,
+ batteryController,
+ bleController,
+ notificationManager,
+ settingsController,
+ heartRateController,
+ motionController);
break;
case Apps::FirmwareValidation:
@@ -237,17 +249,20 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
break;
case Apps::Notifications:
- currentScreen = std::make_unique<Screens::Notifications>(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal);
+ currentScreen = std::make_unique<Screens::Notifications>(
+ this, notificationManager, systemTask.nimble().alertService(), 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(), Screens::Notifications::Modes::Preview);
+ currentScreen = std::make_unique<Screens::Notifications>(
+ this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview);
returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
break;
// Settings
case Apps::QuickSettings:
- currentScreen = std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, settingsController);
+ currentScreen =
+ std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, settingsController);
returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
break;
case Apps::Settings:
@@ -275,10 +290,11 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SysInfo:
- currentScreen = std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog);
+ currentScreen =
+ std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog);
returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
- //
+ //
case Apps::FlashLight:
currentScreen = std::make_unique<Screens::FlashLight>(this, systemTask, brightnessController);
@@ -313,7 +329,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
}
void DisplayApp::IdleState() {
-
}
void DisplayApp::PushMessage(Messages msg) {
@@ -328,10 +343,10 @@ void DisplayApp::PushMessage(Messages msg) {
TouchEvents DisplayApp::OnTouchEvent() {
auto info = touchPanel.GetTouchInfo();
- if(info.isTouch) {
- switch(info.gesture) {
+ 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:
@@ -355,7 +370,7 @@ TouchEvents DisplayApp::OnTouchEvent() {
}
void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
- switch(direction){
+ switch (direction) {
case DisplayApp::FullRefreshDirections::Down:
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down);
break;
@@ -374,11 +389,11 @@ void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
case DisplayApp::FullRefreshDirections::RightAnim:
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::RightAnim);
break;
- default: break;
+ default:
+ break;
}
}
void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) {
touchMode = mode;
}
-
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index 85aee0fe..ff5ddac8 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -35,74 +35,73 @@ namespace Pinetime {
};
namespace Applications {
class DisplayApp {
- public:
- enum class States {Idle, Running};
- enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
- enum class TouchModes { Gestures, Polling };
-
- DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &,
- Controllers::Battery &batteryController, Controllers::Ble &bleController,
- Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
- System::SystemTask &systemTask,
- Pinetime::Controllers::NotificationManager& notificationManager,
- Pinetime::Controllers::HeartRateController& heartRateController,
- Controllers::Settings &settingsController,
- Pinetime::Controllers::MotionController& motionController
- );
- void Start();
- void PushMessage(Display::Messages msg);
-
- void StartApp(Apps app, DisplayApp::FullRefreshDirections direction);
-
- void SetFullRefresh(FullRefreshDirections direction);
- void SetTouchMode(TouchModes mode);
-
- private:
-
- Pinetime::Drivers::St7789& lcd;
- Pinetime::Components::LittleVgl& lvgl;
- Pinetime::Drivers::Cst816S& touchPanel;
- Pinetime::Controllers::Battery &batteryController;
- Pinetime::Controllers::Ble &bleController;
- Pinetime::Controllers::DateTime& dateTimeController;
- Pinetime::Drivers::WatchdogView& watchdog;
- Pinetime::System::SystemTask& systemTask;
- Pinetime::Controllers::NotificationManager& notificationManager;
- Pinetime::Controllers::HeartRateController& heartRateController;
- Pinetime::Controllers::Settings& settingsController;
- Pinetime::Controllers::MotionController& motionController;
-
- Pinetime::Controllers::FirmwareValidator validator;
- Controllers::BrightnessController brightnessController;
-
- TaskHandle_t taskHandle;
-
- States state = States::Running;
- QueueHandle_t msgQueue;
-
- static constexpr uint8_t queueSize = 10;
- static constexpr uint8_t itemSize = 1;
-
- std::unique_ptr<Screens::Screen> currentScreen;
-
- Apps currentApp = Apps::None;
- Apps returnToApp = Apps::None;
- FullRefreshDirections returnDirection = FullRefreshDirections::None;
- TouchEvents returnTouchEvent = TouchEvents::None;
-
- TouchModes touchMode = TouchModes::Gestures;
-
- TouchEvents OnTouchEvent();
- void RunningState();
- void IdleState();
- static void Process(void* instance);
- void InitHw();
- void Refresh();
- void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent);
- void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction);
-
+ public:
+ enum class States { Idle, Running };
+ enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
+ enum class TouchModes { Gestures, Polling };
+
+ DisplayApp(Drivers::St7789& lcd,
+ Components::LittleVgl& lvgl,
+ Drivers::Cst816S&,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::DateTime& dateTimeController,
+ Drivers::WatchdogView& watchdog,
+ System::SystemTask& systemTask,
+ Pinetime::Controllers::NotificationManager& notificationManager,
+ Pinetime::Controllers::HeartRateController& heartRateController,
+ Controllers::Settings& settingsController,
+ Pinetime::Controllers::MotionController& motionController);
+ void Start();
+ void PushMessage(Display::Messages msg);
+
+ void StartApp(Apps app, DisplayApp::FullRefreshDirections direction);
+
+ void SetFullRefresh(FullRefreshDirections direction);
+ void SetTouchMode(TouchModes mode);
+
+ private:
+ Pinetime::Drivers::St7789& lcd;
+ Pinetime::Components::LittleVgl& lvgl;
+ Pinetime::Drivers::Cst816S& touchPanel;
+ Pinetime::Controllers::Battery& batteryController;
+ Pinetime::Controllers::Ble& bleController;
+ Pinetime::Controllers::DateTime& dateTimeController;
+ Pinetime::Drivers::WatchdogView& watchdog;
+ Pinetime::System::SystemTask& systemTask;
+ Pinetime::Controllers::NotificationManager& notificationManager;
+ Pinetime::Controllers::HeartRateController& heartRateController;
+ Pinetime::Controllers::Settings& settingsController;
+ Pinetime::Controllers::MotionController& motionController;
+
+ Pinetime::Controllers::FirmwareValidator validator;
+ Controllers::BrightnessController brightnessController;
+
+ TaskHandle_t taskHandle;
+
+ States state = States::Running;
+ QueueHandle_t msgQueue;
+
+ static constexpr uint8_t queueSize = 10;
+ static constexpr uint8_t itemSize = 1;
+
+ std::unique_ptr<Screens::Screen> currentScreen;
+
+ Apps currentApp = Apps::None;
+ Apps returnToApp = Apps::None;
+ FullRefreshDirections returnDirection = FullRefreshDirections::None;
+ TouchEvents returnTouchEvent = TouchEvents::None;
+
+ TouchModes touchMode = TouchModes::Gestures;
+
+ TouchEvents OnTouchEvent();
+ void RunningState();
+ void IdleState();
+ static void Process(void* instance);
+ void InitHw();
+ void Refresh();
+ void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent);
+ void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction);
};
}
}
-
-
diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp
index d5723835..5c7dd03d 100644
--- a/src/displayapp/DisplayAppRecovery.cpp
+++ b/src/displayapp/DisplayAppRecovery.cpp
@@ -7,17 +7,20 @@
using namespace Pinetime::Applications;
-DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &touchPanel,
- Controllers::Battery &batteryController, Controllers::Ble &bleController,
- Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
- System::SystemTask &systemTask,
+DisplayApp::DisplayApp(Drivers::St7789& lcd,
+ Components::LittleVgl& lvgl,
+ Drivers::Cst816S& touchPanel,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::DateTime& dateTimeController,
+ Drivers::WatchdogView& watchdog,
+ System::SystemTask& systemTask,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::HeartRateController& heartRateController,
Pinetime::Controllers::Settings& settingsController,
- Pinetime::Controllers::MotionController& motionController):
- lcd{lcd}, bleController{bleController} {
+ Pinetime::Controllers::MotionController& motionController)
+ : lcd {lcd}, bleController {bleController} {
msgQueue = xQueueCreate(queueSize, itemSize);
-
}
void DisplayApp::Start() {
@@ -25,8 +28,8 @@ void DisplayApp::Start() {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
-void DisplayApp::Process(void *instance) {
- auto *app = static_cast<DisplayApp *>(instance);
+void DisplayApp::Process(void* instance) {
+ auto* app = static_cast<DisplayApp*>(instance);
NRF_LOG_INFO("displayapp task started!");
// Send a dummy notification to unlock the lvgl display driver for the first iteration
@@ -61,8 +64,9 @@ void DisplayApp::Refresh() {
}
if (bleController.IsFirmwareUpdating()) {
- uint8_t percent = (static_cast<float>(bleController.FirmwareUpdateCurrentBytes()) /
- static_cast<float>(bleController.FirmwareUpdateTotalBytes())) * 100.0f;
+ uint8_t percent =
+ (static_cast<float>(bleController.FirmwareUpdateCurrentBytes()) / static_cast<float>(bleController.FirmwareUpdateTotalBytes())) *
+ 100.0f;
switch (bleController.State()) {
case Controllers::Ble::FirmwareUpdateStates::Running:
DisplayOtaProgress(percent, colorWhite);
@@ -81,20 +85,20 @@ void DisplayApp::Refresh() {
void DisplayApp::DisplayLogo(uint16_t color) {
Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb), color, colorBlack);
- for(int i = 0; i < displayWidth; i++) {
+ for (int i = 0; i < displayWidth; i++) {
rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel);
ulTaskNotifyTake(pdTRUE, 500);
- lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast<const uint8_t *>(displayBuffer), displayWidth * bytesPerPixel);
+ lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), displayWidth * bytesPerPixel);
}
}
void DisplayApp::DisplayOtaProgress(uint8_t percent, uint16_t color) {
const uint8_t barHeight = 20;
- std::fill(displayBuffer, displayBuffer+(displayWidth * bytesPerPixel), color);
- for(int i = 0; i < barHeight; i++) {
+ std::fill(displayBuffer, displayBuffer + (displayWidth * bytesPerPixel), color);
+ for (int i = 0; i < barHeight; i++) {
ulTaskNotifyTake(pdTRUE, 500);
uint16_t barWidth = std::min(static_cast<float>(percent) * 2.4f, static_cast<float>(displayWidth));
- lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast<const uint8_t *>(displayBuffer), barWidth * bytesPerPixel);
+ lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), barWidth * bytesPerPixel);
}
}
diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h
index c35fa729..025be6c0 100644
--- a/src/displayapp/DisplayAppRecovery.h
+++ b/src/displayapp/DisplayAppRecovery.h
@@ -30,10 +30,14 @@ namespace Pinetime {
namespace Applications {
class DisplayApp {
public:
- DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &,
- Controllers::Battery &batteryController, Controllers::Ble &bleController,
- Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
- System::SystemTask &systemTask,
+ DisplayApp(Drivers::St7789& lcd,
+ Components::LittleVgl& lvgl,
+ Drivers::Cst816S&,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::DateTime& dateTimeController,
+ Drivers::WatchdogView& watchdog,
+ System::SystemTask& systemTask,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::HeartRateController& heartRateController,
Pinetime::Controllers::Settings& settingsController,
@@ -49,7 +53,7 @@ namespace Pinetime {
void InitHw();
void Refresh();
Pinetime::Drivers::St7789& lcd;
- Controllers::Ble &bleController;
+ Controllers::Ble& bleController;
static constexpr uint8_t queueSize = 10;
static constexpr uint8_t itemSize = 1;
@@ -66,10 +70,6 @@ namespace Pinetime {
static constexpr uint16_t colorRedSwapped = 0x00ff;
static constexpr uint16_t colorBlack = 0x0000;
uint8_t displayBuffer[displayWidth * bytesPerPixel];
-
-
};
}
}
-
-
diff --git a/src/displayapp/DummyLittleVgl.h b/src/displayapp/DummyLittleVgl.h
index 1c60911c..96cf153f 100644
--- a/src/displayapp/DummyLittleVgl.h
+++ b/src/displayapp/DummyLittleVgl.h
@@ -9,22 +9,25 @@
namespace Pinetime {
namespace Components {
class LittleVgl {
- public:
- enum class FullRefreshDirections { None, Up, Down };
- LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) {}
-
- LittleVgl(const LittleVgl&) = delete;
- LittleVgl& operator=(const LittleVgl&) = delete;
- LittleVgl(LittleVgl&&) = delete;
- LittleVgl& operator=(LittleVgl&&) = delete;
-
- void FlushDisplay(const lv_area_t * area, lv_color_t * color_p) {}
- bool GetTouchPadInfo(lv_indev_data_t *ptr) {return false;}
- void SetFullRefresh(FullRefreshDirections direction) {}
- void SetNewTapEvent(uint16_t x, uint16_t y) {}
+ public:
+ enum class FullRefreshDirections { None, Up, Down };
+ LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) {
+ }
+ LittleVgl(const LittleVgl&) = delete;
+ LittleVgl& operator=(const LittleVgl&) = delete;
+ LittleVgl(LittleVgl&&) = delete;
+ LittleVgl& operator=(LittleVgl&&) = delete;
+ void FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
+ }
+ bool GetTouchPadInfo(lv_indev_data_t* ptr) {
+ return false;
+ }
+ void SetFullRefresh(FullRefreshDirections direction) {
+ }
+ void SetNewTapEvent(uint16_t x, uint16_t y) {
+ }
};
}
}
-
diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp
index 500fd752..36df51b4 100644
--- a/src/displayapp/LittleVgl.cpp
+++ b/src/displayapp/LittleVgl.cpp
@@ -11,17 +11,18 @@ using namespace Pinetime::Components;
lv_style_t* LabelBigStyle = nullptr;
-static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) {
+static void disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p) {
auto* lvgl = static_cast<LittleVgl*>(disp_drv->user_data);
lvgl->FlushDisplay(area, color_p);
}
-bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) {
+bool touchpad_read(lv_indev_drv_t* indev_drv, lv_indev_data_t* data) {
auto* lvgl = static_cast<LittleVgl*>(indev_drv->user_data);
return lvgl->GetTouchPadInfo(data);
}
-LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) : lcd{lcd}, touchPanel{touchPanel}, previousClick{0,0} {
+LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel)
+ : lcd {lcd}, touchPanel {touchPanel}, previousClick {0, 0} {
lv_init();
InitTheme();
InitDisplay();
@@ -29,8 +30,8 @@ LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S&
}
void LittleVgl::InitDisplay() {
- lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 4); /*Initialize the display buffer*/
- lv_disp_drv_init(&disp_drv); /*Basic initialization*/
+ lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 4); /*Initialize the display buffer*/
+ lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set up the functions to access to your display*/
@@ -59,7 +60,7 @@ void LittleVgl::InitTouchpad() {
}
void LittleVgl::SetFullRefresh(FullRefreshDirections direction) {
- if(scrollDirection == FullRefreshDirections::None) {
+ if (scrollDirection == FullRefreshDirections::None) {
scrollDirection = direction;
if (scrollDirection == FullRefreshDirections::Down) {
lv_disp_set_direction(lv_disp_get_default(), 1);
@@ -75,16 +76,16 @@ void LittleVgl::SetFullRefresh(FullRefreshDirections direction) {
}
}
-void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
+void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
uint16_t y1, y2, width, height = 0;
ulTaskNotifyTake(pdTRUE, 200);
// NOtification is still needed (even if there is a mutex on SPI) because of the DataCommand pin
// which cannot be set/clear during a transfert.
-
- if( (scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) {
+
+ if ((scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) {
writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines;
- } else if( (scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0) ) {
+ } else if ((scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0)) {
writeOffset = (writeOffset + visibleNbLines) % totalNbLines;
}
@@ -94,11 +95,11 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
width = (area->x2 - area->x1) + 1;
height = (area->y2 - area->y1) + 1;
- if(scrollDirection == LittleVgl::FullRefreshDirections::Down) {
+ if (scrollDirection == LittleVgl::FullRefreshDirections::Down) {
- if(area->y2 < visibleNbLines - 1) {
+ if (area->y2 < visibleNbLines - 1) {
uint16_t toScroll = 0;
- if(area->y1 == 0) {
+ if (area->y1 == 0) {
toScroll = height * 2;
scrollDirection = FullRefreshDirections::None;
lv_disp_set_direction(lv_disp_get_default(), 0);
@@ -106,19 +107,19 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
toScroll = height;
}
- if(scrollOffset >= toScroll)
+ if (scrollOffset >= toScroll)
scrollOffset -= toScroll;
else {
toScroll -= scrollOffset;
- scrollOffset = (totalNbLines) - toScroll;
+ scrollOffset = (totalNbLines) -toScroll;
}
lcd.VerticalScrollStartAddress(scrollOffset);
}
- } else if(scrollDirection == FullRefreshDirections::Up) {
+ } else if (scrollDirection == FullRefreshDirections::Up) {
- if(area->y1 > 0) {
- if(area->y2 == visibleNbLines - 1) {
+ if (area->y1 > 0) {
+ if (area->y2 == visibleNbLines - 1) {
scrollOffset += (height * 2);
scrollDirection = FullRefreshDirections::None;
lv_disp_set_direction(lv_disp_get_default(), 0);
@@ -128,13 +129,13 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
scrollOffset = scrollOffset % totalNbLines;
lcd.VerticalScrollStartAddress(scrollOffset);
}
- } else if(scrollDirection == FullRefreshDirections::Left or scrollDirection == FullRefreshDirections::LeftAnim) {
- if(area->x2 == visibleNbLines - 1) {
+ } else if (scrollDirection == FullRefreshDirections::Left or scrollDirection == FullRefreshDirections::LeftAnim) {
+ if (area->x2 == visibleNbLines - 1) {
scrollDirection = FullRefreshDirections::None;
lv_disp_set_direction(lv_disp_get_default(), 0);
}
- } else if(scrollDirection == FullRefreshDirections::Right or scrollDirection == FullRefreshDirections::RightAnim) {
- if(area->x1 == 0) {
+ } else if (scrollDirection == FullRefreshDirections::Right or scrollDirection == FullRefreshDirections::RightAnim) {
+ if (area->x1 == 0) {
scrollDirection = FullRefreshDirections::None;
lv_disp_set_direction(lv_disp_get_default(), 0);
}
@@ -143,17 +144,17 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
if (y2 < y1) {
height = totalNbLines - y1;
- if ( height > 0 ) {
- lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t *>(color_p), width * height * 2);
+ if (height > 0) {
+ lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t*>(color_p), width * height * 2);
ulTaskNotifyTake(pdTRUE, 100);
}
-
+
uint16_t pixOffset = width * height;
height = y2 + 1;
- lcd.DrawBuffer(area->x1, 0, width, height, reinterpret_cast<const uint8_t *>(color_p + pixOffset), width * height * 2);
+ lcd.DrawBuffer(area->x1, 0, width, height, reinterpret_cast<const uint8_t*>(color_p + pixOffset), width * height * 2);
} else {
- lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t *>(color_p), width * height * 2);
+ lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t*>(color_p), width * height * 2);
}
// IMPORTANT!!!
@@ -167,8 +168,8 @@ void LittleVgl::SetNewTapEvent(uint16_t x, uint16_t y) {
tapped = true;
}
-bool LittleVgl::GetTouchPadInfo(lv_indev_data_t *ptr) {
- if(tapped) {
+bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) {
+ if (tapped) {
ptr->point.x = tap_x;
ptr->point.y = tap_y;
ptr->state = LV_INDEV_STATE_PR;
@@ -202,14 +203,8 @@ bool LittleVgl::GetTouchPadInfo(lv_indev_data_t *ptr) {
void LittleVgl::InitTheme() {
- lv_theme_t * th = lv_pinetime_theme_init(
- LV_COLOR_WHITE, LV_COLOR_SILVER,
- 0,
- &jetbrains_mono_bold_20,
- &jetbrains_mono_bold_20,
- &jetbrains_mono_bold_20,
- &jetbrains_mono_bold_20);
+ lv_theme_t* th = lv_pinetime_theme_init(
+ LV_COLOR_WHITE, LV_COLOR_SILVER, 0, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20);
lv_theme_set_act(th);
-
}
diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h
index 28a02e0b..7f7b76e0 100644
--- a/src/displayapp/LittleVgl.h
+++ b/src/displayapp/LittleVgl.h
@@ -10,50 +10,49 @@ namespace Pinetime {
namespace Components {
class LittleVgl {
- public:
- enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
- LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel);
-
- LittleVgl(const LittleVgl&) = delete;
- LittleVgl& operator=(const LittleVgl&) = delete;
- LittleVgl(LittleVgl&&) = delete;
- LittleVgl& operator=(LittleVgl&&) = delete;
-
- void FlushDisplay(const lv_area_t * area, lv_color_t * color_p);
- bool GetTouchPadInfo(lv_indev_data_t *ptr);
- void SetFullRefresh(FullRefreshDirections direction);
- void SetNewTapEvent(uint16_t x, uint16_t y);
-
- private:
- void InitDisplay();
- void InitTouchpad();
- void InitTheme();
-
-
- Pinetime::Drivers::St7789& lcd;
- Pinetime::Drivers::Cst816S& touchPanel;
-
-
- lv_disp_buf_t disp_buf_2;
- lv_color_t buf2_1[LV_HOR_RES_MAX * 4];
- lv_color_t buf2_2[LV_HOR_RES_MAX * 4];
-
- lv_disp_drv_t disp_drv;
- lv_point_t previousClick;
-
- bool firstTouch = true;
- static constexpr uint8_t nbWriteLines = 4;
- static constexpr uint16_t totalNbLines = 320;
- static constexpr uint16_t visibleNbLines = 240;
- static constexpr uint8_t MaxScrollOffset() { return LV_VER_RES_MAX - nbWriteLines; }
- FullRefreshDirections scrollDirection = FullRefreshDirections::None;
- uint16_t writeOffset = 0;
- uint16_t scrollOffset = 0;
-
- uint16_t tap_x = 0;
- uint16_t tap_y = 0;
- bool tapped = false;
+ public:
+ enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
+ LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel);
+
+ LittleVgl(const LittleVgl&) = delete;
+ LittleVgl& operator=(const LittleVgl&) = delete;
+ LittleVgl(LittleVgl&&) = delete;
+ LittleVgl& operator=(LittleVgl&&) = delete;
+
+ void FlushDisplay(const lv_area_t* area, lv_color_t* color_p);
+ bool GetTouchPadInfo(lv_indev_data_t* ptr);
+ void SetFullRefresh(FullRefreshDirections direction);
+ void SetNewTapEvent(uint16_t x, uint16_t y);
+
+ private:
+ void InitDisplay();
+ void InitTouchpad();
+ void InitTheme();
+
+ Pinetime::Drivers::St7789& lcd;
+ Pinetime::Drivers::Cst816S& touchPanel;
+
+ lv_disp_buf_t disp_buf_2;
+ lv_color_t buf2_1[LV_HOR_RES_MAX * 4];
+ lv_color_t buf2_2[LV_HOR_RES_MAX * 4];
+
+ lv_disp_drv_t disp_drv;
+ lv_point_t previousClick;
+
+ bool firstTouch = true;
+ static constexpr uint8_t nbWriteLines = 4;
+ static constexpr uint16_t totalNbLines = 320;
+ static constexpr uint16_t visibleNbLines = 240;
+ static constexpr uint8_t MaxScrollOffset() {
+ return LV_VER_RES_MAX - nbWriteLines;
+ }
+ FullRefreshDirections scrollDirection = FullRefreshDirections::None;
+ uint16_t writeOffset = 0;
+ uint16_t scrollOffset = 0;
+
+ uint16_t tap_x = 0;
+ uint16_t tap_y = 0;
+ bool tapped = false;
};
}
}
-
diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h
index b0690e3a..81871c54 100644
--- a/src/displayapp/Messages.h
+++ b/src/displayapp/Messages.h
@@ -3,8 +3,16 @@ namespace Pinetime {
namespace Applications {
namespace Display {
enum class Messages : uint8_t {
- GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, ButtonPushed,
- NewNotification, BleFirmwareUpdateStarted, UpdateTimeOut
+ GoToSleep,
+ GoToRunning,
+ UpdateDateTime,
+ UpdateBleConnection,
+ UpdateBatteryLevel,
+ TouchEvent,
+ ButtonPushed,
+ NewNotification,
+ BleFirmwareUpdateStarted,
+ UpdateTimeOut
};
}
}
diff --git a/src/displayapp/TouchEvents.h b/src/displayapp/TouchEvents.h
index cf2f88dd..6a37713a 100644
--- a/src/displayapp/TouchEvents.h
+++ b/src/displayapp/TouchEvents.h
@@ -3,6 +3,6 @@
namespace Pinetime {
namespace Applications {
- enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap};
+ enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap };
}
} \ No newline at end of file
diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md
new file mode 100644
index 00000000..494654cd
--- /dev/null
+++ b/src/displayapp/fonts/README.md
@@ -0,0 +1,44 @@
+# Fonts
+
+* [Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/)
+* [Awesome font from LVGL](https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff)
+
+## Generate the fonts:
+
+* Open the [LVGL font converter](https://lvgl.io/tools/fontconverter)
+* Name : jetbrains_mono_bold_20
+* Size : 20
+* Bpp : 1 bit-per-pixel
+* Do not enable font compression and horizontal subpixel hinting
+* Load the file `JetBrainsMono-Bold.tff` and specify the following range : `0x20-0x7f, 0x410-0x44f`
+* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following
+ range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024`
+* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts`
+
+Add new symbols:
+
+* Browse the [cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and find your new symbols
+* For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *Range* list (Remember to keep this
+ readme updated with newest range list)
+* Convert this hex value into a UTF-8 code
+ using [this site](http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=f185&mode=hex)
+* Define the new symbols in `src/DisplayApp/Screens/Symbols.h`:
+
+```
+static constex char* newSymbol = "\xEF\x86\x85";
+```
+
+#### Navigation font
+
+To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app)
+this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and creat a ttf file the
+project for the site is *lv_font_navi_80.json* you can import it to add or remove icons
+
+You can also use the online LVGL tool to create the .c
+
+ttf file : navigation.ttf name : lv_font_navi_80 size : 80px Bpp : 2 bit-per-pixel range : 0xe900-0xe929
+
+$lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o
+lv_font_navi_80.c
+
+#### I use the method above to create the other ttf \ No newline at end of file
diff --git a/src/displayapp/fonts/Readme.md b/src/displayapp/fonts/Readme.md
deleted file mode 100644
index 3bfe4239..00000000
--- a/src/displayapp/fonts/Readme.md
+++ /dev/null
@@ -1,41 +0,0 @@
-#Fonts
-* [Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/)
-* [Awesome font from LVGL](https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff)
-
-## Generate the fonts:
-
- * Open the [LVGL font converter](https://lvgl.io/tools/fontconverter)
- * Name : jetbrains_mono_bold_20
- * Size : 20
- * Bpp : 1 bit-per-pixel
- * Do not enable font compression and horizontal subpixel hinting
- * Load the file `JetBrainsMono-Bold.tff` and specify the following range : `0x20-0x7f, 0x410-0x44f`
- * Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024`
- * Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts`
-
-Add new symbols:
- * Browse the [cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and find your new symbols
- * For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *Range* list (Remember to keep this readme updated with newest range list)
- * Convert this hex value into a UTF-8 code using [this site](http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=f185&mode=hex)
- * Define the new symbols in `src/DisplayApp/Screens/Symbols.h`:
-```
-static constex char* newSymbol = "\xEF\x86\x85";
-```
-
-#### Navigation font
-
-To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app)
-this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and creat a ttf file
-the project for the site is *lv_font_navi_80.json* you can import it to add or remove icons
-
-You can also use the online LVGL tool to create the .c
-
-ttf file : navigation.ttf
-name : lv_font_navi_80
-size : 80px
-Bpp : 2 bit-per-pixel
-range : 0xe900-0xe929
-
-$lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o lv_font_navi_80.c
-
-#### I use the method above to create the other ttf \ No newline at end of file
diff --git a/src/displayapp/lv_pinetime_theme.c b/src/displayapp/lv_pinetime_theme.c
index c153e42d..b003a411 100644
--- a/src/displayapp/lv_pinetime_theme.c
+++ b/src/displayapp/lv_pinetime_theme.c
@@ -19,7 +19,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
-static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
+static void theme_apply(lv_obj_t* obj, lv_theme_style_t name);
/**********************
* STATIC VARIABLES
@@ -67,244 +67,240 @@ static bool inited;
* STATIC FUNCTIONS
**********************/
-static void style_init_reset(lv_style_t * style)
-{
- if(inited) lv_style_reset(style);
- else lv_style_init(style);
+static void style_init_reset(lv_style_t* style) {
+ if (inited)
+ lv_style_reset(style);
+ else
+ lv_style_init(style);
}
-
-static void basic_init(void)
-{
-
- style_init_reset(&style_pad);
- lv_style_set_pad_top(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30);
- lv_style_set_pad_bottom(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30);
- lv_style_set_pad_left(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40);
- lv_style_set_pad_right(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40);
-
- style_init_reset(&style_circle);
- lv_style_set_radius(&style_circle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
-
- style_init_reset(&style_bg);
- lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK);
- lv_style_set_text_font(&style_bg, LV_STATE_DEFAULT, theme.font_normal);
-
- style_init_reset(&style_box);
- lv_style_set_bg_opa(&style_box, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_radius(&style_box, LV_STATE_DEFAULT, 10);
- lv_style_set_value_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
- lv_style_set_value_font(&style_box, LV_STATE_DEFAULT, theme.font_normal);
-
- style_init_reset(&style_box_border);
- lv_style_set_bg_opa(&style_box_border, LV_STATE_DEFAULT, LV_OPA_TRANSP);
- lv_style_set_border_width(&style_box_border, LV_STATE_DEFAULT, 2);
- lv_style_set_border_color(&style_box_border, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
- lv_style_set_text_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
-
-
- style_init_reset(&style_title);
- lv_style_set_text_color(&style_title, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_text_font(&style_title, LV_STATE_DEFAULT, theme.font_subtitle);
-
- style_init_reset(&style_label_white);
- lv_style_set_text_color(&style_label_white, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
-
- style_init_reset(&style_btn);
- lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10);
- lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0x2F3540));
- lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, LV_COLOR_GREEN);
- lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x2F3540));
- lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED | LV_STATE_CHECKED, lv_color_hex3(0x888));
- lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary);
- lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 0);
- lv_style_set_border_opa(&style_btn, LV_STATE_CHECKED, LV_OPA_TRANSP);
-
- lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff));
- lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
- lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
- lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888));
-
- lv_style_set_value_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff));
- lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
- lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
- lv_style_set_value_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888));
-
- lv_style_set_pad_left(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_pad_right(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_pad_top(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_pad_bottom(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_pad_inner(&style_btn, LV_STATE_DEFAULT, LV_DPX(15));
- lv_style_set_outline_width(&style_btn, LV_STATE_DEFAULT, LV_DPX(2));
- lv_style_set_outline_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_0);
- lv_style_set_outline_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary);
- lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 0);
- lv_style_set_transition_delay(&style_btn, LV_STATE_DEFAULT, 0);
-
- style_init_reset(&style_btn_border);
- lv_style_set_radius(&style_btn_border, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
- lv_style_set_border_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_border_width(&style_btn_border, LV_STATE_DEFAULT, 2);
- lv_style_set_bg_opa(&style_btn_border, LV_STATE_DEFAULT, LV_OPA_TRANSP);
- lv_style_set_bg_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_text_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_value_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_transition_prop_3(&style_btn_border, LV_STATE_DEFAULT, LV_STYLE_BG_OPA);
-
- style_init_reset(&style_icon);
- lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
-
- style_init_reset(&style_back);
- lv_style_set_value_color(&style_back, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
- lv_style_set_value_str(&style_back, LV_STATE_DEFAULT, LV_SYMBOL_LEFT);
- lv_style_set_value_font(&style_back, LV_STATE_DEFAULT, theme.font_subtitle);
-
- style_init_reset(&style_bar_indic);
- lv_style_set_bg_opa(&style_bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_radius(&style_bar_indic, LV_STATE_DEFAULT, 10);
-
- style_init_reset(&style_scrollbar);
- lv_style_set_bg_opa(&style_scrollbar, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_radius(&style_scrollbar, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
- lv_style_set_bg_color(&style_scrollbar, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY);
- lv_style_set_size(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 80);
- lv_style_set_pad_right(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 60);
-
- style_init_reset(&style_list_btn);
- lv_style_set_bg_opa(&style_list_btn, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_GRAY);
- lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(LV_PINETIME_GRAY, LV_OPA_20));
- lv_style_set_text_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
- lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE);
- lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE);
- lv_style_set_image_recolor(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
- lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE);
- lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE);
- lv_style_set_pad_left(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25);
- lv_style_set_pad_right(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25);
- lv_style_set_pad_top(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100);
- lv_style_set_pad_bottom(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100);
- lv_style_set_pad_inner(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 50);
-
- style_init_reset(&style_ddlist_list);
- lv_style_set_text_line_space(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 25);
- lv_style_set_shadow_width(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 20);
- lv_style_set_shadow_color(&style_ddlist_list, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
-
- style_init_reset(&style_ddlist_selected);
- lv_style_set_bg_opa(&style_ddlist_selected, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_ddlist_selected, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
-
- style_init_reset(&style_sw_bg);
- lv_style_set_bg_opa(&style_sw_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY);
- lv_style_set_radius(&style_sw_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
- lv_style_set_value_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
-
- style_init_reset(&style_sw_indic);
- lv_style_set_bg_opa(&style_sw_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_sw_indic, LV_STATE_DEFAULT, LV_PINETIME_GREEN);
-
- style_init_reset(&style_sw_knob);
- lv_style_set_bg_opa(&style_sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_sw_knob, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_radius(&style_sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
- lv_style_set_pad_top(&style_sw_knob, LV_STATE_DEFAULT, - 4);
- lv_style_set_pad_bottom(&style_sw_knob, LV_STATE_DEFAULT, - 4);
- lv_style_set_pad_left(&style_sw_knob, LV_STATE_DEFAULT, - 4);
- lv_style_set_pad_right(&style_sw_knob, LV_STATE_DEFAULT, - 4);
-
- style_init_reset(&style_slider_knob);
- lv_style_set_bg_opa(&style_slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER);
- lv_style_set_bg_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_RED);
- lv_style_set_border_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE);
- lv_style_set_border_width(&style_slider_knob, LV_STATE_DEFAULT, 6);
- lv_style_set_radius(&style_slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
- lv_style_set_pad_top(&style_slider_knob, LV_STATE_DEFAULT, 10);
- lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_DEFAULT, 10);
- lv_style_set_pad_left(&style_slider_knob, LV_STATE_DEFAULT, 10);
- lv_style_set_pad_right(&style_slider_knob, LV_STATE_DEFAULT, 10);
- lv_style_set_pad_top(&style_slider_knob, LV_STATE_PRESSED, 14);
- lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_PRESSED, 14);
- lv_style_set_pad_left(&style_slider_knob, LV_STATE_PRESSED, 14);
- lv_style_set_pad_right(&style_slider_knob, LV_STATE_PRESSED, 14);
-
- style_init_reset(&style_arc_indic);
- lv_style_set_line_color(&style_arc_indic, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
- lv_style_set_line_width(&style_arc_indic, LV_STATE_DEFAULT, LV_DPX(25));
- lv_style_set_line_rounded(&style_arc_indic, LV_STATE_DEFAULT, true);
-
- style_init_reset(&style_arc_bg);
- lv_style_set_line_color(&style_arc_bg, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
- lv_style_set_line_width(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(25));
- lv_style_set_line_rounded(&style_arc_bg, LV_STATE_DEFAULT, true);
-
- style_init_reset(&style_table_cell);
- lv_style_set_border_color(&style_table_cell, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
- lv_style_set_border_width(&style_table_cell, LV_STATE_DEFAULT, 1);
- lv_style_set_border_side(&style_table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL);
- lv_style_set_pad_left(&style_table_cell, LV_STATE_DEFAULT, 5);
- lv_style_set_pad_right(&style_table_cell, LV_STATE_DEFAULT, 5);
- lv_style_set_pad_top(&style_table_cell, LV_STATE_DEFAULT, 2);
- lv_style_set_pad_bottom(&style_table_cell, LV_STATE_DEFAULT, 2);
-
- style_init_reset(&style_pad_small);
- lv_style_int_t pad_small_value = 10;
- lv_style_set_pad_left(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
- lv_style_set_pad_right(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
- lv_style_set_pad_top(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
- lv_style_set_pad_bottom(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
- lv_style_set_pad_inner(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
-
- style_init_reset(&style_bg_grad);
- lv_style_set_bg_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 40));
- lv_style_set_bg_grad_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 20));
- lv_style_set_bg_grad_dir(&style_bg_grad, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
-
- style_init_reset(&style_lmeter);
- lv_style_set_radius(&style_lmeter, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
- lv_style_set_pad_left(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_pad_right(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_pad_top(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_pad_inner(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(30));
- lv_style_set_scale_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(25));
-
- lv_style_set_line_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary);
- lv_style_set_scale_grad_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary);
- lv_style_set_scale_end_color(&style_lmeter, LV_STATE_DEFAULT, lv_color_hex3(0x888));
- lv_style_set_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(10));
- lv_style_set_scale_end_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(7));
-
- style_init_reset(&style_chart_serie);
- lv_style_set_line_color(&style_chart_serie, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
- lv_style_set_line_width(&style_chart_serie, LV_STATE_DEFAULT, 4);
- lv_style_set_size(&style_chart_serie, LV_STATE_DEFAULT, 4);
- lv_style_set_bg_opa(&style_chart_serie, LV_STATE_DEFAULT, 0);
-
- lv_style_reset(&style_cb_bg);
- lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4));
- lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
- lv_style_set_outline_color(&style_cb_bg, LV_STATE_DEFAULT, theme.color_primary);
- lv_style_set_outline_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2));
- lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20));
- lv_style_set_transition_time(&style_cb_bg, LV_STATE_DEFAULT, 0);
- lv_style_set_transition_prop_6(&style_cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
-
- lv_style_reset(&style_cb_bullet);
- lv_style_set_outline_opa(&style_cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
- lv_style_set_radius(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(4));
- lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
- lv_style_set_pad_left(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
- lv_style_set_pad_right(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
- lv_style_set_pad_top(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
- lv_style_set_pad_bottom(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
-
+static void basic_init(void) {
+
+ style_init_reset(&style_pad);
+ lv_style_set_pad_top(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30);
+ lv_style_set_pad_bottom(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30);
+ lv_style_set_pad_left(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40);
+ lv_style_set_pad_right(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40);
+
+ style_init_reset(&style_circle);
+ lv_style_set_radius(&style_circle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
+
+ style_init_reset(&style_bg);
+ lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ lv_style_set_text_font(&style_bg, LV_STATE_DEFAULT, theme.font_normal);
+
+ style_init_reset(&style_box);
+ lv_style_set_bg_opa(&style_box, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_radius(&style_box, LV_STATE_DEFAULT, 10);
+ lv_style_set_value_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
+ lv_style_set_value_font(&style_box, LV_STATE_DEFAULT, theme.font_normal);
+
+ style_init_reset(&style_box_border);
+ lv_style_set_bg_opa(&style_box_border, LV_STATE_DEFAULT, LV_OPA_TRANSP);
+ lv_style_set_border_width(&style_box_border, LV_STATE_DEFAULT, 2);
+ lv_style_set_border_color(&style_box_border, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
+ lv_style_set_text_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
+
+ style_init_reset(&style_title);
+ lv_style_set_text_color(&style_title, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_text_font(&style_title, LV_STATE_DEFAULT, theme.font_subtitle);
+
+ style_init_reset(&style_label_white);
+ lv_style_set_text_color(&style_label_white, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+
+ style_init_reset(&style_btn);
+ lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10);
+ lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0x2F3540));
+ lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, LV_COLOR_GREEN);
+ lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x2F3540));
+ lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED | LV_STATE_CHECKED, lv_color_hex3(0x888));
+ lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary);
+ lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 0);
+ lv_style_set_border_opa(&style_btn, LV_STATE_CHECKED, LV_OPA_TRANSP);
+
+ lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff));
+ lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
+ lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
+ lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888));
+
+ lv_style_set_value_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff));
+ lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
+ lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff));
+ lv_style_set_value_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888));
+
+ lv_style_set_pad_left(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_pad_right(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_pad_top(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_pad_bottom(&style_btn, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_pad_inner(&style_btn, LV_STATE_DEFAULT, LV_DPX(15));
+ lv_style_set_outline_width(&style_btn, LV_STATE_DEFAULT, LV_DPX(2));
+ lv_style_set_outline_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_0);
+ lv_style_set_outline_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary);
+ lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 0);
+ lv_style_set_transition_delay(&style_btn, LV_STATE_DEFAULT, 0);
+
+ style_init_reset(&style_btn_border);
+ lv_style_set_radius(&style_btn_border, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
+ lv_style_set_border_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_border_width(&style_btn_border, LV_STATE_DEFAULT, 2);
+ lv_style_set_bg_opa(&style_btn_border, LV_STATE_DEFAULT, LV_OPA_TRANSP);
+ lv_style_set_bg_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_text_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_value_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_transition_prop_3(&style_btn_border, LV_STATE_DEFAULT, LV_STYLE_BG_OPA);
+
+ style_init_reset(&style_icon);
+ lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+
+ style_init_reset(&style_back);
+ lv_style_set_value_color(&style_back, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
+ lv_style_set_value_str(&style_back, LV_STATE_DEFAULT, LV_SYMBOL_LEFT);
+ lv_style_set_value_font(&style_back, LV_STATE_DEFAULT, theme.font_subtitle);
+
+ style_init_reset(&style_bar_indic);
+ lv_style_set_bg_opa(&style_bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_radius(&style_bar_indic, LV_STATE_DEFAULT, 10);
+
+ style_init_reset(&style_scrollbar);
+ lv_style_set_bg_opa(&style_scrollbar, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_radius(&style_scrollbar, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
+ lv_style_set_bg_color(&style_scrollbar, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY);
+ lv_style_set_size(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 80);
+ lv_style_set_pad_right(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 60);
+
+ style_init_reset(&style_list_btn);
+ lv_style_set_bg_opa(&style_list_btn, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_GRAY);
+ lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(LV_PINETIME_GRAY, LV_OPA_20));
+ lv_style_set_text_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
+ lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE);
+ lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE);
+ lv_style_set_image_recolor(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
+ lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE);
+ lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE);
+ lv_style_set_pad_left(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25);
+ lv_style_set_pad_right(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25);
+ lv_style_set_pad_top(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100);
+ lv_style_set_pad_bottom(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100);
+ lv_style_set_pad_inner(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 50);
+
+ style_init_reset(&style_ddlist_list);
+ lv_style_set_text_line_space(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 25);
+ lv_style_set_shadow_width(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 20);
+ lv_style_set_shadow_color(&style_ddlist_list, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
+
+ style_init_reset(&style_ddlist_selected);
+ lv_style_set_bg_opa(&style_ddlist_selected, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_ddlist_selected, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
+
+ style_init_reset(&style_sw_bg);
+ lv_style_set_bg_opa(&style_sw_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY);
+ lv_style_set_radius(&style_sw_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
+ lv_style_set_value_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
+
+ style_init_reset(&style_sw_indic);
+ lv_style_set_bg_opa(&style_sw_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_sw_indic, LV_STATE_DEFAULT, LV_PINETIME_GREEN);
+
+ style_init_reset(&style_sw_knob);
+ lv_style_set_bg_opa(&style_sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_sw_knob, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_radius(&style_sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
+ lv_style_set_pad_top(&style_sw_knob, LV_STATE_DEFAULT, -4);
+ lv_style_set_pad_bottom(&style_sw_knob, LV_STATE_DEFAULT, -4);
+ lv_style_set_pad_left(&style_sw_knob, LV_STATE_DEFAULT, -4);
+ lv_style_set_pad_right(&style_sw_knob, LV_STATE_DEFAULT, -4);
+
+ style_init_reset(&style_slider_knob);
+ lv_style_set_bg_opa(&style_slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER);
+ lv_style_set_bg_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_RED);
+ lv_style_set_border_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_style_set_border_width(&style_slider_knob, LV_STATE_DEFAULT, 6);
+ lv_style_set_radius(&style_slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
+ lv_style_set_pad_top(&style_slider_knob, LV_STATE_DEFAULT, 10);
+ lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_DEFAULT, 10);
+ lv_style_set_pad_left(&style_slider_knob, LV_STATE_DEFAULT, 10);
+ lv_style_set_pad_right(&style_slider_knob, LV_STATE_DEFAULT, 10);
+ lv_style_set_pad_top(&style_slider_knob, LV_STATE_PRESSED, 14);
+ lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_PRESSED, 14);
+ lv_style_set_pad_left(&style_slider_knob, LV_STATE_PRESSED, 14);
+ lv_style_set_pad_right(&style_slider_knob, LV_STATE_PRESSED, 14);
+
+ style_init_reset(&style_arc_indic);
+ lv_style_set_line_color(&style_arc_indic, LV_STATE_DEFAULT, LV_PINETIME_BLUE);
+ lv_style_set_line_width(&style_arc_indic, LV_STATE_DEFAULT, LV_DPX(25));
+ lv_style_set_line_rounded(&style_arc_indic, LV_STATE_DEFAULT, true);
+
+ style_init_reset(&style_arc_bg);
+ lv_style_set_line_color(&style_arc_bg, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
+ lv_style_set_line_width(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(25));
+ lv_style_set_line_rounded(&style_arc_bg, LV_STATE_DEFAULT, true);
+
+ style_init_reset(&style_table_cell);
+ lv_style_set_border_color(&style_table_cell, LV_STATE_DEFAULT, LV_PINETIME_GRAY);
+ lv_style_set_border_width(&style_table_cell, LV_STATE_DEFAULT, 1);
+ lv_style_set_border_side(&style_table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL);
+ lv_style_set_pad_left(&style_table_cell, LV_STATE_DEFAULT, 5);
+ lv_style_set_pad_right(&style_table_cell, LV_STATE_DEFAULT, 5);
+ lv_style_set_pad_top(&style_table_cell, LV_STATE_DEFAULT, 2);
+ lv_style_set_pad_bottom(&style_table_cell, LV_STATE_DEFAULT, 2);
+
+ style_init_reset(&style_pad_small);
+ lv_style_int_t pad_small_value = 10;
+ lv_style_set_pad_left(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
+ lv_style_set_pad_right(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
+ lv_style_set_pad_top(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
+ lv_style_set_pad_bottom(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
+ lv_style_set_pad_inner(&style_pad_small, LV_STATE_DEFAULT, pad_small_value);
+
+ style_init_reset(&style_bg_grad);
+ lv_style_set_bg_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 40));
+ lv_style_set_bg_grad_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 20));
+ lv_style_set_bg_grad_dir(&style_bg_grad, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
+
+ style_init_reset(&style_lmeter);
+ lv_style_set_radius(&style_lmeter, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
+ lv_style_set_pad_left(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_pad_right(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_pad_top(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_pad_inner(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(30));
+ lv_style_set_scale_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(25));
+
+ lv_style_set_line_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary);
+ lv_style_set_scale_grad_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary);
+ lv_style_set_scale_end_color(&style_lmeter, LV_STATE_DEFAULT, lv_color_hex3(0x888));
+ lv_style_set_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(10));
+ lv_style_set_scale_end_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(7));
+
+ style_init_reset(&style_chart_serie);
+ lv_style_set_line_color(&style_chart_serie, LV_STATE_DEFAULT, LV_PINETIME_WHITE);
+ lv_style_set_line_width(&style_chart_serie, LV_STATE_DEFAULT, 4);
+ lv_style_set_size(&style_chart_serie, LV_STATE_DEFAULT, 4);
+ lv_style_set_bg_opa(&style_chart_serie, LV_STATE_DEFAULT, 0);
+
+ lv_style_reset(&style_cb_bg);
+ lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4));
+ lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
+ lv_style_set_outline_color(&style_cb_bg, LV_STATE_DEFAULT, theme.color_primary);
+ lv_style_set_outline_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2));
+ lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20));
+ lv_style_set_transition_time(&style_cb_bg, LV_STATE_DEFAULT, 0);
+ lv_style_set_transition_prop_6(&style_cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
+
+ lv_style_reset(&style_cb_bullet);
+ lv_style_set_outline_opa(&style_cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
+ lv_style_set_radius(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(4));
+ lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
+ lv_style_set_pad_left(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
+ lv_style_set_pad_right(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
+ lv_style_set_pad_top(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
+ lv_style_set_pad_bottom(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8));
}
-
/**********************
* GLOBAL FUNCTIONS
**********************/
@@ -320,221 +316,216 @@ static void basic_init(void)
* @param font_title pointer to a extra large font
* @return a pointer to reference this theme later
*/
-lv_theme_t * lv_pinetime_theme_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
- const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
- const lv_font_t * font_title)
-{
- theme.color_primary = color_primary;
- theme.color_secondary = color_secondary;
- theme.font_small = font_small;
- theme.font_normal = font_normal;
- theme.font_subtitle = font_subtitle;
- theme.font_title = font_title;
- theme.flags = flags;
-
- basic_init();
-
- theme.apply_xcb = theme_apply;
-
- inited = true;
-
- return &theme;
+lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary,
+ lv_color_t color_secondary,
+ uint32_t flags,
+ const lv_font_t* font_small,
+ const lv_font_t* font_normal,
+ const lv_font_t* font_subtitle,
+ const lv_font_t* font_title) {
+ theme.color_primary = color_primary;
+ theme.color_secondary = color_secondary;
+ theme.font_small = font_small;
+ theme.font_normal = font_normal;
+ theme.font_subtitle = font_subtitle;
+ theme.font_title = font_title;
+ theme.flags = flags;
+
+ basic_init();
+
+ theme.apply_xcb = theme_apply;
+
+ inited = true;
+
+ return &theme;
}
-
-static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
-{
- lv_style_list_t * list;
-
- /*To avoid warnings*/
- uint32_t name_int = (uint32_t) name;
- switch(name_int) {
- case LV_THEME_NONE:
- break;
-
- case LV_THEME_SCR:
- lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
- _lv_style_list_add_style(list, &style_bg);
- _lv_style_list_add_style(list, &style_label_white);
- break;
-
- case LV_THEME_OBJ:
- lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
- _lv_style_list_add_style(list, &style_box);
- break;
-
- case LV_THEME_CONT:
- lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
- _lv_style_list_add_style(list, &style_box);
- break;
-
- case LV_THEME_BTN:
- lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
- _lv_style_list_add_style(list, &style_btn);
- //_lv_style_list_add_style(list, &style_bg_grad);
- break;
-
- case LV_THEME_BTNMATRIX:
- list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
- _lv_style_list_add_style(list, &style_bg);
- _lv_style_list_add_style(list, &style_pad_small);
-
- list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
- _lv_style_list_add_style(list, &style_btn);
- //_lv_style_list_add_style(list, &style_bg_grad);
- //_lv_style_list_add_style(list, &style_bg_click);
- break;
-
- case LV_THEME_BAR:
- lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
- list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
-
- lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
- list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
- _lv_style_list_add_style(list, &style_bar_indic);
- break;
-
- case LV_THEME_IMAGE:
- lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
- _lv_style_list_add_style(list, &style_icon);
- break;
-
- case LV_THEME_LABEL:
- lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
- _lv_style_list_add_style(list, &style_label_white);
- break;
-
- case LV_THEME_SLIDER:
- lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
- list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
- _lv_style_list_add_style(list, &style_sw_bg);
-
- lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
- list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
-
- lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
- list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
- _lv_style_list_add_style(list, &style_slider_knob);
- break;
-
- case LV_THEME_LIST:
- lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
- list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
- _lv_style_list_add_style(list, &style_box);
-
- lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
- list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
-
- lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
- list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
- _lv_style_list_add_style(list, &style_scrollbar);
- break;
-
- case LV_THEME_LIST_BTN:
- lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
- _lv_style_list_add_style(list, &style_list_btn);
- break;
-
-
- case LV_THEME_ARC:
- lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
- list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
- _lv_style_list_add_style(list, &style_arc_bg);
-
- lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
- list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
- _lv_style_list_add_style(list, &style_arc_indic);
- break;
-
-
- case LV_THEME_SWITCH:
- lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
- list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
- _lv_style_list_add_style(list, &style_sw_bg);
-
- lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
- list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
- _lv_style_list_add_style(list, &style_sw_indic);
-
- lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
- list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
- _lv_style_list_add_style(list, &style_sw_knob);
- break;
-
- case LV_THEME_DROPDOWN:
- lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
- list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
- _lv_style_list_add_style(list, &style_btn);
- _lv_style_list_add_style(list, &style_pad);
-
- lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
- list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
- _lv_style_list_add_style(list, &style_box);
- _lv_style_list_add_style(list, &style_ddlist_list);
- _lv_style_list_add_style(list, &style_pad);
-
- lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
- list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
- _lv_style_list_add_style(list, &style_ddlist_selected);
-
- lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
- list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
- _lv_style_list_add_style(list, &style_scrollbar);
- break;
-
- case LV_THEME_TABLE:
- list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
- _lv_style_list_add_style(list, &style_bg);
-
- int idx = 1; /* start value should be 1, not zero, since cell styles
- start at 1 due to presence of LV_TABLE_PART_BG=0
- in the enum (lv_table.h) */
- /* declaring idx outside loop to work with older compilers */
- for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) {
- list = lv_obj_get_style_list(obj, idx);
- _lv_style_list_add_style(list, &style_table_cell);
- _lv_style_list_add_style(list, &style_label_white);
- }
- break;
-
- case LV_THEME_LINEMETER:
- list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
- _lv_style_list_add_style(list, &style_bg);
- _lv_style_list_add_style(list, &style_lmeter);
- break;
-
- case LV_THEME_CHART:
- lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
- list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
- _lv_style_list_add_style(list, &style_btn);
- _lv_style_list_add_style(list, &style_chart_serie);
- break;
-
- case LV_THEME_CHECKBOX:
- list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
- _lv_style_list_add_style(list, &style_cb_bg);
-
- list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
- _lv_style_list_add_style(list, &style_btn);
- _lv_style_list_add_style(list, &style_cb_bullet);
- break;
-
-
- default:
- break;
- }
-
-
- lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
-
-
+static void theme_apply(lv_obj_t* obj, lv_theme_style_t name) {
+ lv_style_list_t* list;
+
+ /*To avoid warnings*/
+ uint32_t name_int = (uint32_t) name;
+ switch (name_int) {
+ case LV_THEME_NONE:
+ break;
+
+ case LV_THEME_SCR:
+ lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
+ _lv_style_list_add_style(list, &style_bg);
+ _lv_style_list_add_style(list, &style_label_white);
+ break;
+
+ case LV_THEME_OBJ:
+ lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
+ _lv_style_list_add_style(list, &style_box);
+ break;
+
+ case LV_THEME_CONT:
+ lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
+ _lv_style_list_add_style(list, &style_box);
+ break;
+
+ case LV_THEME_BTN:
+ lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
+ _lv_style_list_add_style(list, &style_btn);
+ //_lv_style_list_add_style(list, &style_bg_grad);
+ break;
+
+ case LV_THEME_BTNMATRIX:
+ list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
+ _lv_style_list_add_style(list, &style_bg);
+ _lv_style_list_add_style(list, &style_pad_small);
+
+ list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
+ _lv_style_list_add_style(list, &style_btn);
+ //_lv_style_list_add_style(list, &style_bg_grad);
+ //_lv_style_list_add_style(list, &style_bg_click);
+ break;
+
+ case LV_THEME_BAR:
+ lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
+ list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
+
+ lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
+ list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
+ _lv_style_list_add_style(list, &style_bar_indic);
+ break;
+
+ case LV_THEME_IMAGE:
+ lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
+ _lv_style_list_add_style(list, &style_icon);
+ break;
+
+ case LV_THEME_LABEL:
+ lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
+ _lv_style_list_add_style(list, &style_label_white);
+ break;
+
+ case LV_THEME_SLIDER:
+ lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
+ list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
+ _lv_style_list_add_style(list, &style_sw_bg);
+
+ lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
+ list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
+
+ lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
+ list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
+ _lv_style_list_add_style(list, &style_slider_knob);
+ break;
+
+ case LV_THEME_LIST:
+ lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
+ list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
+ _lv_style_list_add_style(list, &style_box);
+
+ lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
+ list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
+
+ lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
+ list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
+ _lv_style_list_add_style(list, &style_scrollbar);
+ break;
+
+ case LV_THEME_LIST_BTN:
+ lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
+ _lv_style_list_add_style(list, &style_list_btn);
+ break;
+
+ case LV_THEME_ARC:
+ lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
+ list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
+ _lv_style_list_add_style(list, &style_arc_bg);
+
+ lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
+ list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
+ _lv_style_list_add_style(list, &style_arc_indic);
+ break;
+
+ case LV_THEME_SWITCH:
+ lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
+ list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
+ _lv_style_list_add_style(list, &style_sw_bg);
+
+ lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
+ list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
+ _lv_style_list_add_style(list, &style_sw_indic);
+
+ lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
+ list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
+ _lv_style_list_add_style(list, &style_sw_knob);
+ break;
+
+ case LV_THEME_DROPDOWN:
+ lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
+ list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
+ _lv_style_list_add_style(list, &style_btn);
+ _lv_style_list_add_style(list, &style_pad);
+
+ lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
+ list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
+ _lv_style_list_add_style(list, &style_box);
+ _lv_style_list_add_style(list, &style_ddlist_list);
+ _lv_style_list_add_style(list, &style_pad);
+
+ lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
+ list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
+ _lv_style_list_add_style(list, &style_ddlist_selected);
+
+ lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
+ list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
+ _lv_style_list_add_style(list, &style_scrollbar);
+ break;
+
+ case LV_THEME_TABLE:
+ list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
+ _lv_style_list_add_style(list, &style_bg);
+
+ int idx = 1; /* start value should be 1, not zero, since cell styles
+ start at 1 due to presence of LV_TABLE_PART_BG=0
+ in the enum (lv_table.h) */
+ /* declaring idx outside loop to work with older compilers */
+ for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx++) {
+ list = lv_obj_get_style_list(obj, idx);
+ _lv_style_list_add_style(list, &style_table_cell);
+ _lv_style_list_add_style(list, &style_label_white);
+ }
+ break;
+
+ case LV_THEME_LINEMETER:
+ list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
+ _lv_style_list_add_style(list, &style_bg);
+ _lv_style_list_add_style(list, &style_lmeter);
+ break;
+
+ case LV_THEME_CHART:
+ lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
+ list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
+ _lv_style_list_add_style(list, &style_btn);
+ _lv_style_list_add_style(list, &style_chart_serie);
+ break;
+
+ case LV_THEME_CHECKBOX:
+ list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
+ _lv_style_list_add_style(list, &style_cb_bg);
+
+ list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
+ _lv_style_list_add_style(list, &style_btn);
+ _lv_style_list_add_style(list, &style_cb_bullet);
+ break;
+
+ default:
+ break;
+ }
+
+ lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
}
/**********************
diff --git a/src/displayapp/lv_pinetime_theme.h b/src/displayapp/lv_pinetime_theme.h
index 6697015e..f914516d 100644
--- a/src/displayapp/lv_pinetime_theme.h
+++ b/src/displayapp/lv_pinetime_theme.h
@@ -19,24 +19,22 @@ extern "C" {
* DEFINES
*********************/
/*Colors*/
-#define LV_PINETIME_WHITE lv_color_hex(0xffffff)
-#define LV_PINETIME_LIGHT lv_color_hex(0xf3f8fe)
-#define LV_PINETIME_GRAY lv_color_hex(0x8a8a8a)
-#define LV_PINETIME_LIGHT_GRAY lv_color_hex(0xc4c4c4)
-#define LV_PINETIME_BLUE lv_color_hex(0x2f3243) //006fb6
-#define LV_PINETIME_GREEN lv_color_hex(0x4cb242)
-#define LV_PINETIME_RED lv_color_hex(0xd51732)
+#define LV_PINETIME_WHITE lv_color_hex(0xffffff)
+#define LV_PINETIME_LIGHT lv_color_hex(0xf3f8fe)
+#define LV_PINETIME_GRAY lv_color_hex(0x8a8a8a)
+#define LV_PINETIME_LIGHT_GRAY lv_color_hex(0xc4c4c4)
+#define LV_PINETIME_BLUE lv_color_hex(0x2f3243) // 006fb6
+#define LV_PINETIME_GREEN lv_color_hex(0x4cb242)
+#define LV_PINETIME_RED lv_color_hex(0xd51732)
/**********************
* TYPEDEFS
**********************/
-
/**********************
* GLOBAL PROTOTYPES
**********************/
-
/**
* Initialize the default
* @param color_primary the primary color of the theme
@@ -48,9 +46,13 @@ extern "C" {
* @param font_title pointer to a extra large font
* @return a pointer to reference this theme later
*/
-lv_theme_t * lv_pinetime_theme_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
- const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
- const lv_font_t * font_title);
+lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary,
+ lv_color_t color_secondary,
+ uint32_t flags,
+ const lv_font_t* font_small,
+ const lv_font_t* font_normal,
+ const lv_font_t* font_subtitle,
+ const lv_font_t* font_title);
/**********************
* MACROS
**********************/
diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp
index 056d128c..7e38b3f4 100644
--- a/src/displayapp/screens/ApplicationList.cpp
+++ b/src/displayapp/screens/ApplicationList.cpp
@@ -8,31 +8,34 @@
using namespace Pinetime::Applications::Screens;
-ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Settings &settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController) :
- Screen(app),
- settingsController{settingsController},
- batteryController{batteryController},
- dateTimeController{dateTimeController},
- screens{app,
- settingsController.GetAppMenu(),
- {
- [this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen2(); },
- //[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
- },
- Screens::ScreenListModes::UpDown
- } {}
-
+ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController)
+ : Screen(app),
+ settingsController {settingsController},
+ batteryController {batteryController},
+ dateTimeController {dateTimeController},
+ screens {app,
+ settingsController.GetAppMenu(),
+ {
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen1();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen2();
+ },
+ //[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
+ },
+ Screens::ScreenListModes::UpDown} {
+}
ApplicationList::~ApplicationList() {
lv_obj_clean(lv_scr_act());
}
bool ApplicationList::Refresh() {
- if(running)
+ if (running)
running = screens.Refresh();
return running;
}
@@ -42,31 +45,27 @@ bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
- std::array<Screens::Tile::Applications, 6> applications {
- {
- {Symbols::stopWatch, Apps::StopWatch},
- {Symbols::music, Apps::Music},
- {Symbols::map, Apps::Navigation},
- {Symbols::shoe, Apps::Motion},
- {Symbols::heartBeat, Apps::HeartRate},
- {"", Apps::None},
- }
- };
+ std::array<Screens::Tile::Applications, 6> applications {{
+ {Symbols::stopWatch, Apps::StopWatch},
+ {Symbols::music, Apps::Music},
+ {Symbols::map, Apps::Navigation},
+ {Symbols::shoe, Apps::Motion},
+ {Symbols::heartBeat, Apps::HeartRate},
+ {"", Apps::None},
+ }};
return std::make_unique<Screens::Tile>(0, 2, app, settingsController, batteryController, dateTimeController, applications);
}
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
- std::array<Screens::Tile::Applications, 6> applications {
- {
- {Symbols::paintbrush, Apps::Paint},
- {Symbols::paddle, Apps::Paddle},
- {"2", Apps::Twos},
- {"", Apps::None},
- {"", Apps::None},
- {"", Apps::None},
- }
- };
+ std::array<Screens::Tile::Applications, 6> applications {{
+ {Symbols::paintbrush, Apps::Paint},
+ {Symbols::paddle, Apps::Paddle},
+ {"2", Apps::Twos},
+ {"", Apps::None},
+ {"", Apps::None},
+ {"", Apps::None},
+ }};
return std::make_unique<Screens::Tile>(1, 2, app, settingsController, batteryController, dateTimeController, applications);
}
@@ -84,4 +83,3 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
return std::make_unique<Screens::Tile>(2, 3, app, settingsController, batteryController, dateTimeController, applications);
}*/
-
diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h
index e334ccde..88534ec4 100644
--- a/src/displayapp/screens/ApplicationList.h
+++ b/src/displayapp/screens/ApplicationList.h
@@ -12,24 +12,24 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class ApplicationList : public Screen {
- public:
- explicit ApplicationList(DisplayApp* app,
- Pinetime::Controllers::Settings &settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController);
- ~ApplicationList() override;
- bool Refresh() override;
- bool OnTouchEvent(TouchEvents event) override;
- private:
+ public:
+ explicit ApplicationList(DisplayApp* app,
+ Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController);
+ ~ApplicationList() override;
+ bool Refresh() override;
+ bool OnTouchEvent(TouchEvents event) override;
- Controllers::Settings& settingsController;
- Pinetime::Controllers::Battery& batteryController;
- Controllers::DateTime& dateTimeController;
+ private:
+ Controllers::Settings& settingsController;
+ Pinetime::Controllers::Battery& batteryController;
+ Controllers::DateTime& dateTimeController;
- ScreenList<2> screens;
- std::unique_ptr<Screen> CreateScreen1();
- std::unique_ptr<Screen> CreateScreen2();
- //std::unique_ptr<Screen> CreateScreen3();
+ ScreenList<2> screens;
+ std::unique_ptr<Screen> CreateScreen1();
+ std::unique_ptr<Screen> CreateScreen2();
+ // std::unique_ptr<Screen> CreateScreen3();
};
}
}
diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp
index 455b0c6d..6b54a305 100644
--- a/src/displayapp/screens/BatteryIcon.cpp
+++ b/src/displayapp/screens/BatteryIcon.cpp
@@ -4,10 +4,14 @@
using namespace Pinetime::Applications::Screens;
const char* BatteryIcon::GetBatteryIcon(int batteryPercent) {
- if(batteryPercent > 90) return Symbols::batteryFull;
- if(batteryPercent > 75) return Symbols::batteryThreeQuarter;
- if(batteryPercent > 50) return Symbols::batteryHalf;
- if(batteryPercent > 25) return Symbols::batteryOneQuarter;
+ if (batteryPercent > 90)
+ return Symbols::batteryFull;
+ if (batteryPercent > 75)
+ return Symbols::batteryThreeQuarter;
+ if (batteryPercent > 50)
+ return Symbols::batteryHalf;
+ if (batteryPercent > 25)
+ return Symbols::batteryOneQuarter;
return Symbols::batteryEmpty;
}
@@ -15,8 +19,9 @@ const char* BatteryIcon::GetUnknownIcon() {
return Symbols::batteryEmpty;
}
-const char *BatteryIcon::GetPlugIcon(bool isCharging) {
- if(isCharging)
+const char* BatteryIcon::GetPlugIcon(bool isCharging) {
+ if (isCharging)
return Symbols::plug;
- else return "";
+ else
+ return "";
}
diff --git a/src/displayapp/screens/BatteryIcon.h b/src/displayapp/screens/BatteryIcon.h
index 006e5621..9c192ff7 100644
--- a/src/displayapp/screens/BatteryIcon.h
+++ b/src/displayapp/screens/BatteryIcon.h
@@ -6,8 +6,8 @@ namespace Pinetime {
class BatteryIcon {
public:
static const char* GetUnknownIcon();
- static const char* GetBatteryIcon(int batteryPercent);
- static const char* GetPlugIcon(bool isCharging);
+ static const char* GetBatteryIcon(int batteryPercent);
+ static const char* GetPlugIcon(bool isCharging);
};
}
}
diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp
index e616d67f..1ab8b0ad 100644
--- a/src/displayapp/screens/BatteryInfo.cpp
+++ b/src/displayapp/screens/BatteryInfo.cpp
@@ -4,22 +4,18 @@
using namespace Pinetime::Applications::Screens;
-static void lv_update_task(struct _lv_task_t *task) {
- auto user_data = static_cast<BatteryInfo *>(task->user_data);
+static void lv_update_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<BatteryInfo*>(task->user_data);
user_data->UpdateScreen();
}
-static void lv_anim_task(struct _lv_task_t *task) {
- auto user_data = static_cast<BatteryInfo *>(task->user_data);
+static void lv_anim_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<BatteryInfo*>(task->user_data);
user_data->UpdateAnim();
}
-BatteryInfo::BatteryInfo(
- Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Battery& batteryController) :
- Screen(app),
- batteryController{batteryController}
-{
+BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Battery& batteryController)
+ : Screen(app), batteryController {batteryController} {
batteryPercent = batteryController.PercentRemaining();
batteryVoltage = batteryController.Voltage();
@@ -32,37 +28,38 @@ BatteryInfo::BatteryInfo(
lv_obj_set_style_local_radius(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222));
lv_obj_set_style_local_bg_opa(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_OPA_100);
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
lv_bar_set_value(charging_bar, batteryPercent, LV_ANIM_OFF);
- status = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(status,"Reading Battery status");
+ status = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(status, "Reading Battery status");
lv_label_set_align(status, LV_LABEL_ALIGN_CENTER);
lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
-
+
percent = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(percent, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
- if ( batteryPercent >= 0) {
- lv_label_set_text_fmt(percent,"%02i%%", batteryPercent);
+ if (batteryPercent >= 0) {
+ lv_label_set_text_fmt(percent, "%02i%%", batteryPercent);
} else {
- lv_label_set_text(percent,"--%");
+ lv_label_set_text(percent, "--%");
}
lv_label_set_align(percent, LV_LABEL_ALIGN_LEFT);
lv_obj_align(percent, nullptr, LV_ALIGN_CENTER, 0, -60);
// hack to not use the flot functions from printf
uint8_t batteryVoltageBytes[2];
- batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); //truncate whole numbers
- batteryVoltageBytes[0] = static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over
+ batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers
+ batteryVoltageBytes[0] =
+ static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over
//
- voltage = lv_label_create(lv_scr_act(), nullptr);
+ voltage = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(voltage, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xC6A600));
- lv_label_set_text_fmt(voltage,"%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
+ lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
lv_label_set_align(voltage, LV_LABEL_ALIGN_CENTER);
lv_obj_align(voltage, nullptr, LV_ALIGN_CENTER, 0, 95);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
@@ -73,7 +70,6 @@ BatteryInfo::BatteryInfo(
UpdateScreen();
}
-
BatteryInfo::~BatteryInfo() {
lv_task_del(taskUpdate);
lv_task_del(taskAnim);
@@ -83,9 +79,9 @@ BatteryInfo::~BatteryInfo() {
void BatteryInfo::UpdateAnim() {
batteryPercent = batteryController.PercentRemaining();
- if ( batteryPercent >= 0 ) {
- if ( batteryController.IsCharging() and batteryPercent < 100 ) {
- animation +=1;
+ if (batteryPercent >= 0) {
+ if (batteryController.IsCharging() and batteryPercent < 100) {
+ animation += 1;
if (animation >= 100) {
animation = 0;
}
@@ -110,40 +106,39 @@ void BatteryInfo::UpdateScreen() {
batteryPercent = batteryController.PercentRemaining();
batteryVoltage = batteryController.Voltage();
- if ( batteryPercent >= 0 ) {
- if ( batteryController.IsCharging() and batteryPercent < 100 ) {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_RED);
- lv_label_set_text_static(status,"Battery charging");
- } else if ( batteryPercent == 100 ) {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_BLUE);
- lv_label_set_text_static(status,"Battery is fully charged");
- } else if ( batteryPercent < 10 ) {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_YELLOW);
- lv_label_set_text_static(status,"Battery is low");
+ if (batteryPercent >= 0) {
+ if (batteryController.IsCharging() and batteryPercent < 100) {
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED);
+ lv_label_set_text_static(status, "Battery charging");
+ } else if (batteryPercent == 100) {
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE);
+ lv_label_set_text_static(status, "Battery is fully charged");
+ } else if (batteryPercent < 10) {
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
+ lv_label_set_text_static(status, "Battery is low");
} else {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_GREEN);
- lv_label_set_text_static(status,"Battery discharging");
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_GREEN);
+ lv_label_set_text_static(status, "Battery discharging");
}
-
- lv_label_set_text_fmt(percent,"%02i%%", batteryPercent);
-
+
+ lv_label_set_text_fmt(percent, "%02i%%", batteryPercent);
+
} else {
- lv_label_set_text_static(status,"Reading Battery status");
- lv_label_set_text(percent,"--%");
+ lv_label_set_text_static(status, "Reading Battery status");
+ lv_label_set_text(percent, "--%");
}
lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
// hack to not use the flot functions from printf
uint8_t batteryVoltageBytes[2];
- batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); //truncate whole numbers
- batteryVoltageBytes[0] = static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over
+ batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers
+ batteryVoltageBytes[0] =
+ static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over
//
- lv_label_set_text_fmt(voltage,"%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
-
+ lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
}
bool BatteryInfo::Refresh() {
-
+
return running;
}
-
diff --git a/src/displayapp/screens/BatteryInfo.h b/src/displayapp/screens/BatteryInfo.h
index 206f1ab0..8805db58 100644
--- a/src/displayapp/screens/BatteryInfo.h
+++ b/src/displayapp/screens/BatteryInfo.h
@@ -6,7 +6,6 @@
#include "Screen.h"
#include <lvgl/lvgl.h>
-
namespace Pinetime {
namespace Controllers {
class Battery;
@@ -15,34 +14,30 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class BatteryInfo : public Screen{
- public:
- BatteryInfo(DisplayApp* app,
- Pinetime::Controllers::Battery& batteryController);
- ~BatteryInfo() override;
-
- bool Refresh() override;
-
-
- void UpdateScreen();
- void UpdateAnim();
+ class BatteryInfo : public Screen {
+ public:
+ BatteryInfo(DisplayApp* app, Pinetime::Controllers::Battery& batteryController);
+ ~BatteryInfo() override;
- private:
+ bool Refresh() override;
- Pinetime::Controllers::Battery& batteryController;
+ void UpdateScreen();
+ void UpdateAnim();
- lv_obj_t* voltage;
- lv_obj_t* percent;
- lv_obj_t* charging_bar;
- lv_obj_t* status;
+ private:
+ Pinetime::Controllers::Battery& batteryController;
- lv_task_t* taskUpdate;
- lv_task_t* taskAnim;
+ lv_obj_t* voltage;
+ lv_obj_t* percent;
+ lv_obj_t* charging_bar;
+ lv_obj_t* status;
- int8_t animation = 0;
- int8_t batteryPercent = -1;
- float batteryVoltage = 0.0f;
+ lv_task_t* taskUpdate;
+ lv_task_t* taskAnim;
+ int8_t animation = 0;
+ int8_t batteryPercent = -1;
+ float batteryVoltage = 0.0f;
};
}
}
diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp
index 1bbbd053..da3d15e7 100644
--- a/src/displayapp/screens/BleIcon.cpp
+++ b/src/displayapp/screens/BleIcon.cpp
@@ -3,6 +3,8 @@
using namespace Pinetime::Applications::Screens;
const char* BleIcon::GetIcon(bool isConnected) {
- if(isConnected) return Symbols::bluetooth;
- else return "";
+ if (isConnected)
+ return Symbols::bluetooth;
+ else
+ return "";
} \ No newline at end of file
diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp
index 38469cf5..47c10561 100644
--- a/src/displayapp/screens/Brightness.cpp
+++ b/src/displayapp/screens/Brightness.cpp
@@ -3,14 +3,15 @@
using namespace Pinetime::Applications::Screens;
-void slider_event_cb(lv_obj_t * slider, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
+void slider_event_cb(lv_obj_t* slider, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
auto* brightnessSlider = static_cast<Brightness*>(slider->user_data);
brightnessSlider->OnValueChanged();
}
}
-Brightness::Brightness(Pinetime::Applications::DisplayApp *app, Controllers::BrightnessController& brightness) : Screen(app), brightness{brightness} {
+Brightness::Brightness(Pinetime::Applications::DisplayApp* app, Controllers::BrightnessController& brightness)
+ : Screen(app), brightness {brightness} {
slider = lv_slider_create(lv_scr_act(), nullptr);
lv_obj_set_user_data(slider, this);
lv_obj_set_width(slider, LV_DPI * 2);
@@ -33,13 +34,18 @@ bool Brightness::Refresh() {
return running;
}
-const char *Brightness::LevelToString(Pinetime::Controllers::BrightnessController::Levels level) {
- switch(level) {
- case Pinetime::Controllers::BrightnessController::Levels::Off: return "Off";
- case Pinetime::Controllers::BrightnessController::Levels::Low: return "Low";
- case Pinetime::Controllers::BrightnessController::Levels::Medium: return "Medium";
- case Pinetime::Controllers::BrightnessController::Levels::High: return "High";
- default : return "???";
+const char* Brightness::LevelToString(Pinetime::Controllers::BrightnessController::Levels level) {
+ switch (level) {
+ case Pinetime::Controllers::BrightnessController::Levels::Off:
+ return "Off";
+ case Pinetime::Controllers::BrightnessController::Levels::Low:
+ return "Low";
+ case Pinetime::Controllers::BrightnessController::Levels::Medium:
+ return "Medium";
+ case Pinetime::Controllers::BrightnessController::Levels::High:
+ return "High";
+ default:
+ return "???";
}
}
@@ -48,29 +54,40 @@ void Brightness::OnValueChanged() {
}
void Brightness::SetValue(uint8_t value) {
- switch(value) {
- case 0: brightness.Set(Controllers::BrightnessController::Levels::Low); break;
- case 1: brightness.Set(Controllers::BrightnessController::Levels::Medium); break;
- case 2: brightness.Set(Controllers::BrightnessController::Levels::High); break;
+ switch (value) {
+ case 0:
+ brightness.Set(Controllers::BrightnessController::Levels::Low);
+ break;
+ case 1:
+ brightness.Set(Controllers::BrightnessController::Levels::Medium);
+ break;
+ case 2:
+ brightness.Set(Controllers::BrightnessController::Levels::High);
+ break;
}
lv_label_set_text(slider_label, LevelToString(brightness.Level()));
}
uint8_t Brightness::LevelToInt(Pinetime::Controllers::BrightnessController::Levels level) {
- switch(level) {
- case Pinetime::Controllers::BrightnessController::Levels::Off: return 0;
- case Pinetime::Controllers::BrightnessController::Levels::Low: return 0;
- case Pinetime::Controllers::BrightnessController::Levels::Medium: return 1;
- case Pinetime::Controllers::BrightnessController::Levels::High: return 2;
- default : return 0;
+ switch (level) {
+ case Pinetime::Controllers::BrightnessController::Levels::Off:
+ return 0;
+ case Pinetime::Controllers::BrightnessController::Levels::Low:
+ return 0;
+ case Pinetime::Controllers::BrightnessController::Levels::Medium:
+ return 1;
+ case Pinetime::Controllers::BrightnessController::Levels::High:
+ return 2;
+ default:
+ return 0;
}
}
bool Brightness::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- switch(event) {
+ switch (event) {
case TouchEvents::SwipeLeft:
brightness.Lower();
- if ( brightness.Level() == Pinetime::Controllers::BrightnessController::Levels::Off) {
+ if (brightness.Level() == Pinetime::Controllers::BrightnessController::Levels::Off) {
brightness.Set(Controllers::BrightnessController::Levels::Low);
}
SetValue();
diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h
index 60b33cfd..9ee33753 100644
--- a/src/displayapp/screens/Brightness.h
+++ b/src/displayapp/screens/Brightness.h
@@ -9,25 +9,25 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class Brightness : public Screen {
- public:
- Brightness(DisplayApp* app, Controllers::BrightnessController& brightness);
- ~Brightness() override;
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
+ public:
+ Brightness(DisplayApp* app, Controllers::BrightnessController& brightness);
+ ~Brightness() override;
+ bool Refresh() override;
- void OnValueChanged();
- private:
-
- Controllers::BrightnessController& brightness;
+ bool OnTouchEvent(TouchEvents event) override;
- lv_obj_t * slider_label;
- lv_obj_t * slider;
+ void OnValueChanged();
- const char* LevelToString(Controllers::BrightnessController::Levels level);
- uint8_t LevelToInt(Controllers::BrightnessController::Levels level);
- void SetValue(uint8_t value);
- void SetValue();
+ private:
+ Controllers::BrightnessController& brightness;
+
+ lv_obj_t* slider_label;
+ lv_obj_t* slider;
+
+ const char* LevelToString(Controllers::BrightnessController::Levels level);
+ uint8_t LevelToInt(Controllers::BrightnessController::Levels level);
+ void SetValue(uint8_t value);
+ void SetValue();
};
}
}
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index c218aa5c..14299840 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -15,45 +15,48 @@
#include "WatchFaceDigital.h"
#include "WatchFaceAnalog.h"
-
using namespace Pinetime::Applications::Screens;
Clock::Clock(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController) : Screen(app),
- dateTimeController{dateTimeController}, batteryController{batteryController},
- bleController{bleController}, notificatioManager{notificatioManager},
- settingsController{settingsController},
- heartRateController{heartRateController},
- motionController{motionController},
- screens{app,
- settingsController.GetClockFace(),
- {
- [this]() -> std::unique_ptr<Screen> { return WatchFaceDigitalScreen(); },
- [this]() -> std::unique_ptr<Screen> { return WatchFaceAnalogScreen(); },
- // Examples for more watch faces
- //[this]() -> std::unique_ptr<Screen> { return WatchFaceMinimalScreen(); },
- //[this]() -> std::unique_ptr<Screen> { return WatchFaceCustomScreen(); }
- },
- Screens::ScreenListModes::LongPress
- } {
-
- settingsController.SetAppMenu(0);
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController)
+ : Screen(app),
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ bleController {bleController},
+ notificatioManager {notificatioManager},
+ settingsController {settingsController},
+ heartRateController {heartRateController},
+ motionController {motionController},
+ screens {app,
+ settingsController.GetClockFace(),
+ {
+ [this]() -> std::unique_ptr<Screen> {
+ return WatchFaceDigitalScreen();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return WatchFaceAnalogScreen();
+ },
+ // Examples for more watch faces
+ //[this]() -> std::unique_ptr<Screen> { return WatchFaceMinimalScreen(); },
+ //[this]() -> std::unique_ptr<Screen> { return WatchFaceCustomScreen(); }
+ },
+ Screens::ScreenListModes::LongPress} {
- }
+ settingsController.SetAppMenu(0);
+}
Clock::~Clock() {
lv_obj_clean(lv_scr_act());
}
-
-bool Clock::Refresh() {
- screens.Refresh();
+bool Clock::Refresh() {
+ screens.Refresh();
return running;
}
@@ -61,21 +64,31 @@ bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event);
}
-std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
- return std::make_unique<Screens::WatchFaceDigital>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController, motionController);
+std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
+ return std::make_unique<Screens::WatchFaceDigital>(app,
+ dateTimeController,
+ batteryController,
+ bleController,
+ notificatioManager,
+ settingsController,
+ heartRateController,
+ motionController);
}
-std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
- return std::make_unique<Screens::WatchFaceAnalog>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
+std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
+ return std::make_unique<Screens::WatchFaceAnalog>(
+ app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
}
/*
// Examples for more watch faces
-std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() {
- return std::make_unique<Screens::WatchFaceMinimal>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
+std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() {
+ return std::make_unique<Screens::WatchFaceMinimal>(app, dateTimeController, batteryController, bleController, notificatioManager,
+settingsController);
}
-std::unique_ptr<Screen> Clock::WatchFaceCustomScreen() {
- return std::make_unique<Screens::WatchFaceCustom>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
+std::unique_ptr<Screen> Clock::WatchFaceCustomScreen() {
+ return std::make_unique<Screens::WatchFaceCustom>(app, dateTimeController, batteryController, bleController, notificatioManager,
+settingsController);
}
*/ \ No newline at end of file
diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h
index 1a4e0ebd..9879985f 100644
--- a/src/displayapp/screens/Clock.h
+++ b/src/displayapp/screens/Clock.h
@@ -23,42 +23,37 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class Clock : public Screen {
- public:
- Clock(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController);
- ~Clock() override;
-
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
-
- private:
-
- Controllers::DateTime& dateTimeController;
- Controllers::Battery& batteryController;
- Controllers::Ble& bleController;
- Controllers::NotificationManager& notificatioManager;
- Controllers::Settings& settingsController;
- Controllers::HeartRateController& heartRateController;
- Controllers::MotionController& motionController;
-
-
- ScreenList<2> screens;
- std::unique_ptr<Screen> WatchFaceDigitalScreen();
- std::unique_ptr<Screen> WatchFaceAnalogScreen();
-
- // Examples for more watch faces
- //std::unique_ptr<Screen> WatchFaceMinimalScreen();
- //std::unique_ptr<Screen> WatchFaceCustomScreen();
-
-
-
+ public:
+ Clock(DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController);
+ ~Clock() override;
+
+ bool Refresh() override;
+
+ bool OnTouchEvent(TouchEvents event) override;
+
+ private:
+ Controllers::DateTime& dateTimeController;
+ Controllers::Battery& batteryController;
+ Controllers::Ble& bleController;
+ Controllers::NotificationManager& notificatioManager;
+ Controllers::Settings& settingsController;
+ Controllers::HeartRateController& heartRateController;
+ Controllers::MotionController& motionController;
+
+ ScreenList<2> screens;
+ std::unique_ptr<Screen> WatchFaceDigitalScreen();
+ std::unique_ptr<Screen> WatchFaceAnalogScreen();
+
+ // Examples for more watch faces
+ // std::unique_ptr<Screen> WatchFaceMinimalScreen();
+ // std::unique_ptr<Screen> WatchFaceCustomScreen();
};
}
}
diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp
index c3ec5d7d..9043c20d 100644
--- a/src/displayapp/screens/DropDownDemo.cpp
+++ b/src/displayapp/screens/DropDownDemo.cpp
@@ -5,20 +5,21 @@
using namespace Pinetime::Applications::Screens;
-DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp *app) : Screen(app) {
+DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp* app) : Screen(app) {
// Create the dropdown object, with many item, and fix its height
ddlist = lv_ddlist_create(lv_scr_act(), nullptr);
- lv_ddlist_set_options(ddlist, "Apple\n"
- "Banana\n"
- "Orange\n"
- "Melon\n"
- "Grape\n"
- "Raspberry\n"
- "A\n"
- "B\n"
- "C\n"
- "D\n"
- "E");
+ lv_ddlist_set_options(ddlist,
+ "Apple\n"
+ "Banana\n"
+ "Orange\n"
+ "Melon\n"
+ "Grape\n"
+ "Raspberry\n"
+ "A\n"
+ "B\n"
+ "C\n"
+ "D\n"
+ "E");
lv_ddlist_set_fix_width(ddlist, 150);
lv_ddlist_set_draw_arrow(ddlist, true);
lv_ddlist_set_fix_height(ddlist, 150);
@@ -32,12 +33,12 @@ DropDownDemo::~DropDownDemo() {
}
bool DropDownDemo::Refresh() {
- auto* list = static_cast<lv_ddlist_ext_t *>(ddlist->ext_attr);
+ auto* list = static_cast<lv_ddlist_ext_t*>(ddlist->ext_attr);
// Switch touchmode to Polling if the dropdown is opened. This will allow to scroll inside the
// dropdown while it is opened.
// Disable the polling mode when the dropdown is closed to be able to handle the gestures.
- if(list->opened)
+ if (list->opened)
app->SetTouchMode(DisplayApp::TouchModes::Polling);
else
app->SetTouchMode(DisplayApp::TouchModes::Gestures);
@@ -47,11 +48,10 @@ bool DropDownDemo::Refresh() {
bool DropDownDemo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
// If the dropdown is opened, notify Display app that it doesn't need to handle the event
// (this will prevent displayApp from going back to the menu or clock scree).
- auto* list = static_cast<lv_ddlist_ext_t *>(ddlist->ext_attr);
- if(list->opened) {
+ auto* list = static_cast<lv_ddlist_ext_t*>(ddlist->ext_attr);
+ if (list->opened) {
return true;
} else {
return false;
}
}
-
diff --git a/src/displayapp/screens/DropDownDemo.h b/src/displayapp/screens/DropDownDemo.h
index 821ae528..ff388c57 100644
--- a/src/displayapp/screens/DropDownDemo.h
+++ b/src/displayapp/screens/DropDownDemo.h
@@ -9,18 +9,18 @@ namespace Pinetime {
namespace Screens {
class DropDownDemo : public Screen {
- public:
- DropDownDemo(DisplayApp* app);
- ~DropDownDemo() override;
+ public:
+ DropDownDemo(DisplayApp* app);
+ ~DropDownDemo() override;
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
+ bool Refresh() override;
- private:
- lv_obj_t * ddlist;
-
- bool isDropDownOpened = false;
+ bool OnTouchEvent(TouchEvents event) override;
+
+ private:
+ lv_obj_t* ddlist;
+
+ bool isDropDownOpened = false;
};
}
}
diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp
index e894850e..4086b152 100644
--- a/src/displayapp/screens/FirmwareUpdate.cpp
+++ b/src/displayapp/screens/FirmwareUpdate.cpp
@@ -5,9 +5,14 @@
using namespace Pinetime::Applications::Screens;
+FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Ble& bleController)
+ : Screen(app), bleController {bleController} {
-FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) :
- Screen(app), bleController{bleController} {
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
+ lv_obj_set_size(backgroundLabel, 240, 240);
+ lv_obj_set_pos(backgroundLabel, 0, 0);
+ lv_label_set_text_static(backgroundLabel, "");
titleLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(titleLabel, "Firmware update");
@@ -32,21 +37,21 @@ FirmwareUpdate::~FirmwareUpdate() {
}
bool FirmwareUpdate::Refresh() {
- switch(bleController.State()) {
+ switch (bleController.State()) {
default:
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle:
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running:
- if(state != States::Running)
+ if (state != States::Running)
state = States::Running;
return DisplayProgression();
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated:
- if(state != States::Validated) {
+ if (state != States::Validated) {
UpdateValidated();
state = States::Validated;
}
return running;
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error:
- if(state != States::Error) {
+ if (state != States::Error) {
UpdateError();
state = States::Error;
}
diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h
index 27be3631..f4d34df0 100644
--- a/src/displayapp/screens/FirmwareUpdate.h
+++ b/src/displayapp/screens/FirmwareUpdate.h
@@ -10,29 +10,28 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class FirmwareUpdate : public Screen{
- public:
- FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController);
- ~FirmwareUpdate() override;
+ class FirmwareUpdate : public Screen {
+ public:
+ FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController);
+ ~FirmwareUpdate() override;
- bool Refresh() override;
-
+ bool Refresh() override;
- private:
- enum class States { Idle, Running, Validated, Error };
- Pinetime::Controllers::Ble& bleController;
- lv_obj_t* bar1;
- lv_obj_t* percentLabel;
- lv_obj_t* titleLabel;
- mutable char percentStr[10];
-
- States state;
+ private:
+ enum class States { Idle, Running, Validated, Error };
+ Pinetime::Controllers::Ble& bleController;
+ lv_obj_t* bar1;
+ lv_obj_t* percentLabel;
+ lv_obj_t* titleLabel;
+ mutable char percentStr[10];
- bool DisplayProgression() const;
+ States state;
- void UpdateValidated();
+ bool DisplayProgression() const;
- void UpdateError();
+ void UpdateValidated();
+
+ void UpdateError();
};
}
}
diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp
index f78b1a67..873a22f5 100644
--- a/src/displayapp/screens/FirmwareValidation.cpp
+++ b/src/displayapp/screens/FirmwareValidation.cpp
@@ -7,23 +7,20 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event)
- {
- FirmwareValidation* screen = static_cast<FirmwareValidation *>(obj->user_data);
+ static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
+ FirmwareValidation* screen = static_cast<FirmwareValidation*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
}
-FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::FirmwareValidator &validator)
- : Screen{app}, validator{validator} {
+FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator)
+ : Screen {app}, validator {validator} {
labelVersionInfo = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(labelVersionInfo, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_label_set_text(labelVersionInfo, "Version : ");
lv_label_set_align(labelVersionInfo, LV_LABEL_ALIGN_LEFT);
-
labelVersionValue = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
lv_label_set_recolor(labelVersionValue, true);
@@ -36,11 +33,10 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK);
lv_obj_set_width(labelIsValidated, 240);
- if(validator.IsValidated())
+ if (validator.IsValidated())
lv_label_set_text(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
else {
- lv_label_set_text(labelIsValidated,
- "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
+ lv_label_set_text(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
buttonValidate = lv_btn_create(lv_scr_act(), nullptr);
lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
@@ -49,20 +45,19 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
lv_obj_set_style_local_bg_color(buttonValidate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x009900));
labelButtonValidate = lv_label_create(buttonValidate, nullptr);
- lv_label_set_text_static(labelButtonValidate, "Validate");
+ lv_label_set_text_static(labelButtonValidate, "Validate");
buttonReset = lv_btn_create(lv_scr_act(), nullptr);
buttonReset->user_data = this;
lv_obj_align(buttonReset, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_set_style_local_bg_color(buttonReset, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x990000));
lv_obj_set_event_cb(buttonReset, ButtonEventHandler);
-
+
labelButtonReset = lv_label_create(buttonReset, nullptr);
- lv_label_set_text_static(labelButtonReset, "Reset");
- }
+ lv_label_set_text_static(labelButtonReset, "Reset");
+ }
}
-
FirmwareValidation::~FirmwareValidation() {
lv_obj_clean(lv_scr_act());
}
@@ -71,12 +66,11 @@ bool FirmwareValidation::Refresh() {
return running;
}
-void FirmwareValidation::OnButtonEvent(lv_obj_t *object, lv_event_t event) {
- if(object == buttonValidate && event == LV_EVENT_PRESSED) {
+void FirmwareValidation::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
+ if (object == buttonValidate && event == LV_EVENT_PRESSED) {
validator.Validate();
- running = false;
- } else if(object == buttonReset && event == LV_EVENT_PRESSED) {
+ running = false;
+ } else if (object == buttonReset && event == LV_EVENT_PRESSED) {
validator.Reset();
}
-
}
diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h
index b83f8238..67662fd9 100644
--- a/src/displayapp/screens/FirmwareValidation.h
+++ b/src/displayapp/screens/FirmwareValidation.h
@@ -11,28 +11,26 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class FirmwareValidation : public Screen{
- public:
- FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator);
- ~FirmwareValidation() override;
-
- bool Refresh() override;
-
-
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
-
- private:
- Pinetime::Controllers::FirmwareValidator& validator;
-
- lv_obj_t* labelVersionInfo;
- lv_obj_t* labelVersionValue;
- char version[9];
- lv_obj_t* labelIsValidated;
- lv_obj_t* buttonValidate;
- lv_obj_t* labelButtonValidate;
- lv_obj_t* buttonReset;
- lv_obj_t* labelButtonReset;
-
+ class FirmwareValidation : public Screen {
+ public:
+ FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator);
+ ~FirmwareValidation() override;
+
+ bool Refresh() override;
+
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+
+ private:
+ Pinetime::Controllers::FirmwareValidator& validator;
+
+ lv_obj_t* labelVersionInfo;
+ lv_obj_t* labelVersionValue;
+ char version[9];
+ lv_obj_t* labelIsValidated;
+ lv_obj_t* buttonValidate;
+ lv_obj_t* labelButtonValidate;
+ lv_obj_t* buttonReset;
+ lv_obj_t* labelButtonReset;
};
}
}
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 0ef1b333..4568db40 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -5,46 +5,43 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- FlashLight* screen = static_cast<FlashLight *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ FlashLight* screen = static_cast<FlashLight*>(obj->user_data);
screen->OnClickEvent(obj, event);
}
}
-FlashLight::FlashLight(
- Pinetime::Applications::DisplayApp *app,
- System::SystemTask &systemTask,
- Controllers::BrightnessController& brightness) :
- Screen(app),
- systemTask{systemTask},
- brightness{brightness}
-
+FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
+ System::SystemTask& systemTask,
+ Controllers::BrightnessController& brightness)
+ : Screen(app),
+ systemTask {systemTask},
+ brightness {brightness}
+
{
brightness.Backup();
brightness.Set(Controllers::BrightnessController::Levels::High);
// Set the background
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
-
- flashLight = lv_label_create(lv_scr_act(), NULL);
+
+ flashLight = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_obj_set_style_local_text_font(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(flashLight, Symbols::highlight);
lv_obj_align(flashLight, NULL, LV_ALIGN_CENTER, 0, 0);
- backgroundAction = lv_label_create(lv_scr_act(), nullptr);
+ backgroundAction = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundAction, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundAction, 240, 240);
lv_obj_set_pos(backgroundAction, 0, 0);
lv_label_set_text(backgroundAction, "");
lv_obj_set_click(backgroundAction, true);
- backgroundAction->user_data = this;
+ backgroundAction->user_data = this;
lv_obj_set_event_cb(backgroundAction, event_handler);
-
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
+ systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
}
-
FlashLight::~FlashLight() {
lv_obj_clean(lv_scr_act());
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
@@ -52,19 +49,18 @@ FlashLight::~FlashLight() {
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping);
}
-void FlashLight::OnClickEvent(lv_obj_t *obj, lv_event_t event) {
- if(obj == backgroundAction) {
+void FlashLight::OnClickEvent(lv_obj_t* obj, lv_event_t event) {
+ if (obj == backgroundAction) {
if (event == LV_EVENT_CLICKED) {
isOn = !isOn;
- if ( isOn ) {
+ if (isOn) {
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
} else {
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
}
-
}
}
}
@@ -76,4 +72,3 @@ bool FlashLight::Refresh() {
bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return true;
}
-
diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h
index c62472ab..a862ffdb 100644
--- a/src/displayapp/screens/FlashLight.h
+++ b/src/displayapp/screens/FlashLight.h
@@ -6,30 +6,28 @@
#include "systemtask/SystemTask.h"
#include "components/brightness/BrightnessController.h"
-
namespace Pinetime {
-
+
namespace Applications {
namespace Screens {
- class FlashLight : public Screen{
- public:
- FlashLight(DisplayApp* app, System::SystemTask &systemTask, Controllers::BrightnessController& brightness);
- ~FlashLight() override;
+ class FlashLight : public Screen {
+ public:
+ FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness);
+ ~FlashLight() override;
- bool Refresh() override;
-
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
- void OnClickEvent(lv_obj_t *obj, lv_event_t event);
+ bool Refresh() override;
- private:
- Pinetime::System::SystemTask& systemTask;
- Controllers::BrightnessController& brightness;
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ void OnClickEvent(lv_obj_t* obj, lv_event_t event);
- lv_obj_t* flashLight;
- lv_obj_t* backgroundAction;
- bool isOn = true;
+ private:
+ Pinetime::System::SystemTask& systemTask;
+ Controllers::BrightnessController& brightness;
+ lv_obj_t* flashLight;
+ lv_obj_t* backgroundAction;
+ bool isOn = true;
};
}
}
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index e735c18d..90f6bc26 100644
--- a/src/displayapp/screens/HeartRate.cpp
+++ b/src/displayapp/screens/HeartRate.cpp
@@ -7,7 +7,7 @@
using namespace Pinetime::Applications::Screens;
namespace {
- const char *ToString(Pinetime::Controllers::HeartRateController::States s) {
+ const char* ToString(Pinetime::Controllers::HeartRateController::States s) {
switch (s) {
case Pinetime::Controllers::HeartRateController::States::NotEnoughData:
return "Not enough data,\nplease wait...";
@@ -21,35 +21,37 @@ namespace {
return "";
}
- static void btnStartStopEventHandler(lv_obj_t *obj, lv_event_t event) {
- HeartRate *screen = static_cast<HeartRate *>(obj->user_data);
+ static void btnStartStopEventHandler(lv_obj_t* obj, lv_event_t event) {
+ HeartRate* screen = static_cast<HeartRate*>(obj->user_data);
screen->OnStartStopEvent(event);
}
}
-HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::HeartRateController& heartRateController, System::SystemTask &systemTask) :
- Screen(app), heartRateController{heartRateController}, systemTask{systemTask} {
+HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app,
+ Controllers::HeartRateController& heartRateController,
+ System::SystemTask& systemTask)
+ : Screen(app), heartRateController {heartRateController}, systemTask {systemTask} {
bool isHrRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
label_hr = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
- if(isHrRunning)
+ if (isHrRunning)
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
else
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(label_hr, "000");
- lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
+ lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
label_bpm = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(label_bpm, "Heart rate BPM");
+ lv_label_set_text(label_bpm, "Heart rate BPM");
lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20);
label_status = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
-
+
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
btn_startStop = lv_btn_create(lv_scr_act(), nullptr);
@@ -60,7 +62,7 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::Heart
label_startStop = lv_label_create(btn_startStop, nullptr);
UpdateStartStopButton(isHrRunning);
- if(isHrRunning)
+ if (isHrRunning)
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
}
@@ -72,10 +74,10 @@ HeartRate::~HeartRate() {
bool HeartRate::Refresh() {
auto state = heartRateController.State();
- switch(state) {
+ switch (state) {
case Controllers::HeartRateController::States::NoTouch:
case Controllers::HeartRateController::States::NotEnoughData:
- //case Controllers::HeartRateController::States::Stopped:
+ // case Controllers::HeartRateController::States::Stopped:
lv_label_set_text(label_hr, "000");
break;
default:
@@ -90,13 +92,12 @@ bool HeartRate::Refresh() {
void HeartRate::OnStartStopEvent(lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
- if(heartRateController.State() == Controllers::HeartRateController::States::Stopped) {
+ if (heartRateController.State() == Controllers::HeartRateController::States::Stopped) {
heartRateController.Start();
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
- }
- else {
+ } else {
heartRateController.Stop();
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping);
@@ -106,7 +107,7 @@ void HeartRate::OnStartStopEvent(lv_event_t event) {
}
void HeartRate::UpdateStartStopButton(bool isRunning) {
- if(isRunning)
+ if (isRunning)
lv_label_set_text(label_startStop, "Stop");
else
lv_label_set_text(label_startStop, "Start");
diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h
index c8f36999..a23c5af8 100644
--- a/src/displayapp/screens/HeartRate.h
+++ b/src/displayapp/screens/HeartRate.h
@@ -15,13 +15,13 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class HeartRate : public Screen{
+ class HeartRate : public Screen {
public:
- HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask &systemTask);
+ HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask& systemTask);
~HeartRate() override;
bool Refresh() override;
-
+
void OnStartStopEvent(lv_event_t event);
private:
@@ -33,9 +33,6 @@ namespace Pinetime {
lv_obj_t* label_status;
lv_obj_t* btn_startStop;
lv_obj_t* label_startStop;
-
-
-
};
}
}
diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp
index b6a7e3e4..32240084 100644
--- a/src/displayapp/screens/InfiniPaint.cpp
+++ b/src/displayapp/screens/InfiniPaint.cpp
@@ -4,7 +4,7 @@
using namespace Pinetime::Applications::Screens;
-InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} {
+InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} {
app->SetTouchMode(DisplayApp::TouchModes::Polling);
std::fill(b, b + bufferSize, selectColor);
}
@@ -20,8 +20,8 @@ bool InfiniPaint::Refresh() {
}
bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- switch(event) {
- case Pinetime::Applications::TouchEvents::LongTap:
+ switch (event) {
+ case Pinetime::Applications::TouchEvents::LongTap:
switch (color) {
case 0:
selectColor = LV_COLOR_MAGENTA;
@@ -47,13 +47,13 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
case 7:
selectColor = LV_COLOR_BLACK;
break;
-
+
default:
color = 0;
break;
}
- std::fill(b, b + bufferSize, selectColor);
+ std::fill(b, b + bufferSize, selectColor);
color++;
return true;
default:
@@ -72,4 +72,3 @@ bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) {
lvgl.FlushDisplay(&area, b);
return true;
}
-
diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h
index da9c39ba..6251752a 100644
--- a/src/displayapp/screens/InfiniPaint.h
+++ b/src/displayapp/screens/InfiniPaint.h
@@ -31,7 +31,6 @@ namespace Pinetime {
lv_color_t b[bufferSize];
lv_color_t selectColor = LV_COLOR_WHITE;
uint8_t color = 2;
-
};
}
}
diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp
index cc268775..0132dbd2 100644
--- a/src/displayapp/screens/Label.cpp
+++ b/src/displayapp/screens/Label.cpp
@@ -2,24 +2,21 @@
using namespace Pinetime::Applications::Screens;
-Label::Label(uint8_t screenID, uint8_t numScreens,
- Pinetime::Applications::DisplayApp *app, lv_obj_t* labelText) :
- Screen(app),
- labelText{labelText} {
-
- if ( numScreens > 1 ) {
+Label::Label(uint8_t screenID, uint8_t numScreens, Pinetime::Applications::DisplayApp* app, lv_obj_t* labelText)
+ : Screen(app), labelText {labelText} {
+
+ if (numScreens > 1) {
pageIndicatorBasePoints[0].x = 240 - 1;
pageIndicatorBasePoints[0].y = 6;
pageIndicatorBasePoints[1].x = 240 - 1;
pageIndicatorBasePoints[1].y = 240 - 6;
-
+
pageIndicatorBase = lv_line_create(lv_scr_act(), NULL);
lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2);
-
uint16_t indicatorSize = 228 / numScreens;
uint16_t indicatorPos = indicatorSize * screenID;
@@ -34,7 +31,6 @@ Label::Label(uint8_t screenID, uint8_t numScreens,
lv_obj_set_style_local_line_rounded(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);
}
-
}
Label::~Label() {
diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h
index a1bcba95..62b80bec 100644
--- a/src/displayapp/screens/Label.h
+++ b/src/displayapp/screens/Label.h
@@ -8,23 +8,20 @@ namespace Pinetime {
namespace Screens {
class Label : public Screen {
- public:
- Label( uint8_t screenID, uint8_t numScreens,
- DisplayApp* app, lv_obj_t* labelText );
- ~Label() override;
-
- bool Refresh() override;
-
+ public:
+ Label(uint8_t screenID, uint8_t numScreens, DisplayApp* app, lv_obj_t* labelText);
+ ~Label() override;
- private:
+ bool Refresh() override;
- bool running = true;
-
- lv_obj_t * labelText = nullptr;
- lv_point_t pageIndicatorBasePoints[2];
- lv_point_t pageIndicatorPoints[2];
- lv_obj_t* pageIndicatorBase;
- lv_obj_t* pageIndicator;
+ private:
+ bool running = true;
+
+ lv_obj_t* labelText = nullptr;
+ lv_point_t pageIndicatorBasePoints[2];
+ lv_point_t pageIndicatorPoints[2];
+ lv_obj_t* pageIndicatorBase;
+ lv_obj_t* pageIndicator;
};
}
}
diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp
index 82da4d4c..b4f4d2cf 100644
--- a/src/displayapp/screens/List.cpp
+++ b/src/displayapp/screens/List.cpp
@@ -5,39 +5,37 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) {
- List* screen = static_cast<List *>(obj->user_data);
+ static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
+ List* screen = static_cast<List*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
}
-List::List(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings &settingsController,
- std::array<Applications, MAXLISTITEMS>& applications) :
- Screen(app),
- settingsController{settingsController}
-{
+List::List(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ std::array<Applications, MAXLISTITEMS>& applications)
+ : Screen(app), settingsController {settingsController} {
// Set the background to Black
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0, 0, 0));
settingsController.SetSettingsMenu(screenID);
- if ( numScreens > 1 ) {
+ if (numScreens > 1) {
pageIndicatorBasePoints[0].x = 240 - 1;
pageIndicatorBasePoints[0].y = 6;
pageIndicatorBasePoints[1].x = 240 - 1;
pageIndicatorBasePoints[1].y = 240 - 6;
-
+
pageIndicatorBase = lv_line_create(lv_scr_act(), NULL);
lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2);
-
uint16_t indicatorSize = 228 / numScreens;
uint16_t indicatorPos = indicatorSize * screenID;
@@ -53,10 +51,9 @@ List::List(uint8_t screenID, uint8_t numScreens,
lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);
}
-
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
+ // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
@@ -67,12 +64,12 @@ List::List(uint8_t screenID, uint8_t numScreens,
lv_obj_set_height(container1, LV_VER_RES);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * labelBt;
- lv_obj_t * labelBtIco;
+ lv_obj_t* labelBt;
+ lv_obj_t* labelBtIco;
- for(int i = 0; i < MAXLISTITEMS; i++) {
+ for (int i = 0; i < MAXLISTITEMS; i++) {
apps[i] = applications[i].application;
- if ( applications[i].application != Apps::None) {
+ if (applications[i].application != Apps::None) {
itemApps[i] = lv_btn_create(container1, nullptr);
lv_obj_set_style_local_bg_opa(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
@@ -91,19 +88,17 @@ List::List(uint8_t screenID, uint8_t numScreens,
labelBt = lv_label_create(itemApps[i], nullptr);
lv_label_set_text_fmt(labelBt, " %s", applications[i].name);
-
}
}
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, LV_HOR_RES, LV_VER_RES);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text_static(backgroundLabel, "");
-
}
-List::~List() {
+List::~List() {
lv_obj_clean(lv_scr_act());
}
@@ -112,10 +107,10 @@ bool List::Refresh() {
return running;
}
-void List::OnButtonEvent(lv_obj_t * object, lv_event_t event) {
- if ( event == LV_EVENT_RELEASED ) {
- for(int i = 0; i < MAXLISTITEMS; i++) {
- if ( apps[i] != Apps::None && object == itemApps[i] ) {
+void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_RELEASED) {
+ for (int i = 0; i < MAXLISTITEMS; i++) {
+ if (apps[i] != Apps::None && object == itemApps[i]) {
app->StartApp(apps[i], DisplayApp::FullRefreshDirections::Up);
running = false;
return;
@@ -123,4 +118,3 @@ void List::OnButtonEvent(lv_obj_t * object, lv_event_t event) {
}
}
}
-
diff --git a/src/displayapp/screens/List.h b/src/displayapp/screens/List.h
index 739a91c3..a45fd1d3 100644
--- a/src/displayapp/screens/List.h
+++ b/src/displayapp/screens/List.h
@@ -13,36 +13,34 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class List : public Screen {
- public:
- struct Applications {
- const char* icon;
- const char* name;
- Pinetime::Applications::Apps application;
- };
-
- explicit List(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings& settingsController,
- std::array<Applications, MAXLISTITEMS>& applications);
- ~List() override;
-
- bool Refresh() override;
-
-
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
-
- private:
-
- Controllers::Settings& settingsController;
- Pinetime::Applications::Apps apps[MAXLISTITEMS];
-
- lv_obj_t * itemApps[MAXLISTITEMS];
-
- lv_point_t pageIndicatorBasePoints[2];
- lv_point_t pageIndicatorPoints[2];
- lv_obj_t* pageIndicatorBase;
- lv_obj_t* pageIndicator;
-
+ public:
+ struct Applications {
+ const char* icon;
+ const char* name;
+ Pinetime::Applications::Apps application;
+ };
+
+ explicit List(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ std::array<Applications, MAXLISTITEMS>& applications);
+ ~List() override;
+
+ bool Refresh() override;
+
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+
+ private:
+ Controllers::Settings& settingsController;
+ Pinetime::Applications::Apps apps[MAXLISTITEMS];
+
+ lv_obj_t* itemApps[MAXLISTITEMS];
+
+ lv_point_t pageIndicatorBasePoints[2];
+ lv_point_t pageIndicatorPoints[2];
+ lv_obj_t* pageIndicatorBase;
+ lv_obj_t* pageIndicator;
};
}
}
diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp
index 2c042cac..e0dbdfad 100644
--- a/src/displayapp/screens/Meter.cpp
+++ b/src/displayapp/screens/Meter.cpp
@@ -4,35 +4,33 @@
using namespace Pinetime::Applications::Screens;
-
-Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) {
+Meter::Meter(Pinetime::Applications::DisplayApp* app) : Screen(app) {
/*Create a line meter */
lmeter = lv_linemeter_create(lv_scr_act(), nullptr);
- lv_linemeter_set_range(lmeter, 0, 60); /*Set the range*/
- lv_linemeter_set_value(lmeter, value); /*Set the current value*/
+ lv_linemeter_set_range(lmeter, 0, 60); /*Set the range*/
+ lv_linemeter_set_value(lmeter, value); /*Set the current value*/
lv_linemeter_set_angle_offset(lmeter, 180);
- lv_linemeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/
+ lv_linemeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/
- lv_obj_set_style_local_scale_end_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(255,0,0));
- lv_obj_set_style_local_scale_grad_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(160,0,0));
+ lv_obj_set_style_local_scale_end_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(255, 0, 0));
+ lv_obj_set_style_local_scale_grad_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(160, 0, 0));
lv_obj_set_style_local_line_width(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2);
lv_obj_set_style_local_line_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_SILVER);
lv_obj_set_size(lmeter, 200, 200);
lv_obj_align(lmeter, nullptr, LV_ALIGN_CENTER, 0, 0);
-
}
Meter::~Meter() {
-
lv_obj_clean(lv_scr_act());
}
bool Meter::Refresh() {
- lv_linemeter_set_value(lmeter, value++); /*Set the current value*/
- if(value>=60) value = 0;
+ lv_linemeter_set_value(lmeter, value++); /*Set the current value*/
+ if (value >= 60)
+ value = 0;
return running;
}
diff --git a/src/displayapp/screens/Meter.h b/src/displayapp/screens/Meter.h
index 6a1fc3bf..24af15ad 100644
--- a/src/displayapp/screens/Meter.h
+++ b/src/displayapp/screens/Meter.h
@@ -9,20 +9,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class Meter : public Screen{
- public:
- Meter(DisplayApp* app);
- ~Meter() override;
+ class Meter : public Screen {
+ public:
+ Meter(DisplayApp* app);
+ ~Meter() override;
- bool Refresh() override;
+ bool Refresh() override;
- private:
- lv_style_t style_lmeter;
- lv_obj_t * lmeter;
-
- uint32_t value=0;
-
+ private:
+ lv_style_t style_lmeter;
+ lv_obj_t* lmeter;
+ uint32_t value = 0;
};
}
}
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index ed4b8198..e7196267 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -6,14 +6,14 @@ using namespace Pinetime::Applications::Screens;
extern lv_font_t jetbrains_mono_extrabold_compressed;
extern lv_font_t jetbrains_mono_bold_20;
-
-Motion::Motion(Pinetime::Applications::DisplayApp *app, Controllers::MotionController& motionController) : Screen(app), motionController{motionController} {
+Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController)
+ : Screen(app), motionController {motionController} {
chart = lv_chart_create(lv_scr_act(), NULL);
lv_obj_set_size(chart, 240, 240);
lv_obj_align(chart, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
- lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
- //lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/
- //lv_chart_set_series_width(chart, 4); /*Line width and point radious*/
+ lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
+ // lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/
+ // lv_chart_set_series_width(chart, 4); /*Line width and point radious*/
lv_chart_set_range(chart, -1100, 1100);
lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_SHIFT);
diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h
index ad1341a8..11007866 100644
--- a/src/displayapp/screens/Motion.h
+++ b/src/displayapp/screens/Motion.h
@@ -12,7 +12,7 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class Motion : public Screen{
+ class Motion : public Screen {
public:
Motion(DisplayApp* app, Controllers::MotionController& motionController);
~Motion() override;
@@ -22,17 +22,16 @@ namespace Pinetime {
private:
Controllers::MotionController& motionController;
- lv_obj_t * chart;
- lv_chart_series_t * ser1;
- lv_chart_series_t * ser2;
- lv_chart_series_t * ser3;
+ lv_obj_t* chart;
+ lv_chart_series_t* ser1;
+ lv_chart_series_t* ser2;
+ lv_chart_series_t* ser3;
lv_obj_t* labelStep;
lv_obj_t* labelStepValue;
static constexpr uint8_t nbStepsBufferSize = 9;
- char nbStepsBuffer[nbStepsBufferSize+1];
+ char nbStepsBuffer[nbStepsBufferSize + 1];
bool running = true;
-
};
}
}
diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp
index d8c950fa..9f10f508 100644
--- a/src/displayapp/screens/Music.cpp
+++ b/src/displayapp/screens/Music.cpp
@@ -26,8 +26,8 @@
using namespace Pinetime::Applications::Screens;
-static void event_handler(lv_obj_t *obj, lv_event_t event) {
- Music *screen = static_cast<Music *>(obj->user_data);
+static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ Music* screen = static_cast<Music*>(obj->user_data);
screen->OnObjectEvent(obj, event);
}
@@ -38,7 +38,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
* @param img pointer to an image object
* @param data the image array
*/
-inline void lv_img_set_src_arr(lv_obj_t *img, const lv_img_dsc_t *src_img) {
+inline void lv_img_set_src_arr(lv_obj_t* img, const lv_img_dsc_t* src_img) {
lv_img_set_src(img, src_img);
}
@@ -47,9 +47,9 @@ inline void lv_img_set_src_arr(lv_obj_t *img, const lv_img_dsc_t *src_img) {
*
* TODO: Investigate Apple Media Service and AVRCPv1.6 support for seamless integration
*/
-Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::MusicService &music) : Screen(app), musicService(music) {
- lv_obj_t *label;
-
+Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::MusicService& music) : Screen(app), musicService(music) {
+ lv_obj_t* label;
+
btnVolDown = lv_btn_create(lv_scr_act(), nullptr);
btnVolDown->user_data = this;
lv_obj_set_event_cb(btnVolDown, event_handler);
@@ -61,7 +61,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
label = lv_label_create(btnVolDown, nullptr);
lv_label_set_text(label, Symbols::volumDown);
lv_obj_set_hidden(btnVolDown, !displayVolumeButtons);
-
+
btnVolUp = lv_btn_create(lv_scr_act(), nullptr);
btnVolUp->user_data = this;
lv_obj_set_event_cb(btnVolUp, event_handler);
@@ -73,7 +73,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
label = lv_label_create(btnVolUp, nullptr);
lv_label_set_text(label, Symbols::volumUp);
lv_obj_set_hidden(btnVolUp, !displayVolumeButtons);
-
+
btnPrev = lv_btn_create(lv_scr_act(), nullptr);
btnPrev->user_data = this;
lv_obj_set_event_cb(btnPrev, event_handler);
@@ -84,7 +84,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
lv_obj_set_style_local_bg_opa(btnPrev, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
label = lv_label_create(btnPrev, nullptr);
lv_label_set_text(label, Symbols::stepBackward);
-
+
btnNext = lv_btn_create(lv_scr_act(), nullptr);
btnNext->user_data = this;
lv_obj_set_event_cb(btnNext, event_handler);
@@ -95,7 +95,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
lv_obj_set_style_local_bg_opa(btnNext, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
label = lv_label_create(btnNext, nullptr);
lv_label_set_text(label, Symbols::stepForward);
-
+
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
btnPlayPause->user_data = this;
lv_obj_set_event_cb(btnPlayPause, event_handler);
@@ -106,7 +106,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
lv_obj_set_style_local_bg_opa(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
lv_label_set_text(txtPlayPause, Symbols::play);
-
+
txtTrackDuration = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrackDuration, LV_LABEL_LONG_SROLL);
lv_obj_align(txtTrackDuration, nullptr, LV_ALIGN_IN_TOP_LEFT, 12, 20);
@@ -122,30 +122,29 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
lv_label_set_anim_speed(txtArtist, 1);
lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT);
lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID);
- lv_obj_set_width(txtArtist, LV_HOR_RES-12);
+ lv_obj_set_width(txtArtist, LV_HOR_RES - 12);
lv_label_set_text(txtArtist, "Artist Name");
-
txtTrack = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC);
lv_label_set_anim_speed(txtTrack, 1);
lv_obj_align(txtTrack, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 2 * FONT_HEIGHT + LINE_PAD);
lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID);
- lv_obj_set_width(txtTrack, LV_HOR_RES-12);
+ lv_obj_set_width(txtTrack, LV_HOR_RES - 12);
lv_label_set_text(txtTrack, "This is a very long getTrack name");
/** Init animation */
imgDisc = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src_arr(imgDisc, &disc);
lv_obj_align(imgDisc, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 15);
-
+
imgDiscAnim = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src_arr(imgDiscAnim, &disc_f_1);
lv_obj_align(imgDiscAnim, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15 - 32, 15);
-
+
frameB = false;
-
+
musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN);
}
@@ -159,22 +158,22 @@ bool Music::Refresh() {
currentLength = 0;
lv_label_set_text(txtArtist, artist.data());
}
-
+
if (track != musicService.getTrack()) {
track = musicService.getTrack();
currentLength = 0;
lv_label_set_text(txtTrack, track.data());
}
-
+
if (album != musicService.getAlbum()) {
album = musicService.getAlbum();
currentLength = 0;
}
-
+
if (playing != musicService.isPlaying()) {
playing = musicService.isPlaying();
}
-
+
// Because we increment this ourselves,
// we can't compare with the old data directly
// have to update it when there's actually new data
@@ -184,26 +183,26 @@ bool Music::Refresh() {
lastLength = currentLength;
UpdateLength();
}
-
+
if (totalLength != musicService.getTrackLength()) {
totalLength = musicService.getTrackLength();
UpdateLength();
}
-
+
if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) {
lv_label_set_text(txtPlayPause, Symbols::pause);
if (xTaskGetTickCount() - 1024 >= lastIncrement) {
-
+
if (frameB) {
lv_img_set_src(imgDiscAnim, &disc_f_1);
} else {
lv_img_set_src(imgDiscAnim, &disc_f_2);
}
frameB = !frameB;
-
+
if (currentLength < totalLength) {
- currentLength += static_cast<int>((static_cast<float>(xTaskGetTickCount() - lastIncrement) / 1024.0f) *
- musicService.getPlaybackSpeed());
+ currentLength +=
+ static_cast<int>((static_cast<float>(xTaskGetTickCount() - lastIncrement) / 1024.0f) * musicService.getPlaybackSpeed());
} else {
// Let's assume the getTrack finished, paused when the timer ends
// and there's no new getTrack being sent to us
@@ -211,13 +210,13 @@ bool Music::Refresh() {
playing = false;
}
lastIncrement = xTaskGetTickCount();
-
+
UpdateLength();
}
} else {
lv_label_set_text(txtPlayPause, Symbols::play);
}
-
+
return running;
}
@@ -226,26 +225,26 @@ void Music::UpdateLength() {
lv_label_set_text(txtTrackDuration, "Inf/Inf");
} else if (totalLength > (99 * 60)) {
char timer[12];
- sprintf(timer, "%02d:%02d/%02d:%02d",
+ sprintf(timer,
+ "%02d:%02d/%02d:%02d",
(currentLength / (60 * 60)) % 100,
((currentLength % (60 * 60)) / 60) % 100,
(totalLength / (60 * 60)) % 100,
- ((totalLength % (60 * 60)) / 60) % 100
- );
+ ((totalLength % (60 * 60)) / 60) % 100);
lv_label_set_text(txtTrackDuration, timer);
} else {
char timer[12];
- sprintf(timer, "%02d:%02d/%02d:%02d",
+ sprintf(timer,
+ "%02d:%02d/%02d:%02d",
(currentLength / 60) % 100,
(currentLength % 60) % 100,
(totalLength / 60) % 100,
- (totalLength % 60) % 100
- );
+ (totalLength % 60) % 100);
lv_label_set_text(txtTrackDuration, timer);
}
}
-void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) {
+void Music::OnObjectEvent(lv_obj_t* obj, lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
if (obj == btnVolDown) {
musicService.event(Controllers::MusicService::EVENT_MUSIC_VOLDOWN);
@@ -256,12 +255,12 @@ void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) {
} else if (obj == btnPlayPause) {
if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) {
musicService.event(Controllers::MusicService::EVENT_MUSIC_PAUSE);
-
+
// Let's assume it stops playing instantly
playing = Controllers::MusicService::NotPlaying;
} else {
musicService.event(Controllers::MusicService::EVENT_MUSIC_PLAY);
-
+
// Let's assume it starts playing instantly
// TODO: In the future should check for BT connection for better UX
playing = Controllers::MusicService::Playing;
@@ -272,14 +271,13 @@ void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) {
}
}
-
bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) {
case TouchEvents::SwipeUp: {
displayVolumeButtons = true;
lv_obj_set_hidden(btnVolDown, !displayVolumeButtons);
lv_obj_set_hidden(btnVolUp, !displayVolumeButtons);
-
+
lv_obj_set_hidden(btnNext, displayVolumeButtons);
lv_obj_set_hidden(btnPrev, displayVolumeButtons);
return true;
@@ -288,7 +286,7 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
displayVolumeButtons = false;
lv_obj_set_hidden(btnNext, displayVolumeButtons);
lv_obj_set_hidden(btnPrev, displayVolumeButtons);
-
+
lv_obj_set_hidden(btnVolDown, !displayVolumeButtons);
lv_obj_set_hidden(btnVolUp, !displayVolumeButtons);
return true;
diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h
index 55859811..ef8f1fec 100644
--- a/src/displayapp/screens/Music.h
+++ b/src/displayapp/screens/Music.h
@@ -31,44 +31,42 @@ namespace Pinetime {
namespace Screens {
class Music : public Screen {
public:
- Music(DisplayApp *app, Pinetime::Controllers::MusicService &music);
-
+ Music(DisplayApp* app, Pinetime::Controllers::MusicService& music);
+
~Music() override;
-
+
bool Refresh() override;
-
-
-
- void OnObjectEvent(lv_obj_t *obj, lv_event_t event);
-
+
+ void OnObjectEvent(lv_obj_t* obj, lv_event_t event);
+
private:
bool OnTouchEvent(TouchEvents event);
-
+
void UpdateLength();
-
- lv_obj_t *btnPrev;
- lv_obj_t *btnPlayPause;
- lv_obj_t *btnNext;
- lv_obj_t *btnVolDown;
- lv_obj_t *btnVolUp;
- lv_obj_t *txtArtist;
- lv_obj_t *txtTrack;
- lv_obj_t *txtPlayPause;
-
- lv_obj_t *imgDisc;
- lv_obj_t *imgDiscAnim;
- lv_obj_t *txtTrackDuration;
-
+
+ lv_obj_t* btnPrev;
+ lv_obj_t* btnPlayPause;
+ lv_obj_t* btnNext;
+ lv_obj_t* btnVolDown;
+ lv_obj_t* btnVolUp;
+ lv_obj_t* txtArtist;
+ lv_obj_t* txtTrack;
+ lv_obj_t* txtPlayPause;
+
+ lv_obj_t* imgDisc;
+ lv_obj_t* imgDiscAnim;
+ lv_obj_t* txtTrackDuration;
+
/** For the spinning disc animation */
bool frameB;
-
+
bool displayVolumeButtons = false;
- Pinetime::Controllers::MusicService &musicService;
-
+ Pinetime::Controllers::MusicService& musicService;
+
std::string artist;
std::string album;
std::string track;
-
+
/** Total length in seconds */
int totalLength;
/** Current length in seconds */
@@ -77,11 +75,10 @@ namespace Pinetime {
int lastLength;
/** Last time an animation update or timer was incremented */
TickType_t lastIncrement = 0;
-
+
bool playing;
-
+
/** Watchapp */
-
};
}
}
diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp
index cfe60e23..fe9b5a83 100644
--- a/src/displayapp/screens/Navigation.cpp
+++ b/src/displayapp/screens/Navigation.cpp
@@ -28,15 +28,15 @@ LV_FONT_DECLARE(lv_font_navi_80)
* Navigation watchapp
*
*/
-Navigation::Navigation(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::NavigationService &nav) : Screen(app), navService(nav) {
+Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::NavigationService& nav)
+ : Screen(app), navService(nav) {
- imgFlag = lv_label_create(lv_scr_act(), nullptr);
+ imgFlag = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_navi_80);
lv_obj_set_style_local_text_color(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
lv_label_set_text(imgFlag, iconForName("flag"));
lv_obj_align(imgFlag, nullptr, LV_ALIGN_CENTER, 0, -60);
-
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_BREAK);
lv_obj_set_width(txtNarrative, LV_HOR_RES);
@@ -50,14 +50,14 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp *app, Pinetime::Contro
lv_obj_set_width(txtManDist, LV_HOR_RES);
lv_label_set_text(txtManDist, "--M");
lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60);
+ lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60);
- //Route Progress
+ // Route Progress
barProgress = lv_bar_create(lv_scr_act(), nullptr);
lv_obj_set_size(barProgress, 200, 20);
lv_obj_align(barProgress, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -10);
lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222));
- lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_ORANGE);
+ lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_bar_set_anim_time(barProgress, 500);
lv_bar_set_range(barProgress, 0, 100);
lv_bar_set_value(barProgress, 0, LV_ANIM_OFF);
@@ -72,7 +72,7 @@ bool Navigation::Refresh() {
if (m_flag != navService.getFlag()) {
m_flag = navService.getFlag();
lv_label_set_text(imgFlag, iconForName(m_flag));
- //lv_img_set_src_arr(imgFlag, iconForName(m_flag));
+ // lv_img_set_src_arr(imgFlag, iconForName(m_flag));
}
if (m_narrative != navService.getNarrative()) {
@@ -88,10 +88,10 @@ bool Navigation::Refresh() {
if (m_progress != navService.getProgress()) {
m_progress = navService.getProgress();
lv_bar_set_value(barProgress, m_progress, LV_ANIM_OFF);
- if ( m_progress > 90 ) {
- lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_RED);
+ if (m_progress > 90) {
+ lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED);
} else {
- lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_ORANGE);
+ lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
}
}
diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h
index 53108f98..46816c33 100644
--- a/src/displayapp/screens/Navigation.h
+++ b/src/displayapp/screens/Navigation.h
@@ -23,7 +23,6 @@
#include "Screen.h"
#include <array>
-
namespace Pinetime {
namespace Controllers {
class NavigationService;
@@ -33,19 +32,18 @@ namespace Pinetime {
namespace Screens {
class Navigation : public Screen {
public:
- Navigation(DisplayApp *app, Pinetime::Controllers::NavigationService &nav);
+ Navigation(DisplayApp* app, Pinetime::Controllers::NavigationService& nav);
~Navigation() override;
bool Refresh() override;
-
- private:
- lv_obj_t *imgFlag;
- lv_obj_t *txtNarrative;
- lv_obj_t *txtManDist;
- lv_obj_t *barProgress;
+ private:
+ lv_obj_t* imgFlag;
+ lv_obj_t* txtNarrative;
+ lv_obj_t* txtManDist;
+ lv_obj_t* barProgress;
- Pinetime::Controllers::NavigationService &navService;
+ Pinetime::Controllers::NavigationService& navService;
std::string m_flag;
std::string m_narrative;
@@ -53,97 +51,97 @@ namespace Pinetime {
int m_progress;
/** Watchapp */
-
+
const char* iconForName(std::string icon);
-
- std::array<std::pair<std::string, const char*>, 89 > m_iconMap = { {
- {"arrive-left" ,"\xEE\xA4\x81" },
- {"arrive-right" ,"\xEE\xA4\x82" },
- {"arrive-straight" ,"\xEE\xA4\x80" },
- {"arrive" ,"\xEE\xA4\x80" },
- {"close" ,"\xEE\xA4\x83" },
- {"continue-left" ,"\xEE\xA4\x85" },
- {"continue-right" ,"\xEE\xA4\x86" },
- {"continue-slight-left" ,"\xEE\xA4\x87" },
- {"continue-slight-right" ,"\xEE\xA4\x88" },
- {"continue-straight" ,"\xEE\xA4\x84" },
- {"continue-uturn" ,"\xEE\xA4\x89" },
- {"continue" ,"\xEE\xA4\x84" },
- {"depart-left" ,"\xEE\xA4\x8B" },
- {"depart-right" ,"\xEE\xA4\x8C" },
- {"depart-straight" ,"\xEE\xA4\x8A" },
- {"end-of-road-left" ,"\xEE\xA4\x8D" },
- {"end-of-road-right" ,"\xEE\xA4\x8E" },
- {"ferry" ,"\xEE\xA4\x8F" },
- {"flag" ,"\xEE\xA4\x90" },
- {"fork-left" ,"\xEE\xA4\x92" },
- {"fork-right" ,"\xEE\xA4\x93" },
- {"fork-slight-left" ,"\xEE\xA4\x94" },
- {"fork-slight-right" ,"\xEE\xA4\x95" },
- {"fork-straight" ,"\xEE\xA4\x96" },
- {"invalid" ,"\xEE\xA4\x84" },
- {"invalid-left" ,"\xEE\xA4\x85" },
- {"invalid-right" ,"\xEE\xA4\x86" },
- {"invalid-slight-left" ,"\xEE\xA4\x87" },
- {"invalid-slight-right" ,"\xEE\xA4\x88" },
- {"invalid-straight" ,"\xEE\xA4\x84" },
- {"invalid-uturn" ,"\xEE\xA4\x89" },
- {"merge-left" ,"\xEE\xA4\x97" },
- {"merge-right" ,"\xEE\xA4\x98" },
- {"merge-slight-left" ,"\xEE\xA4\x99" },
- {"merge-slight-right" ,"\xEE\xA4\x9A" },
- {"merge-straight" ,"\xEE\xA4\x84" },
- {"new-name-left" ,"\xEE\xA4\x85" },
- {"new-name-right" ,"\xEE\xA4\x86" },
- {"new-name-sharp-left" ,"\xEE\xA4\x9B" },
- {"new-name-sharp-right" ,"\xEE\xA4\x9C" },
- {"new-name-slight-left" ,"\xEE\xA4\x87" },
- {"new-name-slight-right" ,"\xEE\xA4\x88" },
- {"new-name-straight" ,"\xEE\xA4\x84" },
- {"notification-left" ,"\xEE\xA4\x85" },
- {"notification-right" ,"\xEE\xA4\x86" },
- {"notification-sharp-left" ,"\xEE\xA4\x9B" },
- {"notification-sharp-right" ,"\xEE\xA4\xA5" },
- {"notification-slight-left" ,"\xEE\xA4\x87" },
- {"notification-slight-right" ,"\xEE\xA4\x88" },
- {"notification-straight" ,"\xEE\xA4\x84" },
- {"off-ramp-left" ,"\xEE\xA4\x9D" },
- {"off-ramp-right" ,"\xEE\xA4\x9E" },
- {"off-ramp-slight-left" ,"\xEE\xA4\x9F" },
- {"off-ramp-slight-right" ,"\xEE\xA4\xA0" },
- {"on-ramp-left" ,"\xEE\xA4\x85" },
- {"on-ramp-right" ,"\xEE\xA4\x86" },
- {"on-ramp-sharp-left" ,"\xEE\xA4\x9B" },
- {"on-ramp-sharp-right" ,"\xEE\xA4\xA5" },
- {"on-ramp-slight-left" ,"\xEE\xA4\x87" },
- {"on-ramp-slight-right" ,"\xEE\xA4\x88" },
- {"on-ramp-straight" ,"\xEE\xA4\x84" },
- {"rotary" ,"\xEE\xA4\xA1" },
- {"rotary-left" ,"\xEE\xA4\xA2" },
- {"rotary-right" ,"\xEE\xA4\xA3" },
- {"rotary-sharp-left" ,"\xEE\xA4\xA4" },
- {"rotary-sharp-right" ,"\xEE\xA4\xA5" },
- {"rotary-slight-left" ,"\xEE\xA4\xA6" },
- {"rotary-slight-right" ,"\xEE\xA4\xA7" },
- {"rotary-straight" ,"\xEE\xA4\xA8" },
- {"roundabout" ,"\xEE\xA4\xA1" },
- {"roundabout-left" ,"\xEE\xA4\xA2" },
- {"roundabout-right" ,"\xEE\xA4\xA3" },
- {"roundabout-sharp-left" ,"\xEE\xA4\xA4" },
- {"roundabout-sharp-right" ,"\xEE\xA4\xA5" },
- {"roundabout-slight-left" ,"\xEE\xA4\xA6" },
- {"roundabout-slight-right" ,"\xEE\xA4\xA7" },
- {"roundabout-straight" ,"\xEE\xA4\xA8" },
- {"turn-left" ,"\xEE\xA4\x85" },
- {"turn-right" ,"\xEE\xA4\x86" },
- {"turn-sharp-left" ,"\xEE\xA4\x9B" },
- {"turn-sharp-right" ,"\xEE\xA4\xA5" },
- {"turn-slight-left" ,"\xEE\xA4\x87" },
- {"turn-slight-right" ,"\xEE\xA4\x88" },
- {"turn-straight" ,"\xEE\xA4\x84" },
- {"updown" ,"\xEE\xA4\xA9" },
- {"uturn" ,"\xEE\xA4\x89" },
- } };
+
+ std::array<std::pair<std::string, const char*>, 89> m_iconMap = {{
+ {"arrive-left", "\xEE\xA4\x81"},
+ {"arrive-right", "\xEE\xA4\x82"},
+ {"arrive-straight", "\xEE\xA4\x80"},
+ {"arrive", "\xEE\xA4\x80"},
+ {"close", "\xEE\xA4\x83"},
+ {"continue-left", "\xEE\xA4\x85"},
+ {"continue-right", "\xEE\xA4\x86"},
+ {"continue-slight-left", "\xEE\xA4\x87"},
+ {"continue-slight-right", "\xEE\xA4\x88"},
+ {"continue-straight", "\xEE\xA4\x84"},
+ {"continue-uturn", "\xEE\xA4\x89"},
+ {"continue", "\xEE\xA4\x84"},
+ {"depart-left", "\xEE\xA4\x8B"},
+ {"depart-right", "\xEE\xA4\x8C"},
+ {"depart-straight", "\xEE\xA4\x8A"},
+ {"end-of-road-left", "\xEE\xA4\x8D"},
+ {"end-of-road-right", "\xEE\xA4\x8E"},
+ {"ferry", "\xEE\xA4\x8F"},
+ {"flag", "\xEE\xA4\x90"},
+ {"fork-left", "\xEE\xA4\x92"},
+ {"fork-right", "\xEE\xA4\x93"},
+ {"fork-slight-left", "\xEE\xA4\x94"},
+ {"fork-slight-right", "\xEE\xA4\x95"},
+ {"fork-straight", "\xEE\xA4\x96"},
+ {"invalid", "\xEE\xA4\x84"},
+ {"invalid-left", "\xEE\xA4\x85"},
+ {"invalid-right", "\xEE\xA4\x86"},
+ {"invalid-slight-left", "\xEE\xA4\x87"},
+ {"invalid-slight-right", "\xEE\xA4\x88"},
+ {"invalid-straight", "\xEE\xA4\x84"},
+ {"invalid-uturn", "\xEE\xA4\x89"},
+ {"merge-left", "\xEE\xA4\x97"},
+ {"merge-right", "\xEE\xA4\x98"},
+ {"merge-slight-left", "\xEE\xA4\x99"},
+ {"merge-slight-right", "\xEE\xA4\x9A"},
+ {"merge-straight", "\xEE\xA4\x84"},
+ {"new-name-left", "\xEE\xA4\x85"},
+ {"new-name-right", "\xEE\xA4\x86"},
+ {"new-name-sharp-left", "\xEE\xA4\x9B"},
+ {"new-name-sharp-right", "\xEE\xA4\x9C"},
+ {"new-name-slight-left", "\xEE\xA4\x87"},
+ {"new-name-slight-right", "\xEE\xA4\x88"},
+ {"new-name-straight", "\xEE\xA4\x84"},
+ {"notification-left", "\xEE\xA4\x85"},
+ {"notification-right", "\xEE\xA4\x86"},
+ {"notification-sharp-left", "\xEE\xA4\x9B"},
+ {"notification-sharp-right", "\xEE\xA4\xA5"},
+ {"notification-slight-left", "\xEE\xA4\x87"},
+ {"notification-slight-right", "\xEE\xA4\x88"},
+ {"notification-straight", "\xEE\xA4\x84"},
+ {"off-ramp-left", "\xEE\xA4\x9D"},
+ {"off-ramp-right", "\xEE\xA4\x9E"},
+ {"off-ramp-slight-left", "\xEE\xA4\x9F"},
+ {"off-ramp-slight-right", "\xEE\xA4\xA0"},
+ {"on-ramp-left", "\xEE\xA4\x85"},
+ {"on-ramp-right", "\xEE\xA4\x86"},
+ {"on-ramp-sharp-left", "\xEE\xA4\x9B"},
+ {"on-ramp-sharp-right", "\xEE\xA4\xA5"},
+ {"on-ramp-slight-left", "\xEE\xA4\x87"},
+ {"on-ramp-slight-right", "\xEE\xA4\x88"},
+ {"on-ramp-straight", "\xEE\xA4\x84"},
+ {"rotary", "\xEE\xA4\xA1"},
+ {"rotary-left", "\xEE\xA4\xA2"},
+ {"rotary-right", "\xEE\xA4\xA3"},
+ {"rotary-sharp-left", "\xEE\xA4\xA4"},
+ {"rotary-sharp-right", "\xEE\xA4\xA5"},
+ {"rotary-slight-left", "\xEE\xA4\xA6"},
+ {"rotary-slight-right", "\xEE\xA4\xA7"},
+ {"rotary-straight", "\xEE\xA4\xA8"},
+ {"roundabout", "\xEE\xA4\xA1"},
+ {"roundabout-left", "\xEE\xA4\xA2"},
+ {"roundabout-right", "\xEE\xA4\xA3"},
+ {"roundabout-sharp-left", "\xEE\xA4\xA4"},
+ {"roundabout-sharp-right", "\xEE\xA4\xA5"},
+ {"roundabout-slight-left", "\xEE\xA4\xA6"},
+ {"roundabout-slight-right", "\xEE\xA4\xA7"},
+ {"roundabout-straight", "\xEE\xA4\xA8"},
+ {"turn-left", "\xEE\xA4\x85"},
+ {"turn-right", "\xEE\xA4\x86"},
+ {"turn-sharp-left", "\xEE\xA4\x9B"},
+ {"turn-sharp-right", "\xEE\xA4\xA5"},
+ {"turn-slight-left", "\xEE\xA4\x87"},
+ {"turn-slight-right", "\xEE\xA4\x88"},
+ {"turn-straight", "\xEE\xA4\x84"},
+ {"updown", "\xEE\xA4\xA9"},
+ {"uturn", "\xEE\xA4\x89"},
+ }};
};
}
}
diff --git a/src/displayapp/screens/NotificationIcon.cpp b/src/displayapp/screens/NotificationIcon.cpp
index 64898c2c..d8792f9d 100644
--- a/src/displayapp/screens/NotificationIcon.cpp
+++ b/src/displayapp/screens/NotificationIcon.cpp
@@ -3,6 +3,8 @@
using namespace Pinetime::Applications::Screens;
const char* NotificationIcon::GetIcon(bool newNotificationAvailable) {
- if(newNotificationAvailable) return Symbols::info;
- else return "";
+ if (newNotificationAvailable)
+ return Symbols::info;
+ else
+ return "";
} \ No newline at end of file
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 33cebe86..f0fd2f66 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -8,34 +8,34 @@ using namespace Pinetime::Applications::Screens;
extern lv_font_t jetbrains_mono_extrabold_compressed;
extern lv_font_t jetbrains_mono_bold_20;
-Notifications::Notifications(DisplayApp *app,
- Pinetime::Controllers::NotificationManager &notificationManager,
+Notifications::Notifications(DisplayApp* app,
+ Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
- Modes mode) :
- Screen(app), notificationManager{notificationManager}, alertNotificationService{alertNotificationService}, mode{mode} {
+ Modes mode)
+ : Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, mode {mode} {
notificationManager.ClearNewNotificationFlag();
auto notification = notificationManager.GetLastNotification();
- if(notification.valid) {
+ if (notification.valid) {
currentId = notification.id;
currentItem = std::make_unique<NotificationItem>(notification.Title(),
- notification.Message(),
- notification.index,
- notification.category,
- notificationManager.NbNotifications(),
- mode,
- alertNotificationService);
+ notification.Message(),
+ notification.index,
+ notification.category,
+ notificationManager.NbNotifications(),
+ mode,
+ alertNotificationService);
validDisplay = true;
} else {
currentItem = std::make_unique<NotificationItem>("Notification",
- "No notification to display",
- 0,
- notification.category,
- notificationManager.NbNotifications(),
- Modes::Preview,
- alertNotificationService);
+ "No notification to display",
+ 0,
+ notification.category,
+ notificationManager.NbNotifications(),
+ Modes::Preview,
+ alertNotificationService);
}
- if(mode == Modes::Preview) {
+ if (mode == Modes::Preview) {
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
@@ -45,7 +45,7 @@ Notifications::Notifications(DisplayApp *app,
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
timeoutTickCountStart = xTaskGetTickCount();
- timeoutTickCountEnd = timeoutTickCountStart + (5*1024);
+ timeoutTickCountEnd = timeoutTickCountStart + (5 * 1024);
}
}
@@ -68,34 +68,36 @@ bool Notifications::Refresh() {
}
bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- if(mode != Modes::Normal) return true;
+ if (mode != Modes::Normal)
+ return true;
switch (event) {
case Pinetime::Applications::TouchEvents::SwipeDown: {
Controllers::NotificationManager::Notification previousNotification;
- if(validDisplay)
+ if (validDisplay)
previousNotification = notificationManager.GetPrevious(currentId);
else
previousNotification = notificationManager.GetLastNotification();
- if (!previousNotification.valid) return true;
+ if (!previousNotification.valid)
+ return true;
validDisplay = true;
currentId = previousNotification.id;
currentItem.reset(nullptr);
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
currentItem = std::make_unique<NotificationItem>(previousNotification.Title(),
- previousNotification.Message(),
- previousNotification.index,
- previousNotification.category,
- notificationManager.NbNotifications(),
- mode,
- alertNotificationService);
+ previousNotification.Message(),
+ previousNotification.index,
+ previousNotification.category,
+ notificationManager.NbNotifications(),
+ mode,
+ alertNotificationService);
}
return true;
case Pinetime::Applications::TouchEvents::SwipeUp: {
Controllers::NotificationManager::Notification nextNotification;
- if(validDisplay)
+ if (validDisplay)
nextNotification = notificationManager.GetNext(currentId);
else
nextNotification = notificationManager.GetLastNotification();
@@ -110,16 +112,16 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
currentItem.reset(nullptr);
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
currentItem = std::make_unique<NotificationItem>(nextNotification.Title(),
- nextNotification.Message(),
- nextNotification.index,
- nextNotification.category,
- notificationManager.NbNotifications(),
- mode,
- alertNotificationService);
+ nextNotification.Message(),
+ nextNotification.index,
+ nextNotification.category,
+ notificationManager.NbNotifications(),
+ mode,
+ alertNotificationService);
}
return true;
case Pinetime::Applications::TouchEvents::LongTap: {
- //notificationManager.ToggleVibrations();
+ // notificationManager.ToggleVibrations();
return true;
}
default:
@@ -138,20 +140,20 @@ namespace {
item->OnMuteIncomingCall(event);
}
- static void RejectIncomingCallEventHandler(lv_obj_t *obj, lv_event_t event) {
- auto* item = static_cast<Notifications::NotificationItem *>(obj->user_data);
+ static void RejectIncomingCallEventHandler(lv_obj_t* obj, lv_event_t event) {
+ auto* item = static_cast<Notifications::NotificationItem*>(obj->user_data);
item->OnRejectIncomingCall(event);
}
}
- Notifications::NotificationItem::NotificationItem(const char *title,
- const char *msg,
- uint8_t notifNr,
- Controllers::NotificationManager::Categories category,
- uint8_t notifNb,
- Modes mode,
- Pinetime::Controllers::AlertNotificationService& alertNotificationService)
- : notifNr{notifNr}, notifNb{notifNb}, mode{mode}, alertNotificationService{alertNotificationService} {
+Notifications::NotificationItem::NotificationItem(const char* title,
+ const char* msg,
+ uint8_t notifNr,
+ Controllers::NotificationManager::Categories category,
+ uint8_t notifNb,
+ Modes mode,
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService)
+ : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService} {
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
@@ -172,20 +174,20 @@ namespace {
lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888));
- if(title == nullptr) title = "Notification";
+ if (title == nullptr)
+ title = "Notification";
lv_label_set_text(alert_type, title);
lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16);
/////////
- switch(category) {
+ switch (category) {
default: {
lv_obj_t* alert_subject = lv_label_create(container1, nullptr);
lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_long_mode(alert_subject, LV_LABEL_LONG_BREAK);
lv_obj_set_width(alert_subject, LV_HOR_RES - 20);
lv_label_set_text(alert_subject, msg);
- }
- break;
+ } break;
case Controllers::NotificationManager::Categories::IncomingCall: {
lv_obj_t* alert_subject = lv_label_create(container1, nullptr);
lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
@@ -234,8 +236,7 @@ namespace {
label_mute = lv_label_create(bt_mute, nullptr);
lv_label_set_text(label_mute, Symbols::volumMute);
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- }
- break;
+ } break;
}
lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
@@ -246,19 +247,22 @@ namespace {
}
void Notifications::NotificationItem::OnAcceptIncomingCall(lv_event_t event) {
- if (event != LV_EVENT_CLICKED) return;
+ if (event != LV_EVENT_CLICKED)
+ return;
alertNotificationService.AcceptIncomingCall();
}
void Notifications::NotificationItem::OnMuteIncomingCall(lv_event_t event) {
- if (event != LV_EVENT_CLICKED) return;
+ if (event != LV_EVENT_CLICKED)
+ return;
alertNotificationService.MuteIncomingCall();
}
void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
- if (event != LV_EVENT_CLICKED) return;
+ if (event != LV_EVENT_CLICKED)
+ return;
alertNotificationService.RejectIncomingCall();
}
diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h
index 0d54ddbe..51ca81da 100644
--- a/src/displayapp/screens/Notifications.h
+++ b/src/displayapp/screens/Notifications.h
@@ -14,19 +14,30 @@ namespace Pinetime {
namespace Screens {
class Notifications : public Screen {
- public:
- enum class Modes {Normal, Preview};
- explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::AlertNotificationService& alertNotificationService, Modes mode);
- ~Notifications() override;
+ public:
+ enum class Modes { Normal, Preview };
+ explicit Notifications(DisplayApp* app,
+ Pinetime::Controllers::NotificationManager& notificationManager,
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService,
+ Modes mode);
+ ~Notifications() override;
- bool Refresh() override;
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ bool Refresh() override;
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
class NotificationItem {
public:
- NotificationItem(const char* title, const char* msg, uint8_t notifNr, Controllers::NotificationManager::Categories, uint8_t notifNb, Modes mode, Pinetime::Controllers::AlertNotificationService& alertNotificationService);
+ NotificationItem(const char* title,
+ const char* msg,
+ uint8_t notifNr,
+ Controllers::NotificationManager::Categories,
+ uint8_t notifNb,
+ Modes mode,
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService);
~NotificationItem();
- bool Refresh() {return false;}
+ bool Refresh() {
+ return false;
+ }
void OnAcceptIncomingCall(lv_event_t event);
void OnMuteIncomingCall(lv_event_t event);
void OnRejectIncomingCall(lv_event_t event);
@@ -49,28 +60,24 @@ namespace Pinetime {
lv_obj_t* bottomPlaceholder;
Modes mode;
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
-
-
};
- private:
-
-
- struct NotificationData {
- const char* title;
- const char* text;
- };
- Pinetime::Controllers::NotificationManager& notificationManager;
- Pinetime::Controllers::AlertNotificationService& alertNotificationService;
- Modes mode = Modes::Normal;
- std::unique_ptr<NotificationItem> currentItem;
- Controllers::NotificationManager::Notification::Id currentId;
- bool validDisplay = false;
+ private:
+ struct NotificationData {
+ const char* title;
+ const char* text;
+ };
+ Pinetime::Controllers::NotificationManager& notificationManager;
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService;
+ Modes mode = Modes::Normal;
+ std::unique_ptr<NotificationItem> currentItem;
+ Controllers::NotificationManager::Notification::Id currentId;
+ bool validDisplay = false;
- lv_point_t timeoutLinePoints[2] { {0, 1}, {239, 1} };
- lv_obj_t* timeoutLine;
- uint32_t timeoutTickCountStart;
- uint32_t timeoutTickCountEnd;
+ lv_point_t timeoutLinePoints[2] {{0, 1}, {239, 1}};
+ lv_obj_t* timeoutLine;
+ uint32_t timeoutTickCountStart;
+ uint32_t timeoutTickCountEnd;
};
}
}
diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp
index e86cf01b..161f175b 100644
--- a/src/displayapp/screens/Paddle.cpp
+++ b/src/displayapp/screens/Paddle.cpp
@@ -4,124 +4,96 @@
using namespace Pinetime::Applications::Screens;
-namespace{
-const uint8_t paddle_map[] = {
- 0xfc, 0xfe, 0xfc, 0xff, /*Color of index 0*/
- 0xff, 0xff, 0xff, 0xff, /*Color of index 1*/
-
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
-};
-
-const uint8_t ball_map[] = {
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
-};
+namespace {
+ const uint8_t paddle_map[] = {
+ 0xfc, 0xfe, 0xfc, 0xff, /*Color of index 0*/
+ 0xff, 0xff, 0xff, 0xff, /*Color of index 1*/
+
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
+
+ const uint8_t ball_map[] = {
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ };
}
-Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} {
+Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} {
app->SetTouchMode(DisplayApp::TouchModes::Polling);
-
+
points = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(points, "0000");
lv_obj_set_style_local_text_color(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x444444));
lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 0);
-
+
paddle.header.always_zero = 0;
paddle.header.w = 4;
paddle.header.h = 60;
paddle.data_size = 68;
paddle.header.cf = LV_IMG_CF_INDEXED_1BIT;
- paddle.data = paddle_map;
+ paddle.data = paddle_map;
paddle_image = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src(paddle_image, &paddle);
-
+
ball.header.always_zero = 0;
ball.header.w = 24;
ball.header.h = 24;
ball.data_size = 24 * 24 * LV_COLOR_SIZE / 8;
ball.header.cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
- ball.data = ball_map;
+ ball.data = ball_map;
ball_image = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src(ball_image, &ball);
}
@@ -133,51 +105,54 @@ Paddle::~Paddle() {
}
bool Paddle::Refresh() {
- if((counter++ % 5) == 0){
- counter = 0;
-
+ if ((counter++ % 5) == 0) {
+ counter = 0;
+
ballX += dx;
- ballY += dy;
-
+ ballY += dy;
+
lv_obj_set_pos(ball_image, ballX, ballY);
-
- //checks if it has touched the sides (floor and ceiling)
- if(ballY <= 0 || ballY >= 215){
+
+ // checks if it has touched the sides (floor and ceiling)
+ if (ballY <= 0 || ballY >= 215) {
dy *= -1;
}
-
- //checks if it has touched the side (left side)
- if(ballX >= 215){
- dx *= -1;
+
+ // checks if it has touched the side (left side)
+ if (ballX >= 215) {
+ dx *= -1;
+ }
+
+ // checks if it is in the position of the paddle
+ if (ballY <= (paddleBottomY + 16) && ballY >= (paddleTopY - 8)) {
+ if (ballX >= 0 && ballX < 4) {
+ lv_obj_set_pos(ball_image, 5, ballY);
+ dx *= -1;
+ score++;
+ }
}
-
- //checks if it is in the position of the paddle
- if(ballY <= (paddleBottomY + 16) && ballY >= (paddleTopY - 8)){
- if(ballX >= 0 && ballX < 4){
- lv_obj_set_pos(ball_image, 5, ballY);
- dx *= -1;
- score++;
- }
- }
-
- //checks if it has gone behind the paddle
- else if(ballX <= -40){
+
+ // checks if it has gone behind the paddle
+ else if (ballX <= -40) {
ballX = 107;
- ballY = 107;
- score = 0;
+ ballY = 107;
+ score = 0;
}
lv_label_set_text_fmt(points, "%04d", score);
- }
+ }
return running;
}
-bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- return true;
+bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
+ return true;
}
bool Paddle::OnTouchEvent(uint16_t x, uint16_t y) {
- lv_obj_set_pos(paddle_image, 0, y - 30); // sets the center paddle pos. (30px offset) with the the y_coordinate of the finger and defaults the x_coordinate to 0
- paddleTopY = y - 30; // refreshes the upper extreme of the paddle
- paddleBottomY = y + 30; // refreshes the lower extreme of the paddle
+ lv_obj_set_pos(
+ paddle_image,
+ 0,
+ y - 30); // sets the center paddle pos. (30px offset) with the the y_coordinate of the finger and defaults the x_coordinate to 0
+ paddleTopY = y - 30; // refreshes the upper extreme of the paddle
+ paddleBottomY = y + 30; // refreshes the lower extreme of the paddle
return true;
}
diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h
index 453d99ae..e133244f 100644
--- a/src/displayapp/screens/Paddle.h
+++ b/src/displayapp/screens/Paddle.h
@@ -11,39 +11,37 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class Paddle : public Screen{
- public:
- Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
- ~Paddle() override;
-
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
- bool OnTouchEvent(uint16_t x, uint16_t y) override;
-
- private:
- Pinetime::Components::LittleVgl& lvgl;
-
- int paddleBottomY = 90; // bottom extreme of the paddle
- int paddleTopY = 150; //top extreme of the paddle
-
- int ballX = 107; // Initial x_coordinate for the ball (12px offset from the center to counteract the ball's 24px size)
- int ballY = 107; // Initial y_coordinate for the ball
-
- int dx = 2; // Velocity of the ball in the x_coordinate
- int dy = 3; // Velocity of the ball in the y_coordinate
-
- int counter = 0; // init Frame refresh limit counter
- int score = 0;
-
- lv_img_dsc_t paddle;
- lv_img_dsc_t ball;
-
- lv_obj_t* points;
- lv_obj_t* paddle_image; // pointer to paddle image
- lv_obj_t* ball_image; // pointer to ball image
-
-
+ class Paddle : public Screen {
+ public:
+ Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
+ ~Paddle() override;
+
+ bool Refresh() override;
+
+ bool OnTouchEvent(TouchEvents event) override;
+ bool OnTouchEvent(uint16_t x, uint16_t y) override;
+
+ private:
+ Pinetime::Components::LittleVgl& lvgl;
+
+ int paddleBottomY = 90; // bottom extreme of the paddle
+ int paddleTopY = 150; // top extreme of the paddle
+
+ int ballX = 107; // Initial x_coordinate for the ball (12px offset from the center to counteract the ball's 24px size)
+ int ballY = 107; // Initial y_coordinate for the ball
+
+ int dx = 2; // Velocity of the ball in the x_coordinate
+ int dy = 3; // Velocity of the ball in the y_coordinate
+
+ int counter = 0; // init Frame refresh limit counter
+ int score = 0;
+
+ lv_img_dsc_t paddle;
+ lv_img_dsc_t ball;
+
+ lv_obj_t* points;
+ lv_obj_t* paddle_image; // pointer to paddle image
+ lv_obj_t* ball_image; // pointer to ball image
};
}
}
diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h
index cf4f6994..8e49c9de 100644
--- a/src/displayapp/screens/Screen.h
+++ b/src/displayapp/screens/Screen.h
@@ -8,56 +8,68 @@ namespace Pinetime {
class DisplayApp;
namespace Screens {
- template <class T>
- class DirtyValue {
- public:
- DirtyValue() = default; // Use NSDMI
- explicit DirtyValue(T const& v):value{v}{} // Use MIL and const-lvalue-ref
- bool IsUpdated() const { return isUpdated; }
- T const& Get() { this->isUpdated = false; return value; } // never expose a non-const lvalue-ref
- DirtyValue& operator=(const T& other) {
- if (this->value != other) {
- this->value = other;
- this->isUpdated = true;
- }
- return *this;
+ template <class T> class DirtyValue {
+ public:
+ DirtyValue() = default; // Use NSDMI
+ explicit DirtyValue(T const& v) : value {v} {
+ } // Use MIL and const-lvalue-ref
+ bool IsUpdated() const {
+ return isUpdated;
+ }
+ T const& Get() {
+ this->isUpdated = false;
+ return value;
+ } // never expose a non-const lvalue-ref
+ DirtyValue& operator=(const T& other) {
+ if (this->value != other) {
+ this->value = other;
+ this->isUpdated = true;
}
- private:
- T value{}; // NSDMI - default initialise type
- bool isUpdated{true}; // NSDMI - use brace initilisation
+ return *this;
+ }
+
+ private:
+ T value {}; // NSDMI - default initialise type
+ bool isUpdated {true}; // NSDMI - use brace initilisation
};
-
- class Screen {
- public:
- explicit Screen(DisplayApp* app) : app{app} {}
- virtual ~Screen() = default;
- /**
- * Most of the time, apps only react to events (touch events, for example).
- * In this case you don't need to do anything in this method.
- *
- * For example, InfiniPaint does nothing in Refresh().
- * But, if you want to update your display periodically, draw an animation...
- * you cannot do it in a touch event handler because these handlers are not
- * called if the user does not touch the screen.
- *
- * That's why Refresh() is there: update the display periodically.
- *
- * @return false if the app can be closed, true if it must continue to run
- **/
- virtual bool Refresh() = 0;
+ class Screen {
+ public:
+ explicit Screen(DisplayApp* app) : app {app} {
+ }
+ virtual ~Screen() = default;
- /** @return false if the button hasn't been handled by the app, true if it has been handled */
- virtual bool OnButtonPushed() { return false; }
+ /**
+ * Most of the time, apps only react to events (touch events, for example).
+ * In this case you don't need to do anything in this method.
+ *
+ * For example, InfiniPaint does nothing in Refresh().
+ * But, if you want to update your display periodically, draw an animation...
+ * you cannot do it in a touch event handler because these handlers are not
+ * called if the user does not touch the screen.
+ *
+ * That's why Refresh() is there: update the display periodically.
+ *
+ * @return false if the app can be closed, true if it must continue to run
+ **/
+ virtual bool Refresh() = 0;
- /** @return false if the event hasn't been handled by the app, true if it has been handled */
- virtual bool OnTouchEvent(TouchEvents event) { return false; }
- virtual bool OnTouchEvent(uint16_t x, uint16_t y) { return false; }
+ /** @return false if the button hasn't been handled by the app, true if it has been handled */
+ virtual bool OnButtonPushed() {
+ return false;
+ }
- protected:
- DisplayApp* app;
- bool running = true;
+ /** @return false if the event hasn't been handled by the app, true if it has been handled */
+ virtual bool OnTouchEvent(TouchEvents event) {
+ return false;
+ }
+ virtual bool OnTouchEvent(uint16_t x, uint16_t y) {
+ return false;
+ }
+ protected:
+ DisplayApp* app;
+ bool running = true;
};
}
}
diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h
index 23bcd98b..73ea4610 100644
--- a/src/displayapp/screens/ScreenList.h
+++ b/src/displayapp/screens/ScreenList.h
@@ -10,100 +10,98 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- enum class ScreenListModes {UpDown, RightLeft, LongPress};
- template <size_t N>
- class ScreenList : public Screen {
- public:
+ enum class ScreenListModes { UpDown, RightLeft, LongPress };
+ template <size_t N> class ScreenList : public Screen {
+ public:
+ ScreenList(DisplayApp* app,
+ uint8_t initScreen,
+ std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens,
+ ScreenListModes mode)
+ : Screen(app), initScreen {initScreen}, screens {std::move(screens)}, mode {mode}, current {this->screens[initScreen]()} {
+ screenIndex = initScreen;
+ }
- ScreenList(DisplayApp* app, uint8_t initScreen, std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens, ScreenListModes mode)
- : Screen(app), initScreen{initScreen}, screens{std::move(screens)}, mode{mode}, current{this->screens[initScreen]()} {
- screenIndex = initScreen;
- }
+ ~ScreenList() override {
+ lv_obj_clean(lv_scr_act());
+ }
- ~ScreenList() override {
- lv_obj_clean(lv_scr_act());
- }
+ bool Refresh() override {
+ running = current->Refresh();
+ return running;
+ }
- bool Refresh() override {
- running = current->Refresh();
- return running;
- }
+ bool OnTouchEvent(TouchEvents event) override {
- bool OnTouchEvent(TouchEvents event) override {
-
- if ( mode == ScreenListModes::UpDown) {
- switch (event) {
- case TouchEvents::SwipeDown:
- if (screenIndex > 0) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
- screenIndex--;
- current = screens[screenIndex]();
- return true;
- } else {
- return false;
- }
-
- case TouchEvents::SwipeUp:
- if (screenIndex < screens.size() - 1) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
- screenIndex++;
- current = screens[screenIndex]();
- }
+ if (mode == ScreenListModes::UpDown) {
+ switch (event) {
+ case TouchEvents::SwipeDown:
+ if (screenIndex > 0) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
+ screenIndex--;
+ current = screens[screenIndex]();
return true;
- default:
+ } else {
return false;
- }
- } else if ( mode == ScreenListModes::RightLeft) {
- switch (event) {
- case TouchEvents::SwipeRight:
- if (screenIndex > 0) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
- screenIndex--;
- current = screens[screenIndex]();
- return true;
- } else {
- return false;
- }
-
- case TouchEvents::SwipeLeft:
- if (screenIndex < screens.size() - 1) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
- screenIndex++;
- current = screens[screenIndex]();
- }
+ }
+
+ case TouchEvents::SwipeUp:
+ if (screenIndex < screens.size() - 1) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
+ screenIndex++;
+ current = screens[screenIndex]();
+ }
+ return true;
+ default:
+ return false;
+ }
+ } else if (mode == ScreenListModes::RightLeft) {
+ switch (event) {
+ case TouchEvents::SwipeRight:
+ if (screenIndex > 0) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
+ screenIndex--;
+ current = screens[screenIndex]();
return true;
- default:
+ } else {
return false;
- }
- } else if ( event == TouchEvents::LongTap ) {
- if (screenIndex < screens.size() - 1) {
- screenIndex++;
- } else {
- screenIndex = 0;
- }
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
- current = screens[screenIndex]();
- return true;
- }
+ }
- return false;
+ case TouchEvents::SwipeLeft:
+ if (screenIndex < screens.size() - 1) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
+ screenIndex++;
+ current = screens[screenIndex]();
+ }
+ return true;
+ default:
+ return false;
+ }
+ } else if (event == TouchEvents::LongTap) {
+ if (screenIndex < screens.size() - 1) {
+ screenIndex++;
+ } else {
+ screenIndex = 0;
+ }
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
+ current = screens[screenIndex]();
+ return true;
}
- private:
-
- uint8_t initScreen = 0;
- std::array<std::function<std::unique_ptr<Screen>()>, N> screens;
- ScreenListModes mode = ScreenListModes::UpDown;
+ return false;
+ }
- uint8_t screenIndex = 0;
- std::unique_ptr<Screen> current;
+ private:
+ uint8_t initScreen = 0;
+ std::array<std::function<std::unique_ptr<Screen>()>, N> screens;
+ ScreenListModes mode = ScreenListModes::UpDown;
-
+ uint8_t screenIndex = 0;
+ std::unique_ptr<Screen> current;
};
}
}
diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp
index 371b4e6c..e06981af 100644
--- a/src/displayapp/screens/StopWatch.cpp
+++ b/src/displayapp/screens/StopWatch.cpp
@@ -46,8 +46,16 @@ static void stop_lap_event_handler(lv_obj_t* obj, lv_event_t event) {
}
StopWatch::StopWatch(DisplayApp* app)
- : Screen(app), running {true}, currentState {States::Init}, currentEvent {Events::Stop}, startTime {}, oldTimeElapsed {},
- currentTimeSeparated {}, lapBuffer {}, lapNr {}, lapPressed {false} {
+ : Screen(app),
+ running {true},
+ currentState {States::Init},
+ currentEvent {Events::Stop},
+ startTime {},
+ oldTimeElapsed {},
+ currentTimeSeparated {},
+ lapBuffer {},
+ lapNr {},
+ lapPressed {false} {
time = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
@@ -56,7 +64,7 @@ StopWatch::StopWatch(DisplayApp* app)
lv_obj_align(time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -45);
msecTime = lv_label_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
+ // lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(msecTime, "00");
lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 108, 3);
@@ -70,13 +78,13 @@ StopWatch::StopWatch(DisplayApp* app)
lv_label_set_text(txtPlayPause, Symbols::play);
lapOneText = lv_label_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
+ // lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapOneText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 30);
lv_label_set_text(lapOneText, "");
lapTwoText = lv_label_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
+ // lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapTwoText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 55);
lv_label_set_text(lapTwoText, "");
@@ -145,10 +153,12 @@ bool StopWatch::Refresh() {
if (lapPressed == true) {
if (lapBuffer[1]) {
- lv_label_set_text_fmt(lapOneText, "#2%d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->hundredths);
+ lv_label_set_text_fmt(
+ lapOneText, "#%2d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->hundredths);
}
if (lapBuffer[0]) {
- lv_label_set_text_fmt(lapTwoText, "#2%d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths);
+ lv_label_set_text_fmt(
+ lapTwoText, "#%2d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths);
}
// Reset the bool to avoid setting the text in each cycle until there is a change
lapPressed = false;
diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h
index 0750f2c1..e60825c1 100644
--- a/src/displayapp/screens/Symbols.h
+++ b/src/displayapp/screens/Symbols.h
@@ -26,7 +26,7 @@ namespace Pinetime {
static constexpr const char* paintbrush = "\xEF\x87\xBC";
static constexpr const char* paddle = "\xEF\x91\x9D";
static constexpr const char* map = "\xEF\x96\xa0";
- static constexpr const char* qrcode = "\xEF\x80\xa9";
+ static constexpr const char* qrcode = "\xEF\x80\xa9";
static constexpr const char* phone = "\xEF\x82\x95";
static constexpr const char* phoneSlash = "\xEF\x8F\x9D";
static constexpr const char* volumMute = "\xEF\x9A\xA9";
@@ -41,19 +41,18 @@ namespace Pinetime {
static constexpr const char* lapsFlag = "\xEF\x80\xA4";
// lv_font_sys_48.c
- static constexpr const char* settings = "\xEE\xA4\x82";//e902
+ static constexpr const char* settings = "\xEE\xA4\x82"; // e902
- static constexpr const char* brightnessHigh = "\xEE\xA4\x84";//e904
- static constexpr const char* brightnessLow = "\xEE\xA4\x85";//e905
- static constexpr const char* brightnessMedium = "\xEE\xA4\x86";//e906
+ static constexpr const char* brightnessHigh = "\xEE\xA4\x84"; // e904
+ static constexpr const char* brightnessLow = "\xEE\xA4\x85"; // e905
+ static constexpr const char* brightnessMedium = "\xEE\xA4\x86"; // e906
- static constexpr const char* notificationsOff = "\xEE\xA4\x8B";//e90b
- static constexpr const char* notificationsOn = "\xEE\xA4\x8C";//e90c
+ static constexpr const char* notificationsOff = "\xEE\xA4\x8B"; // e90b
+ static constexpr const char* notificationsOn = "\xEE\xA4\x8C"; // e90c
- static constexpr const char* highlight = "\xEE\xA4\x87";//e907
+ static constexpr const char* highlight = "\xEE\xA4\x87"; // e907
}
}
}
}
-
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index 48dba547..f6e8d61a 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -11,27 +11,37 @@
using namespace Pinetime::Applications::Screens;
-SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::DateTime &dateTimeController,
+SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
Pinetime::Controllers::Battery& batteryController,
Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::Ble& bleController,
- Pinetime::Drivers::WatchdogView& watchdog) :
- Screen(app),
- dateTimeController{dateTimeController}, batteryController{batteryController},
- brightnessController{brightnessController}, bleController{bleController}, watchdog{watchdog},
- screens{app,
- 0,
- {
- [this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen2(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen3(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen4(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen5(); }
- },
- Screens::ScreenListModes::UpDown
- } {}
-
+ Pinetime::Drivers::WatchdogView& watchdog)
+ : Screen(app),
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ brightnessController {brightnessController},
+ bleController {bleController},
+ watchdog {watchdog},
+ screens {app,
+ 0,
+ {[this]() -> std::unique_ptr<Screen> {
+ return CreateScreen1();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen2();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen3();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen4();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen5();
+ }},
+ Screens::ScreenListModes::UpDown} {
+}
SystemInfo::~SystemInfo() {
lv_obj_clean(lv_scr_act());
@@ -54,16 +64,19 @@ bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
- lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
- lv_label_set_text_fmt(label,
- "#FFFF00 InfiniTime#\n\n"
- "#444444 Version# %ld.%ld.%ld\n\n"
- "#444444 Build date#\n"
- "\t%s\n"
- "\t%s\n",
- Version::Major(), Version::Minor(), Version::Patch(),
- __DATE__, __TIME__);
+ lv_label_set_text_fmt(label,
+ "#FFFF00 InfiniTime#\n\n"
+ "#444444 Version# %ld.%ld.%ld\n\n"
+ "#444444 Build date#\n"
+ "\t%s\n"
+ "\t%s\n",
+ Version::Major(),
+ Version::Minor(),
+ Version::Patch(),
+ __DATE__,
+ __TIME__);
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
@@ -75,22 +88,32 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
auto resetReason = [this]() {
switch (watchdog.ResetReason()) {
- case Drivers::Watchdog::ResetReasons::Watchdog: return "wtdg";
- case Drivers::Watchdog::ResetReasons::HardReset: return "hardr";
- case Drivers::Watchdog::ResetReasons::NFC: return "nfc";
- case Drivers::Watchdog::ResetReasons::SoftReset: return "softr";
- case Drivers::Watchdog::ResetReasons::CpuLockup: return "cpulock";
- case Drivers::Watchdog::ResetReasons::SystemOff: return "off";
- case Drivers::Watchdog::ResetReasons::LpComp: return "lpcomp";
- case Drivers::Watchdog::ResetReasons::DebugInterface: return "dbg";
- case Drivers::Watchdog::ResetReasons::ResetPin: return "rst";
- default: return "?";
+ case Drivers::Watchdog::ResetReasons::Watchdog:
+ return "wtdg";
+ case Drivers::Watchdog::ResetReasons::HardReset:
+ return "hardr";
+ case Drivers::Watchdog::ResetReasons::NFC:
+ return "nfc";
+ case Drivers::Watchdog::ResetReasons::SoftReset:
+ return "softr";
+ case Drivers::Watchdog::ResetReasons::CpuLockup:
+ return "cpulock";
+ case Drivers::Watchdog::ResetReasons::SystemOff:
+ return "off";
+ case Drivers::Watchdog::ResetReasons::LpComp:
+ return "lpcomp";
+ case Drivers::Watchdog::ResetReasons::DebugInterface:
+ return "dbg";
+ case Drivers::Watchdog::ResetReasons::ResetPin:
+ return "rst";
+ default:
+ return "?";
}
}();
// uptime
- static constexpr uint32_t secondsInADay = 60*60*24;
- static constexpr uint32_t secondsInAnHour = 60*60;
+ static constexpr uint32_t secondsInADay = 60 * 60 * 24;
+ static constexpr uint32_t secondsInAnHour = 60 * 60;
static constexpr uint32_t secondsInAMinute = 60;
uint32_t uptimeSeconds = dateTimeController.Uptime().count();
uint32_t uptimeDays = (uptimeSeconds / secondsInADay);
@@ -101,67 +124,83 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
uptimeSeconds = uptimeSeconds % secondsInAMinute;
// TODO handle more than 100 days of uptime
- if (batteryPercent == -1) batteryPercent = 0;
+ if (batteryPercent == -1)
+ batteryPercent = 0;
// hack to not use the flot functions from printf
uint8_t batteryVoltageBytes[2];
- batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); //truncate whole numbers
- batteryVoltageBytes[0] = static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over
+ batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers
+ batteryVoltageBytes[0] =
+ static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over
//
- lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
- lv_label_set_text_fmt(label,
- "#444444 Date# %02d/%02d/%04d\n"
- "#444444 Time# %02d:%02d:%02d\n"
- "#444444 Uptime#\n %02lud %02lu:%02lu:%02lu\n"
- "#444444 Battery# %d%%/%1i.%02iv\n"
- "#444444 Backlight# %s\n"
- "#444444 Last reset# %s\n",
- dateTimeController.Day(), static_cast<uint8_t>(dateTimeController.Month()), dateTimeController.Year(),
- dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(),
- uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds,
- batteryPercent, batteryVoltageBytes[1], batteryVoltageBytes[0], brightnessController.ToString(), resetReason
- );
+ lv_label_set_text_fmt(label,
+ "#444444 Date# %02d/%02d/%04d\n"
+ "#444444 Time# %02d:%02d:%02d\n"
+ "#444444 Uptime#\n %02lud %02lu:%02lu:%02lu\n"
+ "#444444 Battery# %d%%/%1i.%02iv\n"
+ "#444444 Backlight# %s\n"
+ "#444444 Last reset# %s\n",
+ dateTimeController.Day(),
+ static_cast<uint8_t>(dateTimeController.Month()),
+ dateTimeController.Year(),
+ dateTimeController.Hours(),
+ dateTimeController.Minutes(),
+ dateTimeController.Seconds(),
+ uptimeDays,
+ uptimeHours,
+ uptimeMinutes,
+ uptimeSeconds,
+ batteryPercent,
+ batteryVoltageBytes[1],
+ batteryVoltageBytes[0],
+ brightnessController.ToString(),
+ resetReason);
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
return std::unique_ptr<Screen>(new Screens::Label(1, 4, app, label));
-
}
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
lv_mem_monitor_t mon;
- lv_mem_monitor(&mon);
-
- lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr);
+ lv_mem_monitor(&mon);
+
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
auto& bleAddr = bleController.Address();
- lv_label_set_text_fmt(label,
- "#444444 BLE MAC#\n"
- " %02x:%02x:%02x:%02x:%02x:%02x"
- "\n"
- "#444444 Memory#\n"
- " #444444 used# %d (%d%%)\n"
- " #444444 frag# %d%%\n"
- " #444444 free# %d"
- "\n"
- "#444444 Steps# %li",
- bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0],
- (int)mon.total_size - mon.free_size,
- mon.used_pct,
- mon.frag_pct,
- (int)mon.free_biggest_size,
- 0
- );
+ lv_label_set_text_fmt(label,
+ "#444444 BLE MAC#\n"
+ " %02x:%02x:%02x:%02x:%02x:%02x"
+ "\n"
+ "#444444 Memory#\n"
+ " #444444 used# %d (%d%%)\n"
+ " #444444 frag# %d%%\n"
+ " #444444 free# %d"
+ "\n"
+ "#444444 Steps# %li",
+ bleAddr[5],
+ bleAddr[4],
+ bleAddr[3],
+ bleAddr[2],
+ bleAddr[1],
+ bleAddr[0],
+ (int) mon.total_size - mon.free_size,
+ mon.used_pct,
+ mon.frag_pct,
+ (int) mon.free_biggest_size,
+ 0);
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
return std::unique_ptr<Screen>(new Screens::Label(2, 5, app, label));
}
-
-bool sortById(const TaskStatus_t &lhs, const TaskStatus_t &rhs) { return lhs.xTaskNumber < rhs.xTaskNumber; }
+bool sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) {
+ return lhs.xTaskNumber < rhs.xTaskNumber;
+}
std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
TaskStatus_t tasksStatus[7];
- lv_obj_t * infoTask = lv_table_create(lv_scr_act(), NULL);
+ lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL);
lv_table_set_col_cnt(infoTask, 3);
lv_table_set_row_cnt(infoTask, 8);
lv_obj_set_pos(infoTask, 10, 10);
@@ -176,31 +215,30 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
auto nb = uxTaskGetSystemState(tasksStatus, 7, nullptr);
std::sort(tasksStatus, tasksStatus + nb, sortById);
for (uint8_t i = 0; i < nb; i++) {
-
+
lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str());
- lv_table_set_cell_value(infoTask, i + 1, 1, tasksStatus[i].pcTaskName);
+ lv_table_set_cell_value(infoTask, i + 1, 1, tasksStatus[i].pcTaskName);
if (tasksStatus[i].usStackHighWaterMark < 20) {
std::string str1 = std::to_string(tasksStatus[i].usStackHighWaterMark) + " low";
lv_table_set_cell_value(infoTask, i + 1, 2, str1.c_str());
} else {
lv_table_set_cell_value(infoTask, i + 1, 2, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str());
}
-
}
return std::unique_ptr<Screen>(new Screens::Label(3, 5, app, infoTask));
}
std::unique_ptr<Screen> SystemInfo::CreateScreen5() {
- lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
lv_label_set_text_static(label,
- "Software Licensed\n"
- "under the terms of\n"
- "the GNU General\n"
- "Public License v3\n"
- "#444444 Source code#\n"
- "#FFFF00 https://github.com/#\n"
- "#FFFF00 JF002/InfiniTime#");
+ "Software Licensed\n"
+ "under the terms of\n"
+ "the GNU General\n"
+ "Public License v3\n"
+ "#444444 Source code#\n"
+ "#FFFF00 https://github.com/#\n"
+ "#FFFF00 JF002/InfiniTime#");
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
return std::unique_ptr<Screen>(new Screens::Label(4, 5, app, label));
diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h
index f5f50a42..c0c65554 100644
--- a/src/displayapp/screens/SystemInfo.h
+++ b/src/displayapp/screens/SystemInfo.h
@@ -21,33 +21,33 @@ namespace Pinetime {
namespace Screens {
class SystemInfo : public Screen {
- public:
- explicit SystemInfo(DisplayApp* app,
- Pinetime::Controllers::DateTime& dateTimeController,
- Pinetime::Controllers::Battery& batteryController,
- Pinetime::Controllers::BrightnessController& brightnessController,
- Pinetime::Controllers::Ble& bleController,
- Pinetime::Drivers::WatchdogView& watchdog);
- ~SystemInfo() override;
- bool Refresh() override;
- bool OnButtonPushed() override;
- bool OnTouchEvent(TouchEvents event) override;
- private:
- bool running = true;
-
- Pinetime::Controllers::DateTime& dateTimeController;
- Pinetime::Controllers::Battery& batteryController;
- Pinetime::Controllers::BrightnessController& brightnessController;
- Pinetime::Controllers::Ble& bleController;
- Pinetime::Drivers::WatchdogView& watchdog;
-
- ScreenList<5> screens;
- std::unique_ptr<Screen> CreateScreen1();
- std::unique_ptr<Screen> CreateScreen2();
- std::unique_ptr<Screen> CreateScreen3();
- std::unique_ptr<Screen> CreateScreen4();
- std::unique_ptr<Screen> CreateScreen5();
-
+ public:
+ explicit SystemInfo(DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
+ Pinetime::Controllers::Battery& batteryController,
+ Pinetime::Controllers::BrightnessController& brightnessController,
+ Pinetime::Controllers::Ble& bleController,
+ Pinetime::Drivers::WatchdogView& watchdog);
+ ~SystemInfo() override;
+ bool Refresh() override;
+ bool OnButtonPushed() override;
+ bool OnTouchEvent(TouchEvents event) override;
+
+ private:
+ bool running = true;
+
+ Pinetime::Controllers::DateTime& dateTimeController;
+ Pinetime::Controllers::Battery& batteryController;
+ Pinetime::Controllers::BrightnessController& brightnessController;
+ Pinetime::Controllers::Ble& bleController;
+ Pinetime::Drivers::WatchdogView& watchdog;
+
+ ScreenList<5> screens;
+ std::unique_ptr<Screen> CreateScreen1();
+ std::unique_ptr<Screen> CreateScreen2();
+ std::unique_ptr<Screen> CreateScreen3();
+ std::unique_ptr<Screen> CreateScreen4();
+ std::unique_ptr<Screen> CreateScreen5();
};
}
}
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index b1dfaf76..ec36af38 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -4,37 +4,35 @@
using namespace Pinetime::Applications::Screens;
-
namespace {
- static void lv_update_task(struct _lv_task_t *task) {
- auto user_data = static_cast<Tile *>(task->user_data);
+ static void lv_update_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<Tile*>(task->user_data);
user_data->UpdateScreen();
}
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- Tile* screen = static_cast<Tile *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ Tile* screen = static_cast<Tile*>(obj->user_data);
uint32_t* eventDataPtr = (uint32_t*) lv_event_get_data();
uint32_t eventData = *eventDataPtr;
screen->OnObjectEvent(obj, event, eventData);
}
}
-Tile::Tile(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings& settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- std::array<Applications, 6>& applications) :
- Screen(app),
- batteryController{batteryController},
- dateTimeController{dateTimeController} {
-
+Tile::Tile(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ std::array<Applications, 6>& applications)
+ : Screen(app), batteryController {batteryController}, dateTimeController {dateTimeController} {
+
settingsController.SetAppMenu(screenID);
// Time
- label_time = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
- lv_label_set_align( label_time, LV_LABEL_ALIGN_CENTER );
+ label_time = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label_time, nullptr, LV_ALIGN_IN_TOP_LEFT, 15, 6);
// Battery
@@ -42,19 +40,18 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens,
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 6);
- if ( numScreens > 1 ) {
+ if (numScreens > 1) {
pageIndicatorBasePoints[0].x = 240 - 1;
pageIndicatorBasePoints[0].y = 6;
pageIndicatorBasePoints[1].x = 240 - 1;
pageIndicatorBasePoints[1].y = 240 - 6;
-
+
pageIndicatorBase = lv_line_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2);
-
uint16_t indicatorSize = 228 / numScreens;
uint16_t indicatorPos = indicatorSize * screenID;
@@ -69,11 +66,12 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens,
lv_obj_set_style_local_line_rounded(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);
}
-
+
uint8_t btIndex = 0;
- for(uint8_t i = 0; i < 6; i++) {
- if(i == 3) btnmMap[btIndex++] = "\n";
- if ( applications[i].application == Apps::None ) {
+ for (uint8_t i = 0; i < 6; i++) {
+ if (i == 3)
+ btnmMap[btIndex++] = "\n";
+ if (applications[i].application == Apps::None) {
btnmMap[btIndex] = " ";
} else {
btnmMap[btIndex] = applications[i].icon;
@@ -94,16 +92,16 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens,
lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, LV_OPA_20);
lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111));
- for(uint8_t i = 0; i < 6; i++) {
- if ( applications[i].application == Apps::None ) {
- lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED );
+ for (uint8_t i = 0; i < 6; i++) {
+ if (applications[i].application == Apps::None) {
+ lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED);
}
}
btnm1->user_data = this;
lv_obj_set_event_cb(btnm1, event_handler);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
@@ -118,7 +116,7 @@ Tile::~Tile() {
}
void Tile::UpdateScreen() {
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
@@ -126,11 +124,9 @@ bool Tile::Refresh() {
return running;
}
-void Tile::OnObjectEvent(lv_obj_t *obj, lv_event_t event, uint32_t buttonId) {
- if(event == LV_EVENT_VALUE_CHANGED) {
+void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
running = false;
}
}
-
-
diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h
index 54ffcdae..4ebd81cd 100644
--- a/src/displayapp/screens/Tile.h
+++ b/src/displayapp/screens/Tile.h
@@ -14,42 +14,42 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class Tile : public Screen {
- public:
- struct Applications {
- const char* icon;
- Pinetime::Applications::Apps application;
- };
-
- explicit Tile(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings& settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- std::array<Applications, 6>& applications);
-
- ~Tile() override;
-
- bool Refresh() override;
- void UpdateScreen();
- void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId);
-
- private:
-
- Pinetime::Controllers::Battery& batteryController;
- Controllers::DateTime& dateTimeController;
-
- lv_task_t* taskUpdate;
-
- lv_obj_t* label_time;
- lv_obj_t* batteryIcon;
- lv_point_t pageIndicatorBasePoints[2];
- lv_point_t pageIndicatorPoints[2];
- lv_obj_t* pageIndicatorBase;
- lv_obj_t* pageIndicator;
- lv_obj_t* btnm1;
-
- const char* btnmMap[8];
- Pinetime::Applications::Apps apps[6];
+ public:
+ struct Applications {
+ const char* icon;
+ Pinetime::Applications::Apps application;
+ };
+
+ explicit Tile(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ std::array<Applications, 6>& applications);
+
+ ~Tile() override;
+
+ bool Refresh() override;
+ void UpdateScreen();
+ void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId);
+
+ private:
+ Pinetime::Controllers::Battery& batteryController;
+ Controllers::DateTime& dateTimeController;
+
+ lv_task_t* taskUpdate;
+
+ lv_obj_t* label_time;
+ lv_obj_t* batteryIcon;
+ lv_point_t pageIndicatorBasePoints[2];
+ lv_point_t pageIndicatorPoints[2];
+ lv_obj_t* pageIndicatorBase;
+ lv_obj_t* pageIndicator;
+ lv_obj_t* btnm1;
+
+ const char* btnmMap[8];
+ Pinetime::Applications::Apps apps[6];
};
}
}
diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp
index bbee5e11..eb268077 100644
--- a/src/displayapp/screens/Twos.cpp
+++ b/src/displayapp/screens/Twos.cpp
@@ -8,7 +8,7 @@
using namespace Pinetime::Applications::Screens;
-Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
+Twos::Twos(Pinetime::Applications::DisplayApp* app) : Screen(app) {
// create styles to apply to different valued tiles
lv_style_init(&style_cell1);
@@ -50,8 +50,8 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
lv_style_set_pad_top(&style_cell5, LV_STATE_DEFAULT, 25);
// format grid display
-
- gridDisplay = lv_table_create(lv_scr_act(), nullptr);
+
+ gridDisplay = lv_table_create(lv_scr_act(), nullptr);
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL1, &style_cell1);
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL2, &style_cell2);
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL3, &style_cell3);
@@ -59,17 +59,17 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL4 + 1, &style_cell5);
lv_table_set_col_cnt(gridDisplay, 4);
lv_table_set_row_cnt(gridDisplay, 4);
- lv_table_set_col_width(gridDisplay, 0, LV_HOR_RES/4);
- lv_table_set_col_width(gridDisplay, 1, LV_HOR_RES/4);
- lv_table_set_col_width(gridDisplay, 2, LV_HOR_RES/4);
- lv_table_set_col_width(gridDisplay, 3, LV_HOR_RES/4);
+ lv_table_set_col_width(gridDisplay, 0, LV_HOR_RES / 4);
+ lv_table_set_col_width(gridDisplay, 1, LV_HOR_RES / 4);
+ lv_table_set_col_width(gridDisplay, 2, LV_HOR_RES / 4);
+ lv_table_set_col_width(gridDisplay, 3, LV_HOR_RES / 4);
lv_obj_align(gridDisplay, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_clean_style_list(gridDisplay, LV_TABLE_PART_BG);
// initialize grid
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
grid[row][col].value = 0;
lv_table_set_cell_type(gridDisplay, row, col, 1);
lv_table_set_cell_align(gridDisplay, row, col, LV_LABEL_ALIGN_CENTER);
@@ -86,7 +86,7 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
lv_label_set_recolor(scoreText, true);
lv_label_set_text_fmt(scoreText, "Score #FFFF00 %i#", score);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
@@ -107,10 +107,10 @@ bool Twos::Refresh() {
}
bool Twos::placeNewTile() {
- std::vector< std::pair <int,int> > availableCells;
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
- if(!grid[row][col].value) {
+ std::vector<std::pair<int, int>> availableCells;
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
+ if (!grid[row][col].value) {
availableCells.push_back(std::make_pair(row, col));
}
}
@@ -119,22 +119,24 @@ bool Twos::placeNewTile() {
if (availableCells.size() == 0) {
return false; // game lost
}
-
+
auto it = availableCells.cbegin();
int random = rand() % availableCells.size();
std::advance(it, random);
- std::pair <int,int> newCell = *it;
+ std::pair<int, int> newCell = *it;
- if ((rand() % 100) < 90) grid[newCell.first][newCell.second].value = 2;
- else grid[newCell.first][newCell.second].value = 4;
+ if ((rand() % 100) < 90)
+ grid[newCell.first][newCell.second].value = 2;
+ else
+ grid[newCell.first][newCell.second].value = 4;
updateGridDisplay(grid);
return true;
}
-bool Twos::tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int oldCol) {
- if((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) {
- if((newCol != oldCol) || (newRow != oldRow)) {
- if(!grid[newRow][newCol].merged) {
+bool Twos::tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) {
+ if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) {
+ if ((newCol != oldCol) || (newRow != oldRow)) {
+ if (!grid[newRow][newCol].merged) {
unsigned int newVal = grid[oldRow][oldCol].value *= 2;
grid[newRow][newCol].value = newVal;
score += newVal;
@@ -149,7 +151,7 @@ bool Twos::tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int ol
}
bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol) {
- if(((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) {
+ if (((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) {
grid[newRow][newCol].value = grid[oldRow][oldCol].value;
grid[oldRow][oldCol].value = 0;
return true;
@@ -159,27 +161,28 @@ bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCo
bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
bool validMove = false;
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
grid[row][col].merged = false; // reinitialize merge state
}
}
- switch(event) {
+ switch (event) {
case TouchEvents::SwipeLeft:
- for(int col = 1; col < 4; col++) { // ignore tiles already on far left
- for(int row = 0; row < 4; row++) {
- if(grid[row][col].value) {
+ for (int col = 1; col < 4; col++) { // ignore tiles already on far left
+ for (int row = 0; row < 4; row++) {
+ if (grid[row][col].value) {
int newCol = -1;
- for(int potentialNewCol = col - 1; potentialNewCol >= 0; potentialNewCol--) {
- if(!grid[row][potentialNewCol].value) {
+ for (int potentialNewCol = col - 1; potentialNewCol >= 0; potentialNewCol--) {
+ if (!grid[row][potentialNewCol].value) {
newCol = potentialNewCol;
- }
- else { // blocked by another tile
- if(tryMerge(grid, row, potentialNewCol, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, row, potentialNewCol, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, row, newCol, row, col)) validMove = true;
+ if (tryMove(grid, row, newCol, row, col))
+ validMove = true;
}
}
}
@@ -188,20 +191,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
return true;
case TouchEvents::SwipeRight:
- for(int col = 2; col >= 0; col--) { // ignore tiles already on far right
- for(int row = 0; row < 4; row++) {
- if(grid[row][col].value) {
+ for (int col = 2; col >= 0; col--) { // ignore tiles already on far right
+ for (int row = 0; row < 4; row++) {
+ if (grid[row][col].value) {
int newCol = -1;
- for(int potentialNewCol = col + 1; potentialNewCol < 4; potentialNewCol++) {
- if(!grid[row][potentialNewCol].value) {
+ for (int potentialNewCol = col + 1; potentialNewCol < 4; potentialNewCol++) {
+ if (!grid[row][potentialNewCol].value) {
newCol = potentialNewCol;
- }
- else { // blocked by another tile
- if(tryMerge(grid, row, potentialNewCol, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, row, potentialNewCol, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, row, newCol, row, col)) validMove = true;
+ if (tryMove(grid, row, newCol, row, col))
+ validMove = true;
}
}
}
@@ -210,20 +214,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
return true;
case TouchEvents::SwipeUp:
- for(int row = 1; row < 4; row++) { // ignore tiles already on top
- for(int col = 0; col < 4; col++) {
- if(grid[row][col].value) {
+ for (int row = 1; row < 4; row++) { // ignore tiles already on top
+ for (int col = 0; col < 4; col++) {
+ if (grid[row][col].value) {
int newRow = -1;
- for(int potentialNewRow = row - 1; potentialNewRow >= 0; potentialNewRow--) {
- if(!grid[potentialNewRow][col].value) {
+ for (int potentialNewRow = row - 1; potentialNewRow >= 0; potentialNewRow--) {
+ if (!grid[potentialNewRow][col].value) {
newRow = potentialNewRow;
- }
- else { // blocked by another tile
- if(tryMerge(grid, potentialNewRow, col, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, potentialNewRow, col, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, newRow, col, row, col)) validMove = true;
+ if (tryMove(grid, newRow, col, row, col))
+ validMove = true;
}
}
}
@@ -232,20 +237,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
return true;
case TouchEvents::SwipeDown:
- for(int row = 2; row >=0; row--) { // ignore tiles already on bottom
- for(int col = 0; col < 4; col++) {
- if(grid[row][col].value) {
+ for (int row = 2; row >= 0; row--) { // ignore tiles already on bottom
+ for (int col = 0; col < 4; col++) {
+ if (grid[row][col].value) {
int newRow = -1;
- for(int potentialNewRow = row + 1; potentialNewRow < 4; potentialNewRow++) {
- if(!grid[potentialNewRow][col].value) {
+ for (int potentialNewRow = row + 1; potentialNewRow < 4; potentialNewRow++) {
+ if (!grid[potentialNewRow][col].value) {
newRow = potentialNewRow;
- }
- else { // blocked by another tile
- if(tryMerge(grid, potentialNewRow, col, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, potentialNewRow, col, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, newRow, col, row, col)) validMove = true;
+ if (tryMove(grid, newRow, col, row, col))
+ validMove = true;
}
}
}
@@ -260,12 +266,11 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
void Twos::updateGridDisplay(Tile grid[][4]) {
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
if (grid[row][col].value) {
lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str());
- }
- else {
+ } else {
lv_table_set_cell_value(gridDisplay, row, col, "");
}
switch (grid[row][col].value) {
diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h
index 7223c7a8..3367618f 100644
--- a/src/displayapp/screens/Twos.h
+++ b/src/displayapp/screens/Twos.h
@@ -11,30 +11,28 @@ namespace Pinetime {
};
namespace Screens {
class Twos : public Screen {
- public:
- Twos(DisplayApp* app);
- ~Twos() override;
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
+ public:
+ Twos(DisplayApp* app);
+ ~Twos() override;
+ bool Refresh() override;
- private:
+ bool OnTouchEvent(TouchEvents event) override;
- lv_style_t style_cell1;
- lv_style_t style_cell2;
- lv_style_t style_cell3;
- lv_style_t style_cell4;
- lv_style_t style_cell5;
-
-
- lv_obj_t *scoreText;
- lv_obj_t *gridDisplay;
- Tile grid[4][4];
- unsigned int score = 0;
- void updateGridDisplay(Tile grid[][4]);
- bool tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int oldCol);
- bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
- bool placeNewTile();
+ private:
+ lv_style_t style_cell1;
+ lv_style_t style_cell2;
+ lv_style_t style_cell3;
+ lv_style_t style_cell4;
+ lv_style_t style_cell5;
+
+ lv_obj_t* scoreText;
+ lv_obj_t* gridDisplay;
+ Tile grid[4][4];
+ unsigned int score = 0;
+ void updateGridDisplay(Tile grid[][4]);
+ bool tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol);
+ bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
+ bool placeNewTile();
};
}
}
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp
index 66af584a..02f1fc2a 100644
--- a/src/displayapp/screens/WatchFaceAnalog.cpp
+++ b/src/displayapp/screens/WatchFaceAnalog.cpp
@@ -14,44 +14,45 @@ using namespace Pinetime::Applications::Screens;
#define HOUR_LENGTH 70
#define MINUTE_LENGTH 90
#define SECOND_LENGTH 110
-#define PI 3.14159265358979323846
+#define PI 3.14159265358979323846
// ##
-static int16_t coordinate_x_relocate(int16_t x)
-{
- return ((x) + LV_HOR_RES / 2);
+static int16_t coordinate_x_relocate(int16_t x) {
+ return ((x) + LV_HOR_RES / 2);
}
// ##
-static int16_t coordinate_y_relocate(int16_t y)
-{
- return (((y) - LV_HOR_RES / 2) < 0) ? (0 - ((y) - LV_HOR_RES / 2)) : ((y) - LV_HOR_RES / 2);
+static int16_t coordinate_y_relocate(int16_t y) {
+ return (((y) -LV_HOR_RES / 2) < 0) ? (0 - ((y) -LV_HOR_RES / 2)) : ((y) -LV_HOR_RES / 2);
}
-WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController) : Screen(app), currentDateTime{{}},
- dateTimeController{dateTimeController}, batteryController{batteryController},
- bleController{bleController}, notificatioManager{notificatioManager},
- settingsController{settingsController} {
+WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController)
+ : Screen(app),
+ currentDateTime {{}},
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ bleController {bleController},
+ notificatioManager {notificatioManager},
+ settingsController {settingsController} {
settingsController.SetClockFace(1);
sHour = 99;
sMinute = 99;
- sSecond = 99;
-
- lv_obj_t * bg_clock_img = lv_img_create(lv_scr_act(), NULL);
+ sSecond = 99;
+
+ lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(bg_clock_img, &bg_clock);
lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
- batteryIcon = lv_label_create(lv_scr_act(), nullptr);
+ batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(batteryIcon, Symbols::batteryHalf);
lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -8, -4);
-
notificationIcon = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
@@ -61,17 +62,16 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
label_date_day = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xf0a500));
- lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
- lv_label_set_align( label_date_day, LV_LABEL_ALIGN_CENTER );
- lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0);
-
+ lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
+ lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0);
+
minute_body = lv_line_create(lv_scr_act(), NULL);
minute_body_trace = lv_line_create(lv_scr_act(), NULL);
- hour_body = lv_line_create(lv_scr_act(), NULL);
- hour_body_trace = lv_line_create(lv_scr_act(), NULL);
+ hour_body = lv_line_create(lv_scr_act(), NULL);
+ hour_body_trace = lv_line_create(lv_scr_act(), NULL);
second_body = lv_line_create(lv_scr_act(), NULL);
-
lv_style_init(&second_line_style);
lv_style_set_line_width(&second_line_style, LV_STATE_DEFAULT, 3);
lv_style_set_line_color(&second_line_style, LV_STATE_DEFAULT, LV_COLOR_RED);
@@ -90,7 +90,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
lv_style_set_line_rounded(&minute_line_style_trace, LV_STATE_DEFAULT, false);
lv_obj_add_style(minute_body_trace, LV_LINE_PART_MAIN, &minute_line_style_trace);
-
lv_style_init(&hour_line_style);
lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 7);
lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE);
@@ -104,7 +103,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace);
UpdateClock();
-
}
WatchFaceAnalog::~WatchFaceAnalog() {
@@ -114,17 +112,17 @@ WatchFaceAnalog::~WatchFaceAnalog() {
lv_style_reset(&minute_line_style);
lv_style_reset(&minute_line_style_trace);
lv_style_reset(&second_line_style);
-
+
lv_obj_clean(lv_scr_act());
}
void WatchFaceAnalog::UpdateClock() {
-
+
hour = dateTimeController.Hours();
minute = dateTimeController.Minutes();
- second = dateTimeController.Seconds();
+ second = dateTimeController.Seconds();
- if(sMinute != minute) {
+ if (sMinute != minute) {
minute_point[0].x = coordinate_x_relocate(30 * sin(minute * 6 * PI / 180));
minute_point[0].y = coordinate_y_relocate(30 * cos(minute * 6 * PI / 180));
minute_point[1].x = coordinate_x_relocate(MINUTE_LENGTH * sin(minute * 6 * PI / 180));
@@ -134,40 +132,38 @@ void WatchFaceAnalog::UpdateClock() {
minute_point_trace[0].y = coordinate_y_relocate(5 * cos(minute * 6 * PI / 180));
minute_point_trace[1].x = coordinate_x_relocate(31 * sin(minute * 6 * PI / 180));
minute_point_trace[1].y = coordinate_y_relocate(31 * cos(minute * 6 * PI / 180));
-
+
lv_line_set_points(minute_body, minute_point, 2);
lv_line_set_points(minute_body_trace, minute_point_trace, 2);
}
- if(sHour != hour || sMinute != minute) {
+ if (sHour != hour || sMinute != minute) {
sHour = hour;
sMinute = minute;
- hour_point[0].x = coordinate_x_relocate(30 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point[0].y = coordinate_y_relocate(30 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point[1].x = coordinate_x_relocate(HOUR_LENGTH * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point[1].y = coordinate_y_relocate(HOUR_LENGTH * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
-
- hour_point_trace[0].x = coordinate_x_relocate(5 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point_trace[0].y = coordinate_y_relocate(5 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point_trace[1].x = coordinate_x_relocate(31 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point_trace[1].y = coordinate_y_relocate(31 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
-
- lv_line_set_points(hour_body, hour_point, 2);
- lv_line_set_points(hour_body_trace, hour_point_trace, 2);
+ hour_point[0].x = coordinate_x_relocate(30 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point[0].y = coordinate_y_relocate(30 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point[1].x = coordinate_x_relocate(HOUR_LENGTH * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point[1].y = coordinate_y_relocate(HOUR_LENGTH * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+
+ hour_point_trace[0].x = coordinate_x_relocate(5 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point_trace[0].y = coordinate_y_relocate(5 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point_trace[1].x = coordinate_x_relocate(31 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point_trace[1].y = coordinate_y_relocate(31 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+
+ lv_line_set_points(hour_body, hour_point, 2);
+ lv_line_set_points(hour_body_trace, hour_point_trace, 2);
}
- if(sSecond != second) {
+ if (sSecond != second) {
sSecond = second;
second_point[0].x = coordinate_x_relocate(20 * sin((180 + second * 6) * PI / 180));
second_point[0].y = coordinate_y_relocate(20 * cos((180 + second * 6) * PI / 180));
second_point[1].x = coordinate_x_relocate(SECOND_LENGTH * sin(second * 6 * PI / 180));
second_point[1].y = coordinate_y_relocate(SECOND_LENGTH * cos(second * 6 * PI / 180));
lv_line_set_points(second_body, second_point, 2);
-
}
}
-
bool WatchFaceAnalog::Refresh() {
batteryPercentRemaining = batteryController.PercentRemaining();
@@ -176,11 +172,10 @@ bool WatchFaceAnalog::Refresh() {
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
}
-
notificationState = notificatioManager.AreNewNotificationsAvailable();
- if(notificationState.IsUpdated()) {
- if(notificationState.Get() == true)
+ if (notificationState.IsUpdated()) {
+ if (notificationState.Get() == true)
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
else
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
@@ -188,17 +183,17 @@ bool WatchFaceAnalog::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
- if(currentDateTime.IsUpdated()) {
-
+ if (currentDateTime.IsUpdated()) {
+
month = dateTimeController.Month();
day = dateTimeController.Day();
dayOfWeek = dateTimeController.DayOfWeek();
UpdateClock();
-
+
if ((month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
- lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day);
+ lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day);
currentMonth = month;
currentDayOfWeek = dayOfWeek;
diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h
index 56b086ab..667f6241 100644
--- a/src/displayapp/screens/WatchFaceAnalog.h
+++ b/src/displayapp/screens/WatchFaceAnalog.h
@@ -22,68 +22,67 @@ namespace Pinetime {
namespace Screens {
class WatchFaceAnalog : public Screen {
- public:
- WatchFaceAnalog(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController);
-
- ~WatchFaceAnalog() override;
+ public:
+ WatchFaceAnalog(DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController);
- bool Refresh() override;
+ ~WatchFaceAnalog() override;
- private:
- uint8_t sHour, sMinute, sSecond;
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
+ bool Refresh() override;
- Pinetime::Controllers::DateTime::Months month;
- uint8_t day;
- Pinetime::Controllers::DateTime::Days dayOfWeek;
+ private:
+ uint8_t sHour, sMinute, sSecond;
+ uint8_t hour;
+ uint8_t minute;
+ uint8_t second;
- Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
- Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
- uint8_t currentDay = 0;
+ Pinetime::Controllers::DateTime::Months month;
+ uint8_t day;
+ Pinetime::Controllers::DateTime::Days dayOfWeek;
- DirtyValue<float> batteryPercentRemaining {0};
- DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
- DirtyValue<bool> notificationState {false};
+ Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
+ Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
+ uint8_t currentDay = 0;
- lv_obj_t *hour_body;
- lv_obj_t *hour_body_trace;
- lv_obj_t *minute_body;
- lv_obj_t *minute_body_trace;
- lv_obj_t *second_body;
+ DirtyValue<float> batteryPercentRemaining {0};
+ DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
+ DirtyValue<bool> notificationState {false};
- // ##
- lv_point_t hour_point[2];
- lv_point_t hour_point_trace[2];
- lv_point_t minute_point[2];
- lv_point_t minute_point_trace[2];
- lv_point_t second_point[2];
+ lv_obj_t* hour_body;
+ lv_obj_t* hour_body_trace;
+ lv_obj_t* minute_body;
+ lv_obj_t* minute_body_trace;
+ lv_obj_t* second_body;
- // ##
- lv_style_t hour_line_style;
- lv_style_t hour_line_style_trace;
- lv_style_t minute_line_style;
- lv_style_t minute_line_style_trace;
- lv_style_t second_line_style;
-
- lv_obj_t* label_date_day;
- lv_obj_t* batteryIcon;
- lv_obj_t* notificationIcon;
-
+ // ##
+ lv_point_t hour_point[2];
+ lv_point_t hour_point_trace[2];
+ lv_point_t minute_point[2];
+ lv_point_t minute_point_trace[2];
+ lv_point_t second_point[2];
- Controllers::DateTime& dateTimeController;
- Controllers::Battery& batteryController;
- Controllers::Ble& bleController;
- Controllers::NotificationManager& notificatioManager;
- Controllers::Settings& settingsController;
+ // ##
+ lv_style_t hour_line_style;
+ lv_style_t hour_line_style_trace;
+ lv_style_t minute_line_style;
+ lv_style_t minute_line_style_trace;
+ lv_style_t second_line_style;
- void UpdateClock();
+ lv_obj_t* label_date_day;
+ lv_obj_t* batteryIcon;
+ lv_obj_t* notificationIcon;
+
+ Controllers::DateTime& dateTimeController;
+ Controllers::Battery& batteryController;
+ Controllers::Ble& bleController;
+ Controllers::NotificationManager& notificatioManager;
+ Controllers::Settings& settingsController;
+
+ void UpdateClock();
};
}
}
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 15f73e8b..bf078d03 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -17,20 +17,23 @@
using namespace Pinetime::Applications::Screens;
-
WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController) : Screen(app), currentDateTime{{}},
- dateTimeController{dateTimeController}, batteryController{batteryController},
- bleController{bleController}, notificatioManager{notificatioManager},
- settingsController{settingsController},
- heartRateController{heartRateController},
- motionController{motionController} {
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController)
+ : Screen(app),
+ currentDateTime {{}},
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ bleController {bleController},
+ notificatioManager {notificatioManager},
+ settingsController {settingsController},
+ heartRateController {heartRateController},
+ motionController {motionController} {
settingsController.SetClockFace(0);
displayedChar[0] = 0;
@@ -62,15 +65,15 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60);
lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999));
- label_time = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed);
+ label_time = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed);
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0);
label_time_ampm = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(label_time_ampm, "");
- lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55);
-
+ lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55);
+
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
@@ -78,7 +81,6 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text(backgroundLabel, "");
-
heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(heartbeatIcon, Symbols::heartBeat);
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
@@ -120,7 +122,7 @@ bool WatchFaceDigital::Refresh() {
bleState = bleController.IsConnected();
if (bleState.IsUpdated()) {
- if(bleState.Get() == true) {
+ if (bleState.Get() == true) {
lv_label_set_text(bleIcon, BleIcon::GetIcon(true));
} else {
lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
@@ -131,8 +133,8 @@ bool WatchFaceDigital::Refresh() {
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
notificationState = notificatioManager.AreNewNotificationsAvailable();
- if(notificationState.IsUpdated()) {
- if(notificationState.Get() == true)
+ if (notificationState.IsUpdated()) {
+ if (notificationState.Get() == true)
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
else
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
@@ -140,16 +142,16 @@ bool WatchFaceDigital::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
- if(currentDateTime.IsUpdated()) {
+ if (currentDateTime.IsUpdated()) {
auto newDateTime = currentDateTime.Get();
auto dp = date::floor<date::days>(newDateTime);
- auto time = date::make_time(newDateTime-dp);
+ auto time = date::make_time(newDateTime - dp);
auto yearMonthDay = date::year_month_day(dp);
- auto year = (int)yearMonthDay.year();
- auto month = static_cast<Pinetime::Controllers::DateTime::Months>((unsigned)yearMonthDay.month());
- auto day = (unsigned)yearMonthDay.day();
+ auto year = (int) yearMonthDay.year();
+ auto month = static_cast<Pinetime::Controllers::DateTime::Months>((unsigned) yearMonthDay.month());
+ auto day = (unsigned) yearMonthDay.day();
auto dayOfWeek = static_cast<Pinetime::Controllers::DateTime::Days>(date::weekday(yearMonthDay).iso_encoding());
int hour = time.hours().count();
@@ -160,29 +162,26 @@ bool WatchFaceDigital::Refresh() {
char hoursChar[3];
char ampmChar[3];
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
sprintf(hoursChar, "%02d", hour);
} else {
if (hour == 0 && hour != 12) {
- hour = 12;
- sprintf(ampmChar, "AM");
- }
- else if (hour == 12 && hour != 0) {
- hour = 12;
- sprintf(ampmChar, "PM");
- }
- else if (hour < 12 && hour != 0) {
- sprintf(ampmChar, "AM");
- }
- else if (hour > 12 && hour != 0)
- {
- hour = hour - 12;
- sprintf(ampmChar, "PM");
+ hour = 12;
+ sprintf(ampmChar, "AM");
+ } else if (hour == 12 && hour != 0) {
+ hour = 12;
+ sprintf(ampmChar, "PM");
+ } else if (hour < 12 && hour != 0) {
+ sprintf(ampmChar, "AM");
+ } else if (hour > 12 && hour != 0) {
+ hour = hour - 12;
+ sprintf(ampmChar, "PM");
}
sprintf(hoursChar, "%02d", hour);
}
- if(hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] || minutesChar[1] != displayedChar[3]) {
+ if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
+ minutesChar[1] != displayedChar[3]) {
displayedChar[0] = hoursChar[0];
displayedChar[1] = hoursChar[1];
displayedChar[2] = minutesChar[0];
@@ -190,25 +189,26 @@ bool WatchFaceDigital::Refresh() {
char timeStr[6];
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) {
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
lv_label_set_text(label_time_ampm, ampmChar);
- if ( hoursChar[0] == '0' ) { hoursChar[0] = ' '; }
+ if (hoursChar[0] == '0') {
+ hoursChar[0] = ' ';
+ }
}
- sprintf(timeStr, "%c%c:%c%c", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);
+ sprintf(timeStr, "%c%c:%c%c", hoursChar[0], hoursChar[1], minutesChar[0], minutesChar[1]);
lv_label_set_text(label_time, timeStr);
-
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) {
+
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0);
} else {
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
}
-
}
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
char dateStr[22];
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
sprintf(dateStr, "%s %d %s %d", dateTimeController.DayOfWeekShortToString(), day, dateTimeController.MonthShortToString(), year);
} else {
sprintf(dateStr, "%s %s %d %d", dateTimeController.DayOfWeekShortToString(), dateTimeController.MonthShortToString(), day, year);
@@ -216,7 +216,6 @@ bool WatchFaceDigital::Refresh() {
lv_label_set_text(label_date, dateStr);
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60);
-
currentYear = year;
currentMonth = month;
currentDayOfWeek = dayOfWeek;
@@ -226,12 +225,12 @@ bool WatchFaceDigital::Refresh() {
heartbeat = heartRateController.HeartRate();
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
- if(heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
- if(heartbeatRunning.Get())
- lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
+ if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
+ if (heartbeatRunning.Get())
+ lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
else
lv_label_set_text_static(heartbeatValue, "---");
-
+
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
@@ -239,7 +238,7 @@ bool WatchFaceDigital::Refresh() {
stepCount = motionController.NbSteps();
motionSensorOk = motionController.IsSensorOk();
- if(stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
+ if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
@@ -247,5 +246,3 @@ bool WatchFaceDigital::Refresh() {
return running;
}
-
-
diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h
index 67d32ff6..246efc95 100644
--- a/src/displayapp/screens/WatchFaceDigital.h
+++ b/src/displayapp/screens/WatchFaceDigital.h
@@ -22,64 +22,59 @@ namespace Pinetime {
namespace Screens {
class WatchFaceDigital : public Screen {
- public:
- WatchFaceDigital(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController);
- ~WatchFaceDigital() override;
+ public:
+ WatchFaceDigital(DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController);
+ ~WatchFaceDigital() override;
- bool Refresh() override;
-
+ bool Refresh() override;
- void OnObjectEvent(lv_obj_t *pObj, lv_event_t i);
- private:
+ void OnObjectEvent(lv_obj_t* pObj, lv_event_t i);
+ private:
+ char displayedChar[5];
- char displayedChar[5];
+ uint16_t currentYear = 1970;
+ Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
+ Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
+ uint8_t currentDay = 0;
- uint16_t currentYear = 1970;
- Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
- Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
- uint8_t currentDay = 0;
+ DirtyValue<int> batteryPercentRemaining {};
+ DirtyValue<bool> bleState {};
+ DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
+ DirtyValue<bool> motionSensorOk {};
+ DirtyValue<uint32_t> stepCount {};
+ DirtyValue<uint8_t> heartbeat {};
+ DirtyValue<bool> heartbeatRunning {};
+ DirtyValue<bool> notificationState {};
- DirtyValue<int> batteryPercentRemaining {};
- DirtyValue<bool> bleState {};
- DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime{};
- DirtyValue<bool> motionSensorOk {};
- DirtyValue<uint32_t> stepCount {};
- DirtyValue<uint8_t> heartbeat {};
- DirtyValue<bool> heartbeatRunning {};
- DirtyValue<bool> notificationState {};
-
- lv_obj_t* label_time;
- lv_obj_t* label_time_ampm;
- lv_obj_t* label_date;
- lv_obj_t* backgroundLabel;
- lv_obj_t* batteryIcon;
- lv_obj_t* bleIcon;
- lv_obj_t* batteryPlug;
- lv_obj_t* heartbeatIcon;
- lv_obj_t* heartbeatValue;
- lv_obj_t* heartbeatBpm;
- lv_obj_t* stepIcon;
- lv_obj_t* stepValue;
- lv_obj_t* notificationIcon;
-
- Controllers::DateTime& dateTimeController;
- Controllers::Battery& batteryController;
- Controllers::Ble& bleController;
- Controllers::NotificationManager& notificatioManager;
- Controllers::Settings& settingsController;
- Controllers::HeartRateController& heartRateController;
- Controllers::MotionController& motionController;
-
-
+ lv_obj_t* label_time;
+ lv_obj_t* label_time_ampm;
+ lv_obj_t* label_date;
+ lv_obj_t* backgroundLabel;
+ lv_obj_t* batteryIcon;
+ lv_obj_t* bleIcon;
+ lv_obj_t* batteryPlug;
+ lv_obj_t* heartbeatIcon;
+ lv_obj_t* heartbeatValue;
+ lv_obj_t* heartbeatBpm;
+ lv_obj_t* stepIcon;
+ lv_obj_t* stepValue;
+ lv_obj_t* notificationIcon;
+ Controllers::DateTime& dateTimeController;
+ Controllers::Battery& batteryController;
+ Controllers::Ble& bleController;
+ Controllers::NotificationManager& notificatioManager;
+ Controllers::Settings& settingsController;
+ Controllers::HeartRateController& heartRateController;
+ Controllers::MotionController& motionController;
};
}
}
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index 9fd051b8..d19e4222 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -3,66 +3,61 @@
#include "displayapp/screens/Symbols.h"
#include "displayapp/screens/BatteryIcon.h"
-
using namespace Pinetime::Applications::Screens;
namespace {
- static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) {
- QuickSettings* screen = static_cast<QuickSettings *>(obj->user_data);
+ static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
+ QuickSettings* screen = static_cast<QuickSettings*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
- static void lv_update_task(struct _lv_task_t *task) {
- auto user_data = static_cast<QuickSettings *>(task->user_data);
+ static void lv_update_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<QuickSettings*>(task->user_data);
user_data->UpdateScreen();
}
}
-QuickSettings::QuickSettings(
- Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- Controllers::BrightnessController& brightness,
- Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- batteryController{batteryController},
- dateTimeController{dateTimeController},
- brightness{brightness},
- settingsController{settingsController}
-{
+QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ Controllers::BrightnessController& brightness,
+ Pinetime::Controllers::Settings& settingsController)
+ : Screen(app),
+ batteryController {batteryController},
+ dateTimeController {dateTimeController},
+ brightness {brightness},
+ settingsController {settingsController} {
// Time
- label_time = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
- lv_label_set_align( label_time, LV_LABEL_ALIGN_CENTER );
+ label_time = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 15, 4);
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 4);
-
- lv_obj_t * lbl_btn;
+ lv_obj_t* lbl_btn;
btn1 = lv_btn_create(lv_scr_act(), nullptr);
btn1->user_data = this;
lv_obj_set_event_cb(btn1, ButtonEventHandler);
- lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30);
+ lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30);
lv_obj_set_style_local_radius(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
- lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
+ lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_grad_dir(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
- lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT);
+ lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT);
btn1_lvl = lv_label_create(btn1, nullptr);
lv_obj_set_style_local_text_font(btn1_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(btn1_lvl, brightness.GetIcon());
-
btn2 = lv_btn_create(lv_scr_act(), nullptr);
btn2->user_data = this;
lv_obj_set_event_cb(btn2, ButtonEventHandler);
- lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30);
+ lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30);
lv_obj_set_style_local_radius(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
lv_obj_set_style_local_bg_color(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_grad_dir(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
@@ -71,7 +66,6 @@ QuickSettings::QuickSettings(
lbl_btn = lv_label_create(btn2, nullptr);
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(lbl_btn, Symbols::highlight);
-
btn3 = lv_btn_create(lv_scr_act(), nullptr);
btn3->user_data = this;
@@ -86,9 +80,9 @@ QuickSettings::QuickSettings(
lv_btn_set_fit2(btn3, LV_FIT_TIGHT, LV_FIT_TIGHT);
btn3_lvl = lv_label_create(btn3, nullptr);
- lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
+ lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
- if ( settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON ) {
+ if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON) {
lv_obj_add_state(btn3, LV_STATE_CHECKED);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
} else {
@@ -98,7 +92,7 @@ QuickSettings::QuickSettings(
btn4 = lv_btn_create(lv_scr_act(), nullptr);
btn4->user_data = this;
lv_obj_set_event_cb(btn4, ButtonEventHandler);
- lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60);
+ lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60);
lv_obj_set_style_local_radius(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
lv_obj_set_style_local_bg_color(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_grad_dir(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
@@ -108,17 +102,15 @@ QuickSettings::QuickSettings(
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(lbl_btn, Symbols::settings);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text_static(backgroundLabel, "");
taskUpdate = lv_task_create(lv_update_task, 500000, LV_TASK_PRIO_MID, this);
-
}
-
QuickSettings::~QuickSettings() {
lv_task_del(taskUpdate);
lv_obj_clean(lv_scr_act());
@@ -126,39 +118,37 @@ QuickSettings::~QuickSettings() {
}
void QuickSettings::UpdateScreen() {
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
-void QuickSettings::OnButtonEvent(lv_obj_t *object, lv_event_t event) {
- if(object == btn2 && event == LV_EVENT_PRESSED) {
-
+void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
+ if (object == btn2 && event == LV_EVENT_PRESSED) {
+
running = false;
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::None);
- } else if(object == btn1 && event == LV_EVENT_PRESSED) {
-
+ } else if (object == btn1 && event == LV_EVENT_PRESSED) {
+
brightness.Step();
lv_label_set_text_static(btn1_lvl, brightness.GetIcon());
- settingsController.SetBrightness( brightness.Level() );
+ settingsController.SetBrightness(brightness.Level());
+
+ } else if (object == btn3 && event == LV_EVENT_VALUE_CHANGED) {
- } else if(object == btn3 && event == LV_EVENT_VALUE_CHANGED) {
-
- if(lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
- settingsController.SetVibrationStatus( Controllers::Settings::Vibration::ON );
+ if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
+ settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
} else {
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOff);
}
- } else if(object == btn4 && event == LV_EVENT_PRESSED) {
+ } else if (object == btn4 && event == LV_EVENT_PRESSED) {
running = false;
settingsController.SetSettingsMenu(0);
app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up);
-
}
-
}
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h
index 329be55b..8d04bec3 100644
--- a/src/displayapp/screens/settings/QuickSettings.h
+++ b/src/displayapp/screens/settings/QuickSettings.h
@@ -10,47 +10,44 @@
#include "components/settings/Settings.h"
#include "components/battery/BatteryController.h"
-
namespace Pinetime {
namespace Applications {
namespace Screens {
- class QuickSettings : public Screen{
- public:
- QuickSettings(DisplayApp* app,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- Controllers::BrightnessController& brightness,
- Pinetime::Controllers::Settings &settingsController);
-
- ~QuickSettings() override;
+ class QuickSettings : public Screen {
+ public:
+ QuickSettings(DisplayApp* app,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ Controllers::BrightnessController& brightness,
+ Pinetime::Controllers::Settings& settingsController);
- bool Refresh() override;
-
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
+ ~QuickSettings() override;
- void UpdateScreen();
+ bool Refresh() override;
- private:
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
- Pinetime::Controllers::Battery& batteryController;
- Controllers::DateTime& dateTimeController;
- Controllers::BrightnessController& brightness;
- Controllers::Settings& settingsController;
+ void UpdateScreen();
- lv_task_t* taskUpdate;
- lv_obj_t * batteryIcon;
- lv_obj_t * label_time;
+ private:
+ Pinetime::Controllers::Battery& batteryController;
+ Controllers::DateTime& dateTimeController;
+ Controllers::BrightnessController& brightness;
+ Controllers::Settings& settingsController;
- lv_obj_t * btn1;
- lv_obj_t * btn1_lvl;
- lv_obj_t * btn2;
- lv_obj_t * btn3;
- lv_obj_t * btn3_lvl;
- lv_obj_t * btn4;
+ lv_task_t* taskUpdate;
+ lv_obj_t* batteryIcon;
+ lv_obj_t* label_time;
+ lv_obj_t* btn1;
+ lv_obj_t* btn1_lvl;
+ lv_obj_t* btn2;
+ lv_obj_t* btn3;
+ lv_obj_t* btn3_lvl;
+ lv_obj_t* btn4;
};
}
}
diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp
index 6c1bc9b5..4954185d 100644
--- a/src/displayapp/screens/settings/SettingDisplay.cpp
+++ b/src/displayapp/screens/settings/SettingDisplay.cpp
@@ -8,19 +8,16 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingDisplay* screen = static_cast<SettingDisplay *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingDisplay* screen = static_cast<SettingDisplay*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingDisplay::SettingDisplay(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
@@ -32,31 +29,31 @@ SettingDisplay::SettingDisplay(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Display timeout");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Display timeout");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::sun);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
-
+
optionsTotal = 0;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 5 seconds");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 5000 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetScreenTimeOut() == 5000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 15 seconds");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 15000 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetScreenTimeOut() == 15000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -64,7 +61,7 @@ SettingDisplay::SettingDisplay(
lv_checkbox_set_text_static(cbOption[optionsTotal], " 20 seconds");
cbOption[optionsTotal]->user_data = this;
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 20000 ) {
+ if (settingsController.GetScreenTimeOut() == 20000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -72,7 +69,7 @@ SettingDisplay::SettingDisplay(
lv_checkbox_set_text_static(cbOption[optionsTotal], " 30 seconds");
cbOption[optionsTotal]->user_data = this;
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 30000 ) {
+ if (settingsController.GetScreenTimeOut() == 30000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -87,18 +84,25 @@ bool SettingDisplay::Refresh() {
return running;
}
-
-void SettingDisplay::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(int i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (int i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
-
- if ( i == 0 ) { settingsController.SetScreenTimeOut(5000); };
- if ( i == 1 ) { settingsController.SetScreenTimeOut(15000); };
- if ( i == 2 ) { settingsController.SetScreenTimeOut(20000); };
- if ( i == 3 ) { settingsController.SetScreenTimeOut(30000); };
-
+
+ if (i == 0) {
+ settingsController.SetScreenTimeOut(5000);
+ };
+ if (i == 1) {
+ settingsController.SetScreenTimeOut(15000);
+ };
+ if (i == 2) {
+ settingsController.SetScreenTimeOut(20000);
+ };
+ if (i == 3) {
+ settingsController.SetScreenTimeOut(30000);
+ };
+
app->PushMessage(Applications::Display::Messages::UpdateTimeOut);
} else {
diff --git a/src/displayapp/screens/settings/SettingDisplay.h b/src/displayapp/screens/settings/SettingDisplay.h
index 9565d3c7..b8ed87ec 100644
--- a/src/displayapp/screens/settings/SettingDisplay.h
+++ b/src/displayapp/screens/settings/SettingDisplay.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingDisplay : public Screen{
- public:
- SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingDisplay() override;
+ class SettingDisplay : public Screen {
+ public:
+ SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingDisplay() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[4];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[4];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp
index ff217bda..031a2a72 100644
--- a/src/displayapp/screens/settings/SettingTimeFormat.cpp
+++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp
@@ -7,19 +7,16 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingTimeFormat* screen = static_cast<SettingTimeFormat *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingTimeFormat* screen = static_cast<SettingTimeFormat*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingTimeFormat::SettingTimeFormat(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
@@ -31,12 +28,12 @@ SettingTimeFormat::SettingTimeFormat(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Time format");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Time format");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::clock);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
@@ -46,8 +43,8 @@ SettingTimeFormat::SettingTimeFormat(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 12-hour");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
@@ -55,8 +52,8 @@ SettingTimeFormat::SettingTimeFormat(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 24-hour");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -71,16 +68,19 @@ bool SettingTimeFormat::Refresh() {
return running;
}
-
-void SettingTimeFormat::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(int i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (int i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
-
- if ( i == 0 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H12); };
- if ( i == 1 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H24); };
-
+
+ if (i == 0) {
+ settingsController.SetClockType(Controllers::Settings::ClockType::H12);
+ };
+ if (i == 1) {
+ settingsController.SetClockType(Controllers::Settings::ClockType::H24);
+ };
+
} else {
lv_checkbox_set_checked(cbOption[i], false);
}
diff --git a/src/displayapp/screens/settings/SettingTimeFormat.h b/src/displayapp/screens/settings/SettingTimeFormat.h
index a6380493..9203b45b 100644
--- a/src/displayapp/screens/settings/SettingTimeFormat.h
+++ b/src/displayapp/screens/settings/SettingTimeFormat.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingTimeFormat : public Screen{
- public:
- SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingTimeFormat() override;
+ class SettingTimeFormat : public Screen {
+ public:
+ SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingTimeFormat() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[2];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[2];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp
index 927a9e3a..89f0c098 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.cpp
+++ b/src/displayapp/screens/settings/SettingWakeUp.cpp
@@ -8,19 +8,16 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingWakeUp* screen = static_cast<SettingWakeUp *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingWakeUp* screen = static_cast<SettingWakeUp*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingWakeUp::SettingWakeUp(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
@@ -32,12 +29,12 @@ SettingWakeUp::SettingWakeUp(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Wake Up");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Wake Up");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::clock);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
@@ -47,32 +44,32 @@ SettingWakeUp::SettingWakeUp(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " None");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Single Tap");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Double Tap");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Raise Wrist");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -87,18 +84,25 @@ bool SettingWakeUp::Refresh() {
return running;
}
-
-void SettingWakeUp::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(int i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingWakeUp::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (int i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
-
- if ( i == 0 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None); };
- if ( i == 1 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap); };
- if ( i == 2 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap); };
- if ( i == 3 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist); };
-
+
+ if (i == 0) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None);
+ };
+ if (i == 1) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap);
+ };
+ if (i == 2) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap);
+ };
+ if (i == 3) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist);
+ };
+
} else {
lv_checkbox_set_checked(cbOption[i], false);
}
diff --git a/src/displayapp/screens/settings/SettingWakeUp.h b/src/displayapp/screens/settings/SettingWakeUp.h
index 86b52837..8b33eb06 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.h
+++ b/src/displayapp/screens/settings/SettingWakeUp.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingWakeUp : public Screen{
- public:
- SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingWakeUp() override;
+ class SettingWakeUp : public Screen {
+ public:
+ SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingWakeUp() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[4];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[4];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index f763acd4..457cebf6 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -7,21 +7,18 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingWatchFace* screen = static_cast<SettingWatchFace *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingWatchFace* screen = static_cast<SettingWatchFace*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingWatchFace::SettingWatchFace(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
+ // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
@@ -32,12 +29,12 @@ SettingWatchFace::SettingWatchFace(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Watch face");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Watch face");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::clock);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
@@ -47,8 +44,8 @@ SettingWatchFace::SettingWatchFace(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Digital face");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockFace() == 0 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockFace() == 0) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
@@ -56,8 +53,8 @@ SettingWatchFace::SettingWatchFace(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Analog face");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockFace() == 1 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockFace() == 1) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
@@ -73,11 +70,10 @@ bool SettingWatchFace::Refresh() {
return running;
}
-
-void SettingWatchFace::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(uint8_t i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (uint8_t i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
settingsController.SetClockFace(i);
} else {
diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h
index 8c30ed28..1930a228 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.h
+++ b/src/displayapp/screens/settings/SettingWatchFace.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingWatchFace : public Screen{
- public:
- SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingWatchFace() override;
+ class SettingWatchFace : public Screen {
+ public:
+ SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingWatchFace() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[2];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[2];
};
}
}
diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp
index b2825915..e24be3d7 100644
--- a/src/displayapp/screens/settings/Settings.cpp
+++ b/src/displayapp/screens/settings/Settings.cpp
@@ -8,27 +8,27 @@
using namespace Pinetime::Applications::Screens;
-Settings::Settings(
- Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController},
- screens{app,
- settingsController.GetSettingsMenu(),
- {
- [this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen2(); }
- },
- Screens::ScreenListModes::UpDown
- } {}
+Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app),
+ settingsController {settingsController},
+ screens {app,
+ settingsController.GetSettingsMenu(),
+ {[this]() -> std::unique_ptr<Screen> {
+ return CreateScreen1();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen2();
+ }},
+ Screens::ScreenListModes::UpDown} {
+}
Settings::~Settings() {
lv_obj_clean(lv_scr_act());
}
bool Settings::Refresh() {
-
- if(running)
+
+ if (running)
running = screens.Refresh();
return running;
}
@@ -39,29 +39,26 @@ bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
std::unique_ptr<Screen> Settings::CreateScreen1() {
- std::array<Screens::List::Applications, 4> applications {
- {
- {Symbols::sun, "Display", Apps::SettingDisplay},
- {Symbols::clock, "Wake Up", Apps::SettingWakeUp},
- {Symbols::clock, "Time format", Apps::SettingTimeFormat},
- {Symbols::clock, "Watch face", Apps::SettingWatchFace},
- }
+ std::array<Screens::List::Applications, 4> applications {{
+ {Symbols::sun, "Display", Apps::SettingDisplay},
+ {Symbols::clock, "Wake Up", Apps::SettingWakeUp},
+ {Symbols::clock, "Time format", Apps::SettingTimeFormat},
+ {Symbols::clock, "Watch face", Apps::SettingWatchFace},
+ }
};
return std::unique_ptr<Screen>(new Screens::List(0, 2, app, settingsController, applications));
}
-
std::unique_ptr<Screen> Settings::CreateScreen2() {
- std::array<Screens::List::Applications, 4> applications {
- {
- {Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
- {Symbols::check, "Firmware", Apps::FirmwareValidation},
- {Symbols::list, "About", Apps::SysInfo},
- {"", "", Apps::None},
- }
+ std::array<Screens::List::Applications, 4> applications {{
+ {Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
+ {Symbols::check, "Firmware", Apps::FirmwareValidation},
+ {Symbols::list, "About", Apps::SysInfo},
+ {"", "", Apps::None},
+ }
};
diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h
index 9955e1d4..7e332dfe 100644
--- a/src/displayapp/screens/settings/Settings.h
+++ b/src/displayapp/screens/settings/Settings.h
@@ -6,31 +6,26 @@
namespace Pinetime {
-
namespace Applications {
namespace Screens {
- class Settings : public Screen{
- public:
- Settings(DisplayApp* app,
- Pinetime::Controllers::Settings &settingsController);
- ~Settings() override;
-
- bool Refresh() override;
-
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ class Settings : public Screen {
+ public:
+ Settings(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~Settings() override;
- private:
+ bool Refresh() override;
- Controllers::Settings& settingsController;
-
- ScreenList<2> screens;
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
- std::unique_ptr<Screen> CreateScreen1();
- std::unique_ptr<Screen> CreateScreen2();
+ private:
+ Controllers::Settings& settingsController;
+ ScreenList<2> screens;
+ std::unique_ptr<Screen> CreateScreen1();
+ std::unique_ptr<Screen> CreateScreen2();
};
}
}