Adjust displayapp delay to compensate time spent (#482)
This commit is contained in:
parent
af10747c94
commit
a5616b0bc8
|
@ -114,6 +114,7 @@ uint32_t count = 0;
|
||||||
bool toggle = true;
|
bool toggle = true;
|
||||||
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();
|
IdleState();
|
||||||
|
@ -121,7 +122,11 @@ void DisplayApp::Refresh() {
|
||||||
break;
|
break;
|
||||||
case States::Running:
|
case States::Running:
|
||||||
RunningState();
|
RunningState();
|
||||||
queueTimeout = 20;
|
delta = xTaskGetTickCount() - lastWakeTime;
|
||||||
|
if (delta > 20) {
|
||||||
|
delta = 20;
|
||||||
|
}
|
||||||
|
queueTimeout = 20 - delta;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
queueTimeout = portMAX_DELAY;
|
queueTimeout = portMAX_DELAY;
|
||||||
|
@ -129,7 +134,9 @@ void DisplayApp::Refresh() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages msg;
|
Messages msg;
|
||||||
if (xQueueReceive(msgQueue, &msg, queueTimeout)) {
|
bool messageReceived = xQueueReceive(msgQueue, &msg, queueTimeout);
|
||||||
|
lastWakeTime = xTaskGetTickCount();
|
||||||
|
if (messageReceived) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case Messages::GoToSleep:
|
case Messages::GoToSleep:
|
||||||
brightnessController.Backup();
|
brightnessController.Backup();
|
||||||
|
|
|
@ -114,6 +114,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
Apps nextApp = Apps::None;
|
Apps nextApp = Apps::None;
|
||||||
DisplayApp::FullRefreshDirections nextDirection;
|
DisplayApp::FullRefreshDirections nextDirection;
|
||||||
|
TickType_t lastWakeTime;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue