mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 21:26:43 +00:00
Fix redraw screen after antiburn stops
This commit is contained in:
parent
5e333e85a4
commit
2618f2c613
@ -184,14 +184,22 @@ void hasp_get_sleep_payload(uint8_t state, char* payload)
|
|||||||
*/
|
*/
|
||||||
static lv_task_t* antiburn_task;
|
static lv_task_t* antiburn_task;
|
||||||
|
|
||||||
void hasp_stop_antiburn()
|
bool hasp_stop_antiburn()
|
||||||
{
|
{
|
||||||
|
bool changed = false;
|
||||||
lv_obj_t* layer = lv_disp_get_layer_sys(NULL);
|
lv_obj_t* layer = lv_disp_get_layer_sys(NULL);
|
||||||
// if(layer) lv_obj_set_style_local_bg_opa(layer, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
|
||||||
if(antiburn_task) lv_task_del(antiburn_task);
|
// if(layer) lv_obj_set_style_local_bg_opa(layer, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||||
|
if(antiburn_task) {
|
||||||
|
lv_task_del(antiburn_task);
|
||||||
|
lv_obj_invalidate(lv_scr_act());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
antiburn_task = NULL;
|
antiburn_task = NULL;
|
||||||
hasp_set_wakeup_touch(haspDevice.get_backlight_power() == false); // enabled if backlight is OFF
|
hasp_set_wakeup_touch(haspDevice.get_backlight_power() == false); // enabled if backlight is OFF
|
||||||
gui_hide_pointer(false);
|
gui_hide_pointer(false);
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hasp_antiburn_cb(lv_task_t* task)
|
void hasp_antiburn_cb(lv_task_t* task)
|
||||||
|
@ -73,7 +73,7 @@ void hasp_set_sleep_time(uint16_t short_time, uint16_t long_time);
|
|||||||
void hasp_set_sleep_offset(uint32_t offset);
|
void hasp_set_sleep_offset(uint32_t offset);
|
||||||
void hasp_set_wakeup_touch(bool en);
|
void hasp_set_wakeup_touch(bool en);
|
||||||
void hasp_set_antiburn(int32_t repeat_count, uint32_t period);
|
void hasp_set_antiburn(int32_t repeat_count, uint32_t period);
|
||||||
void hasp_stop_antiburn();
|
bool hasp_stop_antiburn();
|
||||||
hasp_event_t hasp_get_antiburn();
|
hasp_event_t hasp_get_antiburn();
|
||||||
|
|
||||||
void hasp_init(void);
|
void hasp_init(void);
|
||||||
|
@ -335,20 +335,16 @@ void first_touch_event_handler(lv_obj_t* obj, lv_event_t event)
|
|||||||
// log_event("wakeup", event);
|
// log_event("wakeup", event);
|
||||||
|
|
||||||
if(event == LV_EVENT_RELEASED && obj == lv_disp_get_layer_sys(NULL)) {
|
if(event == LV_EVENT_RELEASED && obj == lv_disp_get_layer_sys(NULL)) {
|
||||||
|
bool changed = hasp_stop_antiburn(); // Disable antiburn task
|
||||||
|
|
||||||
if(!haspDevice.get_backlight_power()) {
|
if(!haspDevice.get_backlight_power()) {
|
||||||
dispatch_backlight(NULL, "on", TAG_EVENT); // backlight on and also disable wakeup touch
|
dispatch_backlight(NULL, "on", TAG_EVENT); // backlight on and also disable wakeup touch
|
||||||
} else {
|
} else {
|
||||||
hasp_set_wakeup_touch(false); // only disable wakeup touch
|
hasp_set_wakeup_touch(false); // only disable wakeup touch
|
||||||
}
|
}
|
||||||
|
|
||||||
// Idle off
|
hasp_update_sleep_state(); // wakeup, send Idle off
|
||||||
hasp_update_sleep_state(); // wakeup?
|
if(changed) dispatch_state_antiburn(hasp_get_antiburn()); // publish the new state
|
||||||
|
|
||||||
// Disable antiburn task
|
|
||||||
hasp_event_t old_state = hasp_get_antiburn();
|
|
||||||
hasp_stop_antiburn();
|
|
||||||
hasp_event_t new_state = hasp_get_antiburn();
|
|
||||||
if(old_state != new_state) dispatch_state_antiburn(new_state); // publish the new state
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user