diff options
| author | JF <jf@codingfield.com> | 2021-07-23 09:59:08 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2021-07-23 09:59:08 (GMT) |
| commit | db6a701644116932f11c54ee0f619464de9faeb7 (patch) | |
| tree | f2fb7999d6db212e416557ed12831d8ab38cc3c0 /src/displayapp/DisplayApp.cpp | |
| parent | d96395c81021778af35b8b4bf965bfe8663eb081 (diff) | |
| parent | d6cccc2dcd95a7d332ee657d1357ae060389f6e6 (diff) | |
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
| -rw-r--r-- | src/displayapp/DisplayApp.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index de93428..4d32a7e 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -43,6 +43,8 @@ #include "displayapp/screens/settings/SettingDisplay.h" #include "displayapp/screens/settings/SettingSteps.h" +#include "libs/lv_conf.h" + using namespace Pinetime::Applications; using namespace Pinetime::Applications::Display; @@ -114,6 +116,7 @@ uint32_t count = 0; bool toggle = true; void DisplayApp::Refresh() { TickType_t queueTimeout; + TickType_t delta; switch (state) { case States::Idle: IdleState(); @@ -121,7 +124,11 @@ void DisplayApp::Refresh() { break; case States::Running: RunningState(); - queueTimeout = 20; + delta = xTaskGetTickCount() - lastWakeTime; + if (delta > LV_DISP_DEF_REFR_PERIOD) { + delta = LV_DISP_DEF_REFR_PERIOD; + } + queueTimeout = LV_DISP_DEF_REFR_PERIOD - delta; break; default: queueTimeout = portMAX_DELAY; @@ -129,7 +136,9 @@ void DisplayApp::Refresh() { } Messages msg; - if (xQueueReceive(msgQueue, &msg, queueTimeout)) { + bool messageReceived = xQueueReceive(msgQueue, &msg, queueTimeout); + lastWakeTime = xTaskGetTickCount(); + if (messageReceived) { switch (msg) { case Messages::GoToSleep: brightnessController.Backup(); @@ -168,9 +177,13 @@ void DisplayApp::Refresh() { } break; case Messages::TouchEvent: { - if (state != States::Running) + if (state != States::Running) { break; + } auto gesture = OnTouchEvent(); + if (gesture == TouchEvents::None) { + break; + } if (!currentScreen->OnTouchEvent(gesture)) { if (currentApp == Apps::Clock) { switch (gesture) { @@ -277,6 +290,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) break; case Apps::FirmwareUpdate: currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController); + ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); break; case Apps::Notifications: @@ -337,7 +351,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); break; case Apps::StopWatch: - currentScreen = std::make_unique<Screens::StopWatch>(this); + currentScreen = std::make_unique<Screens::StopWatch>(this, *systemTask); break; case Apps::Twos: currentScreen = std::make_unique<Screens::Twos>(this); |
