Comment out v7 code to be reviewed

This commit is contained in:
fvanroie 2021-07-21 19:50:40 +02:00
parent bdfa400809
commit d71a59d9fc
2 changed files with 44 additions and 25 deletions

View File

@ -719,16 +719,18 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at
// result = false;
return HASP_ATTR_TYPE_NOT_FOUND;
}
#endif
#if LV_USE_ARC
static hasp_attribute_type_t hasp_process_arc_attribute(lv_obj_t* obj, uint16_t attr_hash, int32_t& val, bool update)
{
// We already know it's a arc object
switch(attr_hash) {
case ATTR_TYPE:
if(update)
lv_arc_set_type(obj, val % 3);
lv_arc_set_mode(obj, val % 3);
else
val = lv_arc_get_type(obj);
val = lv_arc_get_mode(obj);
break;
default:
@ -737,7 +739,9 @@ static hasp_attribute_type_t hasp_process_arc_attribute(lv_obj_t* obj, uint16_t
return HASP_ATTR_TYPE_INT;
}
#endif
#if LVGL_VERSION_MAJOR == 7
static hasp_attribute_type_t hasp_process_lmeter_attribute(lv_obj_t* obj, uint16_t attr_hash, int32_t& val, bool update)
{
// We already know it's a linemeter object
@ -949,7 +953,7 @@ static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* pa
static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* attr, const char* payload, char** text,
bool update)
{
lv_text_align_t val;
lv_text_align_t val = LV_TEXT_ALIGN_AUTO;
if(update) {
if(!strcasecmp_P(payload, PSTR("left"))) {
@ -1529,6 +1533,7 @@ static hasp_attribute_type_t attribute_common_range(lv_obj_t* obj, int32_t& val,
return HASP_ATTR_TYPE_INT;
}
#endif
// ##################### Default Attributes ########################################################
@ -1579,8 +1584,6 @@ static hasp_attribute_type_t attribute_common_method(lv_obj_t* obj, uint16_t att
return HASP_ATTR_TYPE_METHOD_OK;
}
#endif
static hasp_attribute_type_t attribute_common_text(lv_obj_t* obj, const char* attr, const char* payload, char** text,
bool update)
{
@ -2068,12 +2071,12 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
if(ret == HASP_ATTR_TYPE_NOT_FOUND) {
switch(obj_get_type(obj)) { // Properties by object type
#if LV_USE_ARC
case LV_HASP_ARC:
val = strtol(payload, nullptr, DEC);
// ret = hasp_process_arc_attribute(obj, attr_hash, val, update);
ret = hasp_process_arc_attribute(obj, attr_hash, val, update);
break;
#endif
case LV_HASP_GAUGE:
val = strtol(payload, nullptr, DEC);
// ret = hasp_process_gauge_attribute(obj, attr_hash, val, update);
@ -2084,11 +2087,13 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
// ret = hasp_process_lmeter_attribute(obj, attr_hash, val, update);
break;
#if LV_USE_LINE
case LV_HASP_LINE:
// if(attr_hash == ATTR_POINTS)
// ret = my_line_set_points(obj, payload) ? HASP_ATTR_TYPE_METHOD_OK : HASP_ATTR_TYPE_RANGE_ERROR;
break;
#endif
#if LV_USE_COLORWHEEL
case LV_HASP_CPICKER:
if(attr_hash == ATTR_COLOR) {
if(update) {
@ -2101,7 +2106,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
ret = HASP_ATTR_TYPE_COLOR;
}
break;
#endif
default:
break; // not found
}

View File

@ -312,21 +312,22 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
uint8_t objid = 0;
switch(sdbm) {
/* ----- Basic Objects ------ */
// case LV_HASP_BTNMATRIX:
// case HASP_OBJ_BTNMATRIX:
// objid = LV_HASP_BTNMATRIX;
// obj = lv_btnmatrix_create(parent_obj);
// if(obj) {
// lv_btnmatrix_set_recolor(obj, true);
// lv_obj_set_event_cb(obj, btnmatrix_event_handler);
/* ----- Basic Objects ------ */
// case LV_HASP_BTNMATRIX:
// case HASP_OBJ_BTNMATRIX:
// objid = LV_HASP_BTNMATRIX;
// obj = lv_btnmatrix_create(parent_obj);
// if(obj) {
// lv_btnmatrix_set_recolor(obj, true);
// lv_obj_set_event_cb(obj, btnmatrix_event_handler);
// lv_btnmatrix_ext_t* ext = (lv_btnmatrix_ext_t*)lv_obj_get_ext_attr(obj);
// btnmatrix_default_map = ext->map_p; // store the static pointer to the default lvgl btnmap
// // obj->user_data.objid = LV_HASP_BTNMATRIX;
// }
// break;
// lv_btnmatrix_ext_t* ext = (lv_btnmatrix_ext_t*)lv_obj_get_ext_attr(obj);
// btnmatrix_default_map = ext->map_p; // store the static pointer to the default lvgl btnmap
// // obj->user_data.objid = LV_HASP_BTNMATRIX;
// }
// break;
#if LV_USE_TABLE
case LV_HASP_TABLE:
case HASP_OBJ_TABLE:
objid = LV_HASP_TABLE;
@ -336,7 +337,9 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// obj->user_data.objid = LV_HASP_TABLE;
}
break;
#endif
#if LV_USE_BTN
case LV_HASP_BUTTON:
case HASP_OBJ_BTN:
objid = LV_HASP_BUTTON;
@ -353,7 +356,9 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// obj->user_data.objid = LV_HASP_BUTTON;
}
break;
#endif
#if LV_USE_CHECKBOX
case LV_HASP_CHECKBOX:
case HASP_OBJ_CHECKBOX:
objid = LV_HASP_CHECKBOX;
@ -363,7 +368,9 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// obj->user_data.objid = LV_HASP_CHECKBOX;
}
break;
#endif
#if LV_USE_LABEL
case LV_HASP_LABEL:
case HASP_OBJ_LABEL:
objid = LV_HASP_LABEL;
@ -377,7 +384,9 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// object_add_task(obj, pageid, id, event_timer_clock, 1000);
}
break;
#endif
#if LV_USE_IMAGE
case LV_HASP_IMAGE:
case HASP_OBJ_IMG:
objid = LV_HASP_IMAGE;
@ -387,7 +396,9 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// obj->user_data.objid = LV_HASP_IMAGE;
}
break;
#endif
#if LV_USE_ARC
case LV_HASP_ARC:
case HASP_OBJ_ARC:
objid = LV_HASP_ARC;
@ -397,6 +408,7 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// obj->user_data.objid = LV_HASP_ARC;
}
break;
#endif
case LV_HASP_CONTAINER:
case HASP_OBJ_CONT:
@ -434,7 +446,6 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// if(obj) obj->user_data.objid = LV_HASP_WINDOW;
// No event handler for pages
break;
#endif
#if LVGL_VERSION_MAJOR == 8
@ -514,7 +525,9 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
break;
#endif
/* ----- Color Objects ------ */
/* ----- Color Objects ------ */
#if LV_USE_COLORWHEEL
case LV_HASP_CPICKER:
case HASP_OBJ_CPICKER:
objid = LV_HASP_CPICKER;
@ -524,6 +537,7 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
// obj->user_data.objid = LV_HASP_CPICKER;
}
break;
#endif
#if LV_USE_SPINNER != 0
case LV_HASP_SPINNER: