From e57ff28231cf0ace25c114b8768174087f288dc7 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 29 Aug 2021 12:40:48 +0300 Subject: [PATCH 1/2] Let lvgl control queueTimeout --- src/displayapp/DisplayApp.cpp | 24 ++++-------------------- src/displayapp/DisplayApp.h | 2 -- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index d6100ece..675162a1 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -141,19 +141,15 @@ uint32_t count = 0; bool toggle = true; void DisplayApp::Refresh() { TickType_t queueTimeout; - TickType_t delta; switch (state) { case States::Idle: - IdleState(); queueTimeout = portMAX_DELAY; break; case States::Running: - RunningState(); - delta = xTaskGetTickCount() - lastWakeTime; - if (delta > LV_DISP_DEF_REFR_PERIOD) { - delta = LV_DISP_DEF_REFR_PERIOD; + if (!currentScreen->IsRunning()) { + LoadApp(returnToApp, returnDirection); } - queueTimeout = LV_DISP_DEF_REFR_PERIOD - delta; + queueTimeout = lv_task_handler(); break; default: queueTimeout = portMAX_DELAY; @@ -161,9 +157,7 @@ void DisplayApp::Refresh() { } Messages msg; - bool messageReceived = xQueueReceive(msgQueue, &msg, queueTimeout); - lastWakeTime = xTaskGetTickCount(); - if (messageReceived) { + if (xQueueReceive(msgQueue, &msg, queueTimeout)) { switch (msg) { case Messages::DimScreen: // Backup brightness is the brightness to return to after dimming or sleeping @@ -275,13 +269,6 @@ void DisplayApp::Refresh() { } } -void DisplayApp::RunningState() { - if (!currentScreen->IsRunning()) { - LoadApp(returnToApp, returnDirection); - } - lv_task_handler(); -} - void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) { nextApp = app; nextDirection = direction; @@ -423,9 +410,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) currentApp = app; } -void DisplayApp::IdleState() { -} - void DisplayApp::PushMessage(Messages msg) { if (in_isr()) { BaseType_t xHigherPriorityTaskWoken; diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 96951d1c..b9e471bd 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -103,8 +103,6 @@ namespace Pinetime { TouchEvents returnTouchEvent = TouchEvents::None; TouchEvents GetGesture(); - void RunningState(); - void IdleState(); static void Process(void* instance); void InitHw(); void Refresh(); From d7dfe5d4edd89d6cbc1cf02b3681811f17da774a Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Tue, 21 Sep 2021 15:36:31 +0300 Subject: [PATCH 2/2] Remove unused variable --- src/displayapp/DisplayApp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index b9e471bd..3000285c 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -112,7 +112,6 @@ namespace Pinetime { Apps nextApp = Apps::None; DisplayApp::FullRefreshDirections nextDirection; - TickType_t lastWakeTime; }; } }