Skip to content

Commit b84a546

Browse files
authored
Merge pull request #623 from Riksu9000/lvgl_queuetimeout
Let LVGL control queueTimeout
2 parents fa6c291 + d7dfe5d commit b84a546

2 files changed

Lines changed: 4 additions & 23 deletions

File tree

src/displayapp/DisplayApp.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,29 +141,23 @@ void DisplayApp::InitHw() {
141141

142142
void DisplayApp::Refresh() {
143143
TickType_t queueTimeout;
144-
TickType_t delta;
145144
switch (state) {
146145
case States::Idle:
147-
IdleState();
148146
queueTimeout = portMAX_DELAY;
149147
break;
150148
case States::Running:
151-
RunningState();
152-
delta = xTaskGetTickCount() - lastWakeTime;
153-
if (delta > LV_DISP_DEF_REFR_PERIOD) {
154-
delta = LV_DISP_DEF_REFR_PERIOD;
149+
if (!currentScreen->IsRunning()) {
150+
LoadApp(returnToApp, returnDirection);
155151
}
156-
queueTimeout = LV_DISP_DEF_REFR_PERIOD - delta;
152+
queueTimeout = lv_task_handler();
157153
break;
158154
default:
159155
queueTimeout = portMAX_DELAY;
160156
break;
161157
}
162158

163159
Messages msg;
164-
bool messageReceived = xQueueReceive(msgQueue, &msg, queueTimeout);
165-
lastWakeTime = xTaskGetTickCount();
166-
if (messageReceived) {
160+
if (xQueueReceive(msgQueue, &msg, queueTimeout)) {
167161
switch (msg) {
168162
case Messages::DimScreen:
169163
// Backup brightness is the brightness to return to after dimming or sleeping
@@ -279,13 +273,6 @@ void DisplayApp::Refresh() {
279273
}
280274
}
281275

282-
void DisplayApp::RunningState() {
283-
if (!currentScreen->IsRunning()) {
284-
LoadApp(returnToApp, returnDirection);
285-
}
286-
lv_task_handler();
287-
}
288-
289276
void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) {
290277
nextApp = app;
291278
nextDirection = direction;
@@ -430,9 +417,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
430417
currentApp = app;
431418
}
432419

433-
void DisplayApp::IdleState() {
434-
}
435-
436420
void DisplayApp::PushMessage(Messages msg) {
437421
if (in_isr()) {
438422
BaseType_t xHigherPriorityTaskWoken;

src/displayapp/DisplayApp.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ namespace Pinetime {
107107
TouchEvents returnTouchEvent = TouchEvents::None;
108108

109109
TouchEvents GetGesture();
110-
void RunningState();
111-
void IdleState();
112110
static void Process(void* instance);
113111
void InitHw();
114112
void Refresh();
@@ -118,7 +116,6 @@ namespace Pinetime {
118116

119117
Apps nextApp = Apps::None;
120118
DisplayApp::FullRefreshDirections nextDirection;
121-
TickType_t lastWakeTime;
122119
};
123120
}
124121
}

0 commit comments

Comments
 (0)