summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp101
-rw-r--r--src/displayapp/DisplayApp.h1
-rw-r--r--src/displayapp/Messages.h6
-rw-r--r--src/displayapp/fonts/README.md2
-rw-r--r--src/displayapp/fonts/jetbrains_mono_bold_20.c111
-rw-r--r--src/displayapp/screens/ApplicationList.cpp2
-rw-r--r--src/displayapp/screens/FirmwareUpdate.cpp33
-rw-r--r--src/displayapp/screens/FirmwareUpdate.h9
-rw-r--r--src/displayapp/screens/FlashLight.cpp2
-rw-r--r--src/displayapp/screens/Label.h4
-rw-r--r--src/displayapp/screens/Motion.cpp14
-rw-r--r--src/displayapp/screens/Motion.h6
-rw-r--r--src/displayapp/screens/Music.cpp4
-rw-r--r--src/displayapp/screens/Notifications.cpp1
-rw-r--r--src/displayapp/screens/PineTimeStyle.cpp36
-rw-r--r--src/displayapp/screens/Screen.h8
-rw-r--r--src/displayapp/screens/Steps.cpp19
-rw-r--r--src/displayapp/screens/Symbols.h3
-rw-r--r--src/displayapp/screens/SystemInfo.cpp49
-rw-r--r--src/displayapp/screens/SystemInfo.h5
-rw-r--r--src/displayapp/screens/Tile.cpp18
-rw-r--r--src/displayapp/screens/Tile.h2
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp13
-rw-r--r--src/displayapp/screens/settings/QuickSettings.h1
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.cpp62
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.h5
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp4
-rw-r--r--src/displayapp/screens/settings/Settings.cpp4
28 files changed, 299 insertions, 226 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 6d66afe5..d4a73f5e 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -43,6 +43,8 @@
#include "displayapp/screens/settings/SettingDisplay.h"
#include "displayapp/screens/settings/SettingSteps.h"
+#include "libs/lv_conf.h"
+
using namespace Pinetime::Applications;
using namespace Pinetime::Applications::Display;
@@ -50,6 +52,31 @@ namespace {
static inline bool in_isr(void) {
return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
}
+
+ TouchEvents Convert(Pinetime::Drivers::Cst816S::TouchInfos info) {
+ if (info.isTouch) {
+ switch (info.gesture) {
+ case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
+ return TouchEvents::Tap;
+ case Pinetime::Drivers::Cst816S::Gestures::LongPress:
+ return TouchEvents::LongTap;
+ case Pinetime::Drivers::Cst816S::Gestures::DoubleTap:
+ return TouchEvents::DoubleTap;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideRight:
+ return TouchEvents::SwipeRight;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideLeft:
+ return TouchEvents::SwipeLeft;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideDown:
+ return TouchEvents::SwipeDown;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideUp:
+ return TouchEvents::SwipeUp;
+ case Pinetime::Drivers::Cst816S::Gestures::None:
+ default:
+ return TouchEvents::None;
+ }
+ }
+ return TouchEvents::None;
+ }
}
DisplayApp::DisplayApp(Drivers::St7789& lcd,
@@ -123,10 +150,10 @@ void DisplayApp::Refresh() {
case States::Running:
RunningState();
delta = xTaskGetTickCount() - lastWakeTime;
- if (delta > 20) {
- delta = 20;
+ if (delta > LV_DISP_DEF_REFR_PERIOD) {
+ delta = LV_DISP_DEF_REFR_PERIOD;
}
- queueTimeout = 20 - delta;
+ queueTimeout = LV_DISP_DEF_REFR_PERIOD - delta;
break;
default:
queueTimeout = portMAX_DELAY;
@@ -138,8 +165,15 @@ void DisplayApp::Refresh() {
lastWakeTime = xTaskGetTickCount();
if (messageReceived) {
switch (msg) {
- case Messages::GoToSleep:
+ case Messages::DimScreen:
+ // Backup brightness is the brightness to return to after dimming or sleeping
brightnessController.Backup();
+ brightnessController.Set(Controllers::BrightnessController::Levels::Low);
+ break;
+ case Messages::RestoreBrightness:
+ brightnessController.Restore();
+ break;
+ case Messages::GoToSleep:
while (brightnessController.Level() != Controllers::BrightnessController::Levels::Off) {
brightnessController.Lower();
vTaskDelay(100);
@@ -168,16 +202,21 @@ void DisplayApp::Refresh() {
break;
case Messages::TimerDone:
if (currentApp == Apps::Timer) {
- auto *timer = static_cast<Screens::Timer*>(currentScreen.get());
+ auto* timer = static_cast<Screens::Timer*>(currentScreen.get());
timer->setDone();
} else {
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);
}
break;
case Messages::TouchEvent: {
- if (state != States::Running)
+ if (state != States::Running) {
break;
- auto gesture = OnTouchEvent();
+ }
+ auto info = touchPanel.GetTouchInfo();
+ auto gesture = Convert(info);
+ if (gesture == TouchEvents::None) {
+ break;
+ }
if (!currentScreen->OnTouchEvent(gesture)) {
if (currentApp == Apps::Clock) {
switch (gesture) {
@@ -198,6 +237,12 @@ void DisplayApp::Refresh() {
}
} else if (returnTouchEvent == gesture) {
LoadApp(returnToApp, returnDirection);
+ brightnessController.Set(settingsController.GetBrightness());
+ brightnessController.Backup();
+ } else if (touchMode == TouchModes::Gestures) {
+ if (gesture == TouchEvents::Tap) {
+ lvgl.SetNewTapEvent(info.x, info.y);
+ }
}
}
} break;
@@ -207,6 +252,8 @@ void DisplayApp::Refresh() {
} else {
if (!currentScreen->OnButtonPushed()) {
LoadApp(returnToApp, returnDirection);
+ brightnessController.Set(settingsController.GetBrightness());
+ brightnessController.Backup();
}
}
break;
@@ -221,7 +268,7 @@ void DisplayApp::Refresh() {
}
}
- if(nextApp != Apps::None) {
+ if (nextApp != Apps::None) {
LoadApp(nextApp, nextDirection);
nextApp = Apps::None;
}
@@ -284,6 +331,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
break;
case Apps::FirmwareUpdate:
currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController);
+ ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
break;
case Apps::Notifications:
@@ -335,8 +383,8 @@ 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, motionController);
+ currentScreen = std::make_unique<Screens::SystemInfo>(
+ this, dateTimeController, batteryController, brightnessController, bleController, watchdog, motionController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::FlashLight:
@@ -381,7 +429,7 @@ void DisplayApp::IdleState() {
}
void DisplayApp::PushMessage(Messages msg) {
- if(in_isr()) {
+ if (in_isr()) {
BaseType_t xHigherPriorityTaskWoken;
xHigherPriorityTaskWoken = pdFALSE;
xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken);
@@ -393,35 +441,6 @@ void DisplayApp::PushMessage(Messages msg) {
}
}
-TouchEvents DisplayApp::OnTouchEvent() {
- auto info = touchPanel.GetTouchInfo();
- if (info.isTouch) {
- switch (info.gesture) {
- case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
- if (touchMode == TouchModes::Gestures) {
- lvgl.SetNewTapEvent(info.x, info.y);
- }
- return TouchEvents::Tap;
- case Pinetime::Drivers::Cst816S::Gestures::LongPress:
- return TouchEvents::LongTap;
- case Pinetime::Drivers::Cst816S::Gestures::DoubleTap:
- return TouchEvents::DoubleTap;
- case Pinetime::Drivers::Cst816S::Gestures::SlideRight:
- return TouchEvents::SwipeRight;
- case Pinetime::Drivers::Cst816S::Gestures::SlideLeft:
- return TouchEvents::SwipeLeft;
- case Pinetime::Drivers::Cst816S::Gestures::SlideDown:
- return TouchEvents::SwipeDown;
- case Pinetime::Drivers::Cst816S::Gestures::SlideUp:
- return TouchEvents::SwipeUp;
- case Pinetime::Drivers::Cst816S::Gestures::None:
- default:
- return TouchEvents::None;
- }
- }
- return TouchEvents::None;
-}
-
void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
switch (direction) {
case DisplayApp::FullRefreshDirections::Down:
@@ -452,7 +471,7 @@ void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) {
}
void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) {
- if(systemTask != nullptr)
+ if (systemTask != nullptr)
systemTask->PushMessage(message);
}
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index f4573ab7..574be63f 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -102,7 +102,6 @@ namespace Pinetime {
TouchModes touchMode = TouchModes::Gestures;
- TouchEvents OnTouchEvent();
void RunningState();
void IdleState();
static void Process(void* instance);
diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h
index ce65f846..322505e6 100644
--- a/src/displayapp/Messages.h
+++ b/src/displayapp/Messages.h
@@ -13,8 +13,10 @@ namespace Pinetime {
NewNotification,
TimerDone,
BleFirmwareUpdateStarted,
- UpdateTimeOut
+ UpdateTimeOut,
+ DimScreen,
+ RestoreBrightness
};
}
}
-} \ No newline at end of file
+}
diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md
index ec4beb88..8a260846 100644
--- a/src/displayapp/fonts/README.md
+++ b/src/displayapp/fonts/README.md
@@ -13,7 +13,7 @@
* Do not enable font compression and horizontal subpixel hinting
* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) 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, 0xf252, 0xf569`
+ 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, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015`
* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts`
* Add the font .c file path to src/CMakeLists.txt
* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h
diff --git a/src/displayapp/fonts/jetbrains_mono_bold_20.c b/src/displayapp/fonts/jetbrains_mono_bold_20.c
index 98243bb4..d8705528 100644
--- a/src/displayapp/fonts/jetbrains_mono_bold_20.c
+++ b/src/displayapp/fonts/jetbrains_mono_bold_20.c
@@ -734,6 +734,15 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
0xff, 0x7, 0xef, 0xf0, 0x10, 0xff, 0x0, 0x3,
0xc0, 0x0,
+ /* U+F015 "" */
+ 0x0, 0x38, 0xe0, 0x0, 0xf9, 0xc0, 0x3, 0xfb,
+ 0x80, 0x1e, 0x3f, 0x0, 0x79, 0x3e, 0x1, 0xe7,
+ 0x3c, 0xf, 0x9f, 0xbc, 0x3c, 0xff, 0x9e, 0xf3,
+ 0xff, 0x9e, 0xcf, 0xff, 0x98, 0x3f, 0xff, 0x80,
+ 0x7f, 0xff, 0x0, 0xfc, 0x7e, 0x1, 0xf8, 0xfc,
+ 0x3, 0xf1, 0xf8, 0x7, 0xe3, 0xf0, 0xf, 0xc7,
+ 0xe0,
+
/* U+F017 "" */
0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfc, 0x1f,
0xff, 0xc7, 0xf1, 0xfc, 0xfe, 0x3f, 0x9f, 0xc7,
@@ -823,6 +832,14 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
0xdf, 0x9e, 0x38, 0xf3, 0x7, 0x6, 0x0, 0xe0,
0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, 0x70, 0x0,
+ /* U+F06E "" */
+ 0x0, 0xfe, 0x0, 0xf, 0xff, 0x80, 0x3e, 0xf,
+ 0x80, 0xf8, 0xf, 0x83, 0xe3, 0x8f, 0x8f, 0x87,
+ 0x8f, 0xbf, 0x1f, 0x9f, 0xfe, 0xff, 0x3f, 0xfd,
+ 0xfe, 0x7e, 0xf9, 0xf8, 0xf8, 0xf9, 0xe3, 0xe0,
+ 0xf8, 0xf, 0x80, 0xf8, 0x3e, 0x0, 0xff, 0xf0,
+ 0x0, 0x3f, 0x80, 0x0,
+
/* U+F095 "" */
0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x7, 0xf0,
0x0, 0x7f, 0x0, 0x7, 0xf0, 0x0, 0xff, 0x0,
@@ -861,6 +878,13 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
0x1, 0xf8, 0x0, 0x9f, 0xc0, 0xf, 0xfc, 0x0,
0x7f, 0xc0, 0x7, 0xf8, 0x0, 0x1f, 0x0, 0x0,
+ /* U+F201 "" */
+ 0x40, 0x0, 0x7, 0x0, 0x0, 0x38, 0x1, 0xf9,
+ 0xc0, 0x7, 0xce, 0x18, 0x1e, 0x71, 0xe1, 0xf3,
+ 0x9f, 0x9d, 0x9d, 0xff, 0xc4, 0xe6, 0x7c, 0x7,
+ 0x1, 0xc0, 0x38, 0x0, 0x1, 0xc0, 0x0, 0xe,
+ 0x0, 0x0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xe0,
+
/* U+F21E "" */
0x1e, 0x7, 0x83, 0xf9, 0xfe, 0x7f, 0xff, 0xef,
0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xfc,
@@ -1182,42 +1206,45 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 2484, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2498, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2511, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 2561, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 2609, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 2659, .adv_w = 240, .box_w = 15, .box_h = 15, .ofs_x = 0, .ofs_y = 0},
- {.bitmap_index = 2688, .adv_w = 360, .box_w = 23, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 2743, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
- {.bitmap_index = 2782, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
- {.bitmap_index = 2825, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1},
- {.bitmap_index = 2853, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 2901, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
- {.bitmap_index = 2940, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
- {.bitmap_index = 2979, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1},
- {.bitmap_index = 3007, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 3055, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 3108, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 3127, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 3177, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 3213, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 3261, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
- {.bitmap_index = 3304, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
- {.bitmap_index = 3342, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
- {.bitmap_index = 3380, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
- {.bitmap_index = 3418, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
- {.bitmap_index = 3456, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
- {.bitmap_index = 3494, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 3530, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3},
- {.bitmap_index = 3568, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 3597, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2},
- {.bitmap_index = 3635, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 3701, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
- {.bitmap_index = 3750, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 3800, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 3860, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 3913, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
- {.bitmap_index = 3974, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 4029, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
- {.bitmap_index = 4082, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}
+ {.bitmap_index = 2561, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
+ {.bitmap_index = 2610, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 2658, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 2708, .adv_w = 240, .box_w = 15, .box_h = 15, .ofs_x = 0, .ofs_y = 0},
+ {.bitmap_index = 2737, .adv_w = 360, .box_w = 23, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 2792, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
+ {.bitmap_index = 2831, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
+ {.bitmap_index = 2874, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1},
+ {.bitmap_index = 2902, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 2950, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
+ {.bitmap_index = 2989, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
+ {.bitmap_index = 3028, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1},
+ {.bitmap_index = 3056, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 3104, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0},
+ {.bitmap_index = 3148, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 3201, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 3220, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 3270, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 3306, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 3354, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0},
+ {.bitmap_index = 3394, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
+ {.bitmap_index = 3437, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
+ {.bitmap_index = 3475, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
+ {.bitmap_index = 3513, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
+ {.bitmap_index = 3551, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
+ {.bitmap_index = 3589, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
+ {.bitmap_index = 3627, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 3663, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3},
+ {.bitmap_index = 3701, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 3730, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2},
+ {.bitmap_index = 3768, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 3834, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
+ {.bitmap_index = 3883, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 3933, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 3993, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 4046, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
+ {.bitmap_index = 4107, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 4162, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
+ {.bitmap_index = 4215, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}
};
/*---------------------
@@ -1225,11 +1252,11 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
*--------------------*/
static const uint16_t unicode_list_2[] = {
- 0x0, 0x16, 0x23, 0x26, 0x27, 0x28, 0x39, 0x47,
- 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x94, 0x128, 0x184,
- 0x1e5, 0x1fb, 0x21d, 0x23f, 0x240, 0x241, 0x242, 0x243,
- 0x251, 0x292, 0x293, 0x2f1, 0x3dc, 0x3fc, 0x45c, 0x54a,
- 0x55f, 0x568, 0x59e, 0x59f, 0x6a8
+ 0x0, 0x14, 0x16, 0x23, 0x26, 0x27, 0x28, 0x39,
+ 0x47, 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x6d, 0x94,
+ 0x128, 0x184, 0x1e5, 0x1fb, 0x200, 0x21d, 0x23f, 0x240,
+ 0x241, 0x242, 0x243, 0x251, 0x292, 0x293, 0x2f1, 0x3dc,
+ 0x3fc, 0x45c, 0x54a, 0x55f, 0x568, 0x59e, 0x59f, 0x6a8
};
/*Collect the unicode lists and glyph_id offsets*/
@@ -1245,7 +1272,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
},
{
.range_start = 61441, .range_length = 1705, .glyph_id_start = 160,
- .unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 37, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
+ .unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 40, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
}
};
diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp
index 78c7cd9a..d6c3970b 100644
--- a/src/displayapp/screens/ApplicationList.cpp
+++ b/src/displayapp/screens/ApplicationList.cpp
@@ -62,7 +62,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
{Symbols::paintbrush, Apps::Paint},
{Symbols::paddle, Apps::Paddle},
{"2", Apps::Twos},
- {"M", Apps::Motion},
+ {Symbols::chartLine, Apps::Motion},
{Symbols::drum, Apps::Metronome},
{"", Apps::None},
}};
diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp
index 4086b152..edb2e49d 100644
--- a/src/displayapp/screens/FirmwareUpdate.cpp
+++ b/src/displayapp/screens/FirmwareUpdate.cpp
@@ -27,9 +27,10 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime
lv_bar_set_value(bar1, 0, LV_ANIM_OFF);
percentLabel = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(percentLabel, "");
+ lv_label_set_text(percentLabel, "Waiting...");
lv_obj_set_auto_realign(percentLabel, true);
lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60);
+ startTime = xTaskGetTickCount();
}
FirmwareUpdate::~FirmwareUpdate() {
@@ -40,26 +41,42 @@ bool FirmwareUpdate::Refresh() {
switch (bleController.State()) {
default:
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle:
+ // This condition makes sure that the app is exited if somehow it got
+ // launched without a firmware update. This should never happen.
+ if (state != States::Error) {
+ if (xTaskGetTickCount() - startTime > (60 * 1024)) {
+ UpdateError();
+ state = States::Error;
+ }
+ } else if (xTaskGetTickCount() - startTime > (5 * 1024)) {
+ running = false;
+ }
+ break;
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running:
if (state != States::Running)
state = States::Running;
- return DisplayProgression();
+ DisplayProgression();
+ break;
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated:
if (state != States::Validated) {
UpdateValidated();
state = States::Validated;
}
- return running;
+ break;
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error:
if (state != States::Error) {
UpdateError();
state = States::Error;
}
- return running;
+ if (xTaskGetTickCount() - startTime > (5 * 1024)) {
+ running = false;
+ }
+ break;
}
+ return running;
}
-bool FirmwareUpdate::DisplayProgression() const {
+void FirmwareUpdate::DisplayProgression() const {
float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f;
float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f;
int16_t pc = (current / total) * 100.0f;
@@ -67,7 +84,6 @@ bool FirmwareUpdate::DisplayProgression() const {
lv_label_set_text(percentLabel, percentStr);
lv_bar_set_value(bar1, pc, LV_ANIM_OFF);
- return running;
}
void FirmwareUpdate::UpdateValidated() {
@@ -78,4 +94,9 @@ void FirmwareUpdate::UpdateValidated() {
void FirmwareUpdate::UpdateError() {
lv_label_set_recolor(percentLabel, true);
lv_label_set_text(percentLabel, "#ff0000 Error!#");
+ startTime = xTaskGetTickCount();
+}
+
+bool FirmwareUpdate::OnButtonPushed() {
+ return true;
}
diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h
index f4d34df0..90c99f4c 100644
--- a/src/displayapp/screens/FirmwareUpdate.h
+++ b/src/displayapp/screens/FirmwareUpdate.h
@@ -2,6 +2,7 @@
#include "Screen.h"
#include <lvgl/src/lv_core/lv_obj.h>
+#include "FreeRTOS.h"
namespace Pinetime {
namespace Controllers {
@@ -25,13 +26,17 @@ namespace Pinetime {
lv_obj_t* titleLabel;
mutable char percentStr[10];
- States state;
+ States state = States::Idle;
- bool DisplayProgression() const;
+ void DisplayProgression() const;
+
+ bool OnButtonPushed() override;
void UpdateValidated();
void UpdateError();
+
+ TickType_t startTime;
};
}
}
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 7db2c6c8..63b2345e 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -70,5 +70,5 @@ bool FlashLight::Refresh() {
}
bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- return true;
+ return false;
}
diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h
index 62b80bec..834f8c88 100644
--- a/src/displayapp/screens/Label.h
+++ b/src/displayapp/screens/Label.h
@@ -15,8 +15,6 @@ namespace Pinetime {
bool Refresh() override;
private:
- bool running = true;
-
lv_obj_t* labelText = nullptr;
lv_point_t pageIndicatorBasePoints[2];
lv_point_t pageIndicatorPoints[2];
@@ -25,4 +23,4 @@ namespace Pinetime {
};
}
}
-} \ No newline at end of file
+}
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index a8bb3c18..43a5575e 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -32,11 +32,10 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
lv_label_set_recolor(label, true);
-
+
labelStep = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_label_set_text(labelStep, "Steps ---");
-
}
Motion::~Motion() {
@@ -50,13 +49,12 @@ bool Motion::Refresh() {
lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps());
- lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", motionController.X() / 0x10, motionController.Y() / 0x10, motionController.Z() / 0x10);
+ lv_label_set_text_fmt(label,
+ "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#",
+ motionController.X() / 0x10,
+ motionController.Y() / 0x10,
+ motionController.Z() / 0x10);
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
return running;
}
-
-bool Motion::OnButtonPushed() {
- running = false;
- return true;
-}
diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h
index 132b20ec..7e65197b 100644
--- a/src/displayapp/screens/Motion.h
+++ b/src/displayapp/screens/Motion.h
@@ -18,7 +18,6 @@ namespace Pinetime {
~Motion() override;
bool Refresh() override;
- bool OnButtonPushed() override;
private:
Controllers::MotionController& motionController;
@@ -29,10 +28,7 @@ namespace Pinetime {
lv_obj_t* label;
lv_obj_t* labelStep;
- static constexpr uint8_t nbStepsBufferSize = 9;
- char nbStepsBuffer[nbStepsBufferSize + 1];
- bool running = true;
};
}
}
-} \ No newline at end of file
+}
diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp
index 9f10f508..c8d5e4b0 100644
--- a/src/displayapp/screens/Music.cpp
+++ b/src/displayapp/screens/Music.cpp
@@ -119,7 +119,6 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
constexpr int8_t MIDDLE_OFFSET = -25;
txtArtist = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL_CIRC);
- 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);
@@ -127,7 +126,6 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
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);
@@ -303,4 +301,4 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return true;
}
}
-} \ No newline at end of file
+}
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 38b12420..5c23ed1f 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -184,7 +184,6 @@ Notifications::NotificationItem::NotificationItem(const char* title,
}
lv_label_set_text(alert_type, title);
lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC);
- lv_label_set_anim_speed(alert_type, 3);
lv_obj_set_width(alert_type, 180);
lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16);
diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp
index 591f3a49..0efb4dc3 100644
--- a/src/displayapp/screens/PineTimeStyle.cpp
+++ b/src/displayapp/screens/PineTimeStyle.cpp
@@ -264,23 +264,23 @@ bool PineTimeStyle::Refresh() {
char hoursChar[3];
char ampmChar[5];
- if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
- sprintf(hoursChar, "%02d", hour);
- } else {
- if (hour == 0 && hour != 12) {
- hour = 12;
- sprintf(ampmChar, "A\nM");
- } else if (hour == 12 && hour != 0) {
- hour = 12;
- sprintf(ampmChar, "P\nM");
- } else if (hour < 12 && hour != 0) {
- sprintf(ampmChar, "A\nM");
- } else if (hour > 12 && hour != 0) {
- hour = hour - 12;
- sprintf(ampmChar, "P\nM");
- }
- sprintf(hoursChar, "%02d", hour);
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
+ sprintf(hoursChar, "%02d", hour);
+ } else {
+ if (hour == 0 && hour != 12) {
+ hour = 12;
+ sprintf(ampmChar, "A\nM");
+ } else if (hour == 12 && hour != 0) {
+ hour = 12;
+ sprintf(ampmChar, "P\nM");
+ } else if (hour < 12 && hour != 0) {
+ sprintf(ampmChar, "A\nM");
+ } else if (hour > 12 && hour != 0) {
+ hour = hour - 12;
+ sprintf(ampmChar, "P\nM");
}
+ sprintf(hoursChar, "%02d", hour);
+ }
if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
minutesChar[1] != displayedChar[3]) {
@@ -292,9 +292,9 @@ bool PineTimeStyle::Refresh() {
char hourStr[3];
char minStr[3];
- if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
lv_label_set_text(timeAMPM, ampmChar);
- }
+ }
/* Display the time as 2 pairs of digits */
sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]);
diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h
index 8e49c9de..6c9110c6 100644
--- a/src/displayapp/screens/Screen.h
+++ b/src/displayapp/screens/Screen.h
@@ -13,8 +13,12 @@ namespace Pinetime {
DirtyValue() = default; // Use NSDMI
explicit DirtyValue(T const& v) : value {v} {
} // Use MIL and const-lvalue-ref
- bool IsUpdated() const {
- return isUpdated;
+ bool IsUpdated() {
+ if (this->isUpdated) {
+ this->isUpdated = false;
+ return true;
+ }
+ return false;
}
T const& Get() {
this->isUpdated = false;
diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp
index 6aabd30e..d72e8333 100644
--- a/src/displayapp/screens/Steps.cpp
+++ b/src/displayapp/screens/Steps.cpp
@@ -5,13 +5,10 @@
using namespace Pinetime::Applications::Screens;
-Steps::Steps(
- Pinetime::Applications::DisplayApp *app,
- Controllers::MotionController& motionController,
- Controllers::Settings &settingsController)
- : Screen(app),
- motionController{motionController},
- settingsController{settingsController} {
+Steps::Steps(Pinetime::Applications::DisplayApp* app,
+ Controllers::MotionController& motionController,
+ Controllers::Settings& settingsController)
+ : Screen(app), motionController {motionController}, settingsController {settingsController} {
stepsArc = lv_arc_create(lv_scr_act(), nullptr);
@@ -34,12 +31,12 @@ Steps::Steps(
lv_label_set_text_fmt(lSteps, "%li", stepsCount);
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20);
- lv_obj_t * lstepsL = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* lstepsL = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_label_set_text_static(lstepsL, "Steps");
lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
- lv_obj_t * lstepsGoal = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* lstepsGoal = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
lv_label_set_text_fmt(lstepsGoal, "Goal\n%lu", settingsController.GetStepsGoal());
lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER);
@@ -59,10 +56,10 @@ Steps::~Steps() {
bool Steps::Refresh() {
stepsCount = motionController.NbSteps();
-
+
lv_label_set_text_fmt(lSteps, "%li", stepsCount);
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20);
-
+
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal()));
return running;
diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h
index c9d61541..e68a7af6 100644
--- a/src/displayapp/screens/Symbols.h
+++ b/src/displayapp/screens/Symbols.h
@@ -41,6 +41,9 @@ namespace Pinetime {
static constexpr const char* hourGlass = "\xEF\x89\x92";
static constexpr const char* lapsFlag = "\xEF\x80\xA4";
static constexpr const char* drum = "\xEF\x95\xA9";
+ static constexpr const char* chartLine = "\xEF\x88\x81";
+ static constexpr const char* eye = "\xEF\x81\xAE";
+ static constexpr const char* home = "\xEF\x80\x95";
// lv_font_sys_48.c
static constexpr const char* settings = "\xEE\xA4\x82"; // e902
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index f5bf0cc9..e7c5b65a 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -20,6 +20,8 @@ namespace {
return "BMA421";
case Pinetime::Controllers::MotionController::DeviceTypes::BMA425:
return "BMA425";
+ case Pinetime::Controllers::MotionController::DeviceTypes::Unknown:
+ return "???";
}
return "???";
}
@@ -70,11 +72,6 @@ bool SystemInfo::Refresh() {
return running;
}
-bool SystemInfo::OnButtonPushed() {
- running = false;
- return true;
-}
-
bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event);
}
@@ -212,28 +209,50 @@ bool SystemInfo::sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) {
std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
TaskStatus_t tasksStatus[7];
lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL);
- lv_table_set_col_cnt(infoTask, 3);
+ lv_table_set_col_cnt(infoTask, 4);
lv_table_set_row_cnt(infoTask, 8);
- lv_obj_set_pos(infoTask, 10, 10);
+ lv_obj_set_pos(infoTask, 0, 10);
lv_table_set_cell_value(infoTask, 0, 0, "#");
- lv_table_set_col_width(infoTask, 0, 50);
- lv_table_set_cell_value(infoTask, 0, 1, "Task");
- lv_table_set_col_width(infoTask, 1, 80);
- lv_table_set_cell_value(infoTask, 0, 2, "Free");
- lv_table_set_col_width(infoTask, 2, 90);
+ lv_table_set_col_width(infoTask, 0, 30);
+ lv_table_set_cell_value(infoTask, 0, 1, "S"); // State
+ lv_table_set_col_width(infoTask, 1, 30);
+ lv_table_set_cell_value(infoTask, 0, 2, "Task");
+ lv_table_set_col_width(infoTask, 2, 80);
+ lv_table_set_cell_value(infoTask, 0, 3, "Free");
+ lv_table_set_col_width(infoTask, 3, 90);
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);
+ char state[2] = {0};
+ switch (tasksStatus[i].eCurrentState) {
+ case eReady:
+ case eRunning:
+ state[0] = 'R';
+ break;
+ case eBlocked:
+ state[0] = 'B';
+ break;
+ case eSuspended:
+ state[0] = 'S';
+ break;
+ case eDeleted:
+ state[0] = 'D';
+ break;
+ default:
+ state[0] = 'I'; // Invalid
+ break;
+ }
+ lv_table_set_cell_value(infoTask, i + 1, 1, state);
+ lv_table_set_cell_value(infoTask, i + 1, 2, 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());
+ lv_table_set_cell_value(infoTask, i + 1, 3, str1.c_str());
} else {
- lv_table_set_cell_value(infoTask, i + 1, 2, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str());
+ lv_table_set_cell_value(infoTask, i + 1, 3, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str());
}
}
return std::make_unique<Screens::Label>(3, 5, app, infoTask);
diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h
index 9d471f61..a9ad652d 100644
--- a/src/displayapp/screens/SystemInfo.h
+++ b/src/displayapp/screens/SystemInfo.h
@@ -31,12 +31,9 @@ namespace Pinetime {
Pinetime::Controllers::MotionController& motionController);
~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;
@@ -56,4 +53,4 @@ namespace Pinetime {
};
}
}
-} \ No newline at end of file
+}
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index 3eb127cc..d5d6cb80 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -6,15 +6,17 @@ 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);
+ auto* user_data = static_cast<Tile*>(task->user_data);
user_data->UpdateScreen();
}
static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ if (event != LV_EVENT_VALUE_CHANGED) return;
+
Tile* screen = static_cast<Tile*>(obj->user_data);
- uint32_t* eventDataPtr = (uint32_t*) lv_event_get_data();
+ auto* eventDataPtr = (uint32_t*) lv_event_get_data();
uint32_t eventData = *eventDataPtr;
- screen->OnObjectEvent(obj, event, eventData);
+ screen->OnValueChangedEvent(obj, eventData);
}
}
@@ -124,9 +126,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) {
- app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
- running = false;
- }
+void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {
+ if(obj != btnm1) return;
+
+ app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
+ running = false;
}
diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h
index 4ebd81cd..765a8def 100644
--- a/src/displayapp/screens/Tile.h
+++ b/src/displayapp/screens/Tile.h
@@ -32,7 +32,7 @@ namespace Pinetime {
bool Refresh() override;
void UpdateScreen();
- void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId);
+ void OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId);
private:
Pinetime::Controllers::Battery& batteryController;
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index acc2a27a..2cd24876 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -27,7 +27,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
batteryController {batteryController},
dateTimeController {dateTimeController},
brightness {brightness},
- motorController{motorController},
+ motorController {motorController},
settingsController {settingsController} {
// Time
@@ -154,17 +154,6 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
}
}
-bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- switch (event) {
- case Pinetime::Applications::TouchEvents::SwipeLeft:
- running = false;
- return false;
-
- default:
- return true;
- }
-}
-
bool QuickSettings::Refresh() {
return running;
}
diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h
index a14f46bf..e0fc0a87 100644
--- a/src/displayapp/screens/settings/QuickSettings.h
+++ b/src/displayapp/screens/settings/QuickSettings.h
@@ -29,7 +29,6 @@ namespace Pinetime {
bool Refresh() override;
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
void UpdateScreen();
diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp
index 89f0c098..cce9a60d 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.cpp
+++ b/src/displayapp/screens/settings/SettingWakeUp.cpp
@@ -16,7 +16,7 @@ namespace {
SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: Screen(app), settingsController {settingsController} {
-
+ ignoringEvents = false;
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);
@@ -36,24 +36,16 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
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_text_static(icon, Symbols::eye);
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], " None");
- cbOption[optionsTotal]->user_data = this;
- 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) {
+ if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -61,7 +53,7 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
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) {
+ if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -69,7 +61,7 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
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) {
+ if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist)) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -85,27 +77,31 @@ bool SettingWakeUp::Refresh() {
}
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);
+ using WakeUpMode = Pinetime::Controllers::Settings::WakeUpMode;
+ if (event == LV_EVENT_VALUE_CHANGED && !ignoringEvents) {
+ ignoringEvents = 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);
- };
-
- } else {
- lv_checkbox_set_checked(cbOption[i], false);
+ // Find the index of the checkbox that triggered the event
+ int index = 0;
+ for (; index < optionsTotal; ++index) {
+ if (cbOption[index] == object) {
+ break;
}
}
+
+ // Toggle needed wakeup mode
+ auto mode = static_cast<WakeUpMode>(index);
+ auto currentState = settingsController.isWakeUpModeOn(mode);
+ settingsController.setWakeUpMode(mode, !currentState);
+
+ // Update checkbox according to current wakeup modes.
+ // This is needed because we can have extra logic when setting or unsetting wakeup modes,
+ // for example, when setting SingleTap, DoubleTap is unset and vice versa.
+ auto modes = settingsController.getWakeUpModes();
+ for (int i = 0; i < optionsTotal; ++i) {
+ lv_checkbox_set_checked(cbOption[i], modes[i]);
+ }
+
+ ignoringEvents = false;
}
-} \ No newline at end of file
+}
diff --git a/src/displayapp/screens/settings/SettingWakeUp.h b/src/displayapp/screens/settings/SettingWakeUp.h
index 8b33eb06..248dd9ac 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.h
+++ b/src/displayapp/screens/settings/SettingWakeUp.h
@@ -22,6 +22,11 @@ namespace Pinetime {
Controllers::Settings& settingsController;
uint8_t optionsTotal;
lv_obj_t* cbOption[4];
+ // When UpdateSelected is called, it uses lv_checkbox_set_checked,
+ // which can cause extra events to be fired,
+ // which might trigger UpdateSelected again, causing a loop.
+ // This variable is used as a mutex to prevent that.
+ bool ignoringEvents;
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index 3e73489d..02b90816 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -36,7 +36,7 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine
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_text_static(icon, Symbols::home);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
@@ -90,4 +90,4 @@ void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) {
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp
index e63a3584..0ab21377 100644
--- a/src/displayapp/screens/settings/Settings.cpp
+++ b/src/displayapp/screens/settings/Settings.cpp
@@ -41,9 +41,9 @@ 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::eye, "Wake Up", Apps::SettingWakeUp},
{Symbols::clock, "Time format", Apps::SettingTimeFormat},
- {Symbols::clock, "Watch face", Apps::SettingWatchFace},
+ {Symbols::home, "Watch face", Apps::SettingWatchFace},
}};
return std::make_unique<Screens::List>(0, 2, app, settingsController, applications);