mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 05:06:44 +00:00
Remove template task when label is deleted #446
This commit is contained in:
parent
e783544a9c
commit
e20e9fe500
@ -25,6 +25,7 @@ void my_btnmatrix_map_clear(lv_obj_t* obj);
|
|||||||
void my_msgbox_map_clear(lv_obj_t* obj);
|
void my_msgbox_map_clear(lv_obj_t* obj);
|
||||||
void my_line_clear_points(lv_obj_t* obj);
|
void my_line_clear_points(lv_obj_t* obj);
|
||||||
void my_image_release_resources(lv_obj_t* obj);
|
void my_image_release_resources(lv_obj_t* obj);
|
||||||
|
void my_obj_del_task(const lv_obj_t* obj);
|
||||||
|
|
||||||
void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload, bool update);
|
void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload, bool update);
|
||||||
|
|
||||||
|
@ -69,8 +69,6 @@ void delete_event_handler(lv_obj_t* obj, lv_event_t event)
|
|||||||
{
|
{
|
||||||
if(event != LV_EVENT_DELETE) return;
|
if(event != LV_EVENT_DELETE) return;
|
||||||
|
|
||||||
uint8_t part_cnt = LV_OBJ_PART_MAIN;
|
|
||||||
|
|
||||||
switch(obj_get_type(obj)) {
|
switch(obj_get_type(obj)) {
|
||||||
case LV_HASP_LINE:
|
case LV_HASP_LINE:
|
||||||
my_line_clear_points(obj);
|
my_line_clear_points(obj);
|
||||||
@ -91,11 +89,16 @@ void delete_event_handler(lv_obj_t* obj, lv_event_t event)
|
|||||||
case LV_HASP_GAUGE:
|
case LV_HASP_GAUGE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LV_HASP_LABEL:
|
||||||
|
my_obj_del_task(obj);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: delete value_str data for ALL parts
|
// TODO: delete value_str data for ALL parts
|
||||||
|
uint8_t part_cnt = LV_OBJ_PART_MAIN;
|
||||||
for(uint8_t part = 0; part <= part_cnt; part++) {
|
for(uint8_t part = 0; part <= part_cnt; part++) {
|
||||||
my_obj_set_value_str_text(obj, part, LV_STATE_DEFAULT, NULL);
|
my_obj_set_value_str_text(obj, part, LV_STATE_DEFAULT, NULL);
|
||||||
my_obj_set_value_str_text(obj, part, LV_STATE_CHECKED, NULL);
|
my_obj_set_value_str_text(obj, part, LV_STATE_CHECKED, NULL);
|
||||||
@ -187,7 +190,8 @@ void event_timer_clock(lv_task_t* task)
|
|||||||
// LOG_VERBOSE(TAG_EVENT, "event_timer_clock called with user %d:%d:%d", timeinfo->tm_hour, timeinfo->tm_min,
|
// LOG_VERBOSE(TAG_EVENT, "event_timer_clock called with user %d:%d:%d", timeinfo->tm_hour, timeinfo->tm_min,
|
||||||
// timeinfo->tm_sec);
|
// timeinfo->tm_sec);
|
||||||
|
|
||||||
if(!strcmp(buffer, lv_label_get_text(data->obj))) return; // No change
|
char* cur_text = lv_label_get_text(data->obj);
|
||||||
|
if(!cur_text || !strcmp(buffer, cur_text)) return; // No change
|
||||||
lv_label_set_text(data->obj, buffer);
|
lv_label_set_text(data->obj, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
|
|||||||
lv_obj_set_event_cb(obj, generic_event_handler);
|
lv_obj_set_event_cb(obj, generic_event_handler);
|
||||||
obj->user_data.objid = LV_HASP_LABEL;
|
obj->user_data.objid = LV_HASP_LABEL;
|
||||||
|
|
||||||
if(id >= 250) object_add_task(obj, event_timer_clock, 1000);
|
// if(id >= 250) object_add_task(obj, event_timer_clock, 1000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user