summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-06-12 10:58:28 +0200
committerJean-François Milants <jf@codingfield.com>2021-06-12 10:58:28 +0200
commit6d524ebea2c97e309633d5e01c3a1e37c182f27d (patch)
tree3f9c7f96f0fab64f581035c72480596a4cc4db43 /src/displayapp
parentb1925ff28638dd4b8400c4d0c49d796d8990b1af (diff)
Move most of the code from the constructor of the objects statically initialized in main() into Start()/Init() functions to avoid Static Initialization Order Fiasco (https://en.cppreference.com/w/cpp/language/siof). See https://github.com/JF002/InfiniTime/pull/415#issuecomment-859004238.
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp6
-rw-r--r--src/displayapp/DisplayAppRecovery.cpp3
-rw-r--r--src/displayapp/LittleVgl.cpp4
-rw-r--r--src/displayapp/LittleVgl.h2
4 files changed, 12 insertions, 3 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 3bfaf2a2..05f171be 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -77,12 +77,14 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
motorController {motorController},
motionController {motionController},
timerController {timerController} {
+}
+
+void DisplayApp::Start() {
msgQueue = xQueueCreate(queueSize, itemSize);
+
// Start clock when smartwatch boots
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None);
-}
-void DisplayApp::Start() {
if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp
index b73d0a85..fd517b11 100644
--- a/src/displayapp/DisplayAppRecovery.cpp
+++ b/src/displayapp/DisplayAppRecovery.cpp
@@ -21,10 +21,11 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::MotionController& motionController,
Pinetime::Controllers::TimerController& timerController)
: lcd {lcd}, bleController {bleController} {
- msgQueue = xQueueCreate(queueSize, itemSize);
+
}
void DisplayApp::Start() {
+ msgQueue = xQueueCreate(queueSize, itemSize);
if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 512, this, 0, &taskHandle))
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp
index 36df51b4..c069afa2 100644
--- a/src/displayapp/LittleVgl.cpp
+++ b/src/displayapp/LittleVgl.cpp
@@ -23,6 +23,10 @@ bool touchpad_read(lv_indev_drv_t* indev_drv, lv_indev_data_t* data) {
LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel)
: lcd {lcd}, touchPanel {touchPanel}, previousClick {0, 0} {
+
+}
+
+void LittleVgl::Init() {
lv_init();
InitTheme();
InitDisplay();
diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h
index 7f7b76e0..41f934a7 100644
--- a/src/displayapp/LittleVgl.h
+++ b/src/displayapp/LittleVgl.h
@@ -19,6 +19,8 @@ namespace Pinetime {
LittleVgl(LittleVgl&&) = delete;
LittleVgl& operator=(LittleVgl&&) = delete;
+ void Init();
+
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p);
bool GetTouchPadInfo(lv_indev_data_t* ptr);
void SetFullRefresh(FullRefreshDirections direction);