Clear ongoing taps when going to sleep

This commit is contained in:
mark9064 2024-08-22 16:53:18 +01:00 committed by JF
parent cfaad261dc
commit 1808634f0e
3 changed files with 14 additions and 0 deletions

View File

@ -313,6 +313,10 @@ void DisplayApp::Refresh() {
while (!lv_task_handler()) { while (!lv_task_handler()) {
}; };
} }
// 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();
if (msg == Messages::GoToAOD) { if (msg == Messages::GoToAOD) {
lcd.LowPowerOn(); lcd.LowPowerOn();
// Record idle entry time // Record idle entry time

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() { void LittleVgl::CancelTap() {
if (tapped) { if (tapped) {
isCancelled = true; 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) { bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) {
ptr->point.x = touchPoint.x; ptr->point.x = touchPoint.x;
ptr->point.y = touchPoint.y; ptr->point.y = touchPoint.y;

View File

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