mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Require a wakeup touch when backlight is off
This commit is contained in:
parent
72a9afd6a9
commit
3c92b61cfa
@ -127,6 +127,13 @@ bool hasp_update_sleep_state()
|
||||
return (hasp_sleep_state != HASP_SLEEP_OFF);
|
||||
}
|
||||
|
||||
void hasp_enable_wakeup_touch()
|
||||
{
|
||||
LOG_VERBOSE(TAG_HASP,F("Wakeup touch enabled"));
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true); // enable first touch
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), wakeup_event_handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sleep times
|
||||
*/
|
||||
|
@ -73,6 +73,7 @@ lv_font_t * hasp_get_font(uint8_t fontid);
|
||||
bool hasp_update_sleep_state();
|
||||
void hasp_get_sleep_time(uint16_t & short_time, uint16_t & long_time);
|
||||
void hasp_set_sleep_time(uint16_t short_time, uint16_t long_time);
|
||||
void hasp_enable_wakeup_touch();
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -349,7 +349,11 @@ void wakeup_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
{
|
||||
if(obj == lv_disp_get_layer_sys(NULL)) {
|
||||
hasp_update_sleep_state(); // wakeup?
|
||||
lv_obj_set_click(obj, false); // disable fist click
|
||||
|
||||
if(event == LV_EVENT_CLICKED) {
|
||||
lv_obj_set_click(obj, false); // disable first touch
|
||||
LOG_VERBOSE(TAG_HASP, F("Wakeup touch disabled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,6 +448,8 @@ void guiSetBacklight(bool lighton)
|
||||
{
|
||||
guiBacklightIsOn = lighton;
|
||||
|
||||
if(!lighton) hasp_enable_wakeup_touch();
|
||||
|
||||
if(guiBacklightPin >= 0) {
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
|
Loading…
x
Reference in New Issue
Block a user