Merge pull request #623 from Riksu9000/lvgl_queuetimeout
Let LVGL control queueTimeout
This commit is contained in:
commit
b84a546920
|
@ -141,19 +141,15 @@ void DisplayApp::InitHw() {
|
||||||
|
|
||||||
void DisplayApp::Refresh() {
|
void DisplayApp::Refresh() {
|
||||||
TickType_t queueTimeout;
|
TickType_t queueTimeout;
|
||||||
TickType_t delta;
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case States::Idle:
|
case States::Idle:
|
||||||
IdleState();
|
|
||||||
queueTimeout = portMAX_DELAY;
|
queueTimeout = portMAX_DELAY;
|
||||||
break;
|
break;
|
||||||
case States::Running:
|
case States::Running:
|
||||||
RunningState();
|
if (!currentScreen->IsRunning()) {
|
||||||
delta = xTaskGetTickCount() - lastWakeTime;
|
LoadApp(returnToApp, returnDirection);
|
||||||
if (delta > LV_DISP_DEF_REFR_PERIOD) {
|
|
||||||
delta = LV_DISP_DEF_REFR_PERIOD;
|
|
||||||
}
|
}
|
||||||
queueTimeout = LV_DISP_DEF_REFR_PERIOD - delta;
|
queueTimeout = lv_task_handler();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
queueTimeout = portMAX_DELAY;
|
queueTimeout = portMAX_DELAY;
|
||||||
|
@ -161,9 +157,7 @@ void DisplayApp::Refresh() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages msg;
|
Messages msg;
|
||||||
bool messageReceived = xQueueReceive(msgQueue, &msg, queueTimeout);
|
if (xQueueReceive(msgQueue, &msg, queueTimeout)) {
|
||||||
lastWakeTime = xTaskGetTickCount();
|
|
||||||
if (messageReceived) {
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case Messages::DimScreen:
|
case Messages::DimScreen:
|
||||||
// Backup brightness is the brightness to return to after dimming or sleeping
|
// Backup brightness is the brightness to return to after dimming or sleeping
|
||||||
|
@ -279,13 +273,6 @@ void DisplayApp::Refresh() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::RunningState() {
|
|
||||||
if (!currentScreen->IsRunning()) {
|
|
||||||
LoadApp(returnToApp, returnDirection);
|
|
||||||
}
|
|
||||||
lv_task_handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) {
|
void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) {
|
||||||
nextApp = app;
|
nextApp = app;
|
||||||
nextDirection = direction;
|
nextDirection = direction;
|
||||||
|
@ -430,9 +417,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||||
currentApp = app;
|
currentApp = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::IdleState() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayApp::PushMessage(Messages msg) {
|
void DisplayApp::PushMessage(Messages msg) {
|
||||||
if (in_isr()) {
|
if (in_isr()) {
|
||||||
BaseType_t xHigherPriorityTaskWoken;
|
BaseType_t xHigherPriorityTaskWoken;
|
||||||
|
|
|
@ -107,8 +107,6 @@ namespace Pinetime {
|
||||||
TouchEvents returnTouchEvent = TouchEvents::None;
|
TouchEvents returnTouchEvent = TouchEvents::None;
|
||||||
|
|
||||||
TouchEvents GetGesture();
|
TouchEvents GetGesture();
|
||||||
void RunningState();
|
|
||||||
void IdleState();
|
|
||||||
static void Process(void* instance);
|
static void Process(void* instance);
|
||||||
void InitHw();
|
void InitHw();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
@ -118,7 +116,6 @@ namespace Pinetime {
|
||||||
|
|
||||||
Apps nextApp = Apps::None;
|
Apps nextApp = Apps::None;
|
||||||
DisplayApp::FullRefreshDirections nextDirection;
|
DisplayApp::FullRefreshDirections nextDirection;
|
||||||
TickType_t lastWakeTime;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user