Clear ongoing taps when going to sleep

This commit is contained in:
mark9064 2024-08-22 16:53:18 +01:00
parent 8598142c27
commit ebe20c2117
3 changed files with 14 additions and 0 deletions

View file

@ -314,6 +314,10 @@ void DisplayApp::Refresh() {
} else {
lcd.Sleep();
}
// Clear any ongoing touch pressed events
// Without this LVGL gets stuck in the pressed state and will keep refreshing the
// display activity timer causing the screen to never sleep after timeout
lvgl.ClearTouchState();
PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping);
state = States::Idle;
break;

View file

@ -248,6 +248,8 @@ void LittleVgl::SetNewTouchPoint(int16_t x, int16_t y, bool contact) {
}
}
// Cancel an ongoing tap
// Signifies that LVGL should not handle the current tap
void LittleVgl::CancelTap() {
if (tapped) {
isCancelled = true;
@ -255,6 +257,13 @@ void LittleVgl::CancelTap() {
}
}
// Clear the current tapped state
// Signifies that touch input processing is suspended
void LittleVgl::ClearTouchState() {
touchPoint = {-1, -1};
tapped = false;
}
bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) {
ptr->point.x = touchPoint.x;
ptr->point.y = touchPoint.y;

View file

@ -26,6 +26,7 @@ namespace Pinetime {
void SetFullRefresh(FullRefreshDirections direction);
void SetNewTouchPoint(int16_t x, int16_t y, bool contact);
void CancelTap();
void ClearTouchState();
bool GetFullRefresh() {
bool returnValue = fullRefresh;