Skip to content

Commit

Permalink
Fix broken auto sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Feb 7, 2024
1 parent 716f934 commit fb928d2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CYD-Klipper/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"initializer_list": "cpp",
"algorithm": "cpp",
"cstddef": "cpp",
"functional": "cpp"
"functional": "cpp",
"*.tcc": "cpp"
}
}
2 changes: 2 additions & 0 deletions CYD-Klipper/src/core/device/ESP32-2432S028R.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ void screen_lv_touchRead(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
return;
}

screen_timer_wake();

TS_Point p = touchscreen_point();
data->state = LV_INDEV_STATE_PR;
data->point.x = p.x;
Expand Down
17 changes: 11 additions & 6 deletions CYD-Klipper/src/core/device/ESP32-3248S035C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ void screen_lv_touchRead(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
}
else
{
if (is_screen_asleep())
{
screen_timer_wake();
while (tp.isTouched) {
tp.read();
}
return;
}

screen_timer_wake();

data->state = LV_INDEV_STATE_PR;
for (int i = 0; i < tp.touches; i++)
{
Expand All @@ -74,12 +85,6 @@ void screen_lv_touchRead(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
data->point.x = magicX;
data->point.y = magicY;
}

if (is_screen_asleep())
{
screen_timer_wake();
}

}
}

Expand Down
5 changes: 5 additions & 0 deletions CYD-Klipper/src/core/lv_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ void set_screen_brightness()
void screen_timer_wake()
{
lv_timer_reset(screenSleepTimer);

if (!isScreenInSleep){
return;
}

isScreenInSleep = false;
set_screen_brightness();

Expand Down

0 comments on commit fb928d2

Please sign in to comment.