Skip to content

Commit 1808634

Browse files
mark9064JF002
authored andcommitted
Clear ongoing taps when going to sleep
1 parent cfaad26 commit 1808634

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/displayapp/DisplayApp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ void DisplayApp::Refresh() {
313313
while (!lv_task_handler()) {
314314
};
315315
}
316+
// Clear any ongoing touch pressed events
317+
// Without this LVGL gets stuck in the pressed state and will keep refreshing the
318+
// display activity timer causing the screen to never sleep after timeout
319+
lvgl.ClearTouchState();
316320
if (msg == Messages::GoToAOD) {
317321
lcd.LowPowerOn();
318322
// Record idle entry time

src/displayapp/LittleVgl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,22 @@ void LittleVgl::SetNewTouchPoint(int16_t x, int16_t y, bool contact) {
248248
}
249249
}
250250

251+
// Cancel an ongoing tap
252+
// Signifies that LVGL should not handle the current tap
251253
void LittleVgl::CancelTap() {
252254
if (tapped) {
253255
isCancelled = true;
254256
touchPoint = {-1, -1};
255257
}
256258
}
257259

260+
// Clear the current tapped state
261+
// Signifies that touch input processing is suspended
262+
void LittleVgl::ClearTouchState() {
263+
touchPoint = {-1, -1};
264+
tapped = false;
265+
}
266+
258267
bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) {
259268
ptr->point.x = touchPoint.x;
260269
ptr->point.y = touchPoint.y;

src/displayapp/LittleVgl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace Pinetime {
2626
void SetFullRefresh(FullRefreshDirections direction);
2727
void SetNewTouchPoint(int16_t x, int16_t y, bool contact);
2828
void CancelTap();
29+
void ClearTouchState();
2930

3031
bool GetFullRefresh() {
3132
bool returnValue = fullRefresh;

0 commit comments

Comments
 (0)