mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Add dropdown properties
This commit is contained in:
parent
d20fac7245
commit
c968b3b6b9
@ -1161,6 +1161,42 @@ static void hasp_process_lmeter_attribute(lv_obj_t* obj, const char* attr_p, uin
|
|||||||
LOG_WARNING(TAG_ATTR, F(D_ATTRIBUTE_UNKNOWN), attr_p);
|
LOG_WARNING(TAG_ATTR, F(D_ATTRIBUTE_UNKNOWN), attr_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hasp_process_dropdown_attribute(lv_obj_t* obj, const char* attr_p, uint16_t attr_hash, const char* payload,
|
||||||
|
bool update)
|
||||||
|
{
|
||||||
|
// We already know it's a gauge object
|
||||||
|
int16_t intval = atoi(payload);
|
||||||
|
uint16_t val = atoi(payload);
|
||||||
|
|
||||||
|
char* attr = (char*)attr_p;
|
||||||
|
if(*attr == '.') attr++; // strip leading '.'
|
||||||
|
|
||||||
|
switch(attr_hash) {
|
||||||
|
case ATTR_DIRECTION:
|
||||||
|
return (update) ? lv_dropdown_set_dir(obj, intval) : hasp_out_int(obj, attr, lv_dropdown_get_dir(obj));
|
||||||
|
|
||||||
|
case ATTR_SYMBOL:
|
||||||
|
return (update) ? lv_dropdown_set_symbol(obj, payload)
|
||||||
|
: hasp_out_str(obj, attr, lv_dropdown_get_symbol(obj));
|
||||||
|
|
||||||
|
case ATTR_OPEN:
|
||||||
|
return lv_dropdown_open(obj);
|
||||||
|
|
||||||
|
case ATTR_CLOSE:
|
||||||
|
return lv_dropdown_close(obj);
|
||||||
|
|
||||||
|
case ATTR_MAX_HEIGHT:
|
||||||
|
return (update) ? lv_dropdown_set_max_height(obj, intval)
|
||||||
|
: hasp_out_int(obj, attr, lv_dropdown_get_max_height(obj));
|
||||||
|
|
||||||
|
case ATTR_SHOW_SELECTED:
|
||||||
|
return (update) ? lv_dropdown_set_show_selected(obj, val)
|
||||||
|
: hasp_out_int(obj, attr, lv_dropdown_get_show_selected(obj));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_WARNING(TAG_ATTR, F(D_ATTRIBUTE_UNKNOWN), attr_p);
|
||||||
|
}
|
||||||
|
|
||||||
static void hasp_process_gauge_attribute(lv_obj_t* obj, const char* attr_p, uint16_t attr_hash, const char* payload,
|
static void hasp_process_gauge_attribute(lv_obj_t* obj, const char* attr_p, uint16_t attr_hash, const char* payload,
|
||||||
bool update)
|
bool update)
|
||||||
{
|
{
|
||||||
@ -1532,6 +1568,10 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
|
|||||||
}
|
}
|
||||||
break; // attribute_found
|
break; // attribute_found
|
||||||
|
|
||||||
|
/* case ATTR_ANIM_TIME:
|
||||||
|
return (update) ? lv_anim_time(obj, val)
|
||||||
|
: hasp_out_int(obj, attr, lv_gauge_get_angle_offset(obj)); */
|
||||||
|
|
||||||
case ATTR_ROWS:
|
case ATTR_ROWS:
|
||||||
if(check_obj_type(obj, LV_HASP_ROLLER)) {
|
if(check_obj_type(obj, LV_HASP_ROLLER)) {
|
||||||
update ? lv_roller_set_visible_row_count(obj, (uint8_t)val)
|
update ? lv_roller_set_visible_row_count(obj, (uint8_t)val)
|
||||||
@ -1653,6 +1693,19 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
|
|||||||
}
|
}
|
||||||
break; // attribute_found
|
break; // attribute_found
|
||||||
|
|
||||||
|
case ATTR_DIRECTION:
|
||||||
|
case ATTR_SYMBOL:
|
||||||
|
case ATTR_OPEN:
|
||||||
|
case ATTR_CLOSE:
|
||||||
|
case ATTR_MAX_HEIGHT:
|
||||||
|
case ATTR_SHOW_SELECTED:
|
||||||
|
if(check_obj_type(obj, LV_HASP_DROPDOWN)) {
|
||||||
|
hasp_process_dropdown_attribute(obj, attr_p, attr_hash, payload, update);
|
||||||
|
} else {
|
||||||
|
goto attribute_not_found;
|
||||||
|
}
|
||||||
|
break; // attribute_found
|
||||||
|
|
||||||
case ATTR_RED: // TODO: remove temp RED
|
case ATTR_RED: // TODO: remove temp RED
|
||||||
if(check_obj_type(obj, LV_HASP_BTNMATRIX)) {
|
if(check_obj_type(obj, LV_HASP_BTNMATRIX)) {
|
||||||
my_btnmatrix_map_clear(obj); // TODO : remove this test property
|
my_btnmatrix_map_clear(obj); // TODO : remove this test property
|
||||||
|
@ -286,6 +286,7 @@ _HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t)
|
|||||||
#define ATTR_TEXT 53869
|
#define ATTR_TEXT 53869
|
||||||
#define ATTR_SRC 4964
|
#define ATTR_SRC 4964
|
||||||
#define ATTR_ID 6715
|
#define ATTR_ID 6715
|
||||||
|
#define ATTR_ANIM_TIME 59451
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
#define ATTR_DELETE 50027
|
#define ATTR_DELETE 50027
|
||||||
@ -308,6 +309,14 @@ _HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t)
|
|||||||
#define ATTR_START_ANGLE1 39067
|
#define ATTR_START_ANGLE1 39067
|
||||||
#define ATTR_END_ANGLE1 33634
|
#define ATTR_END_ANGLE1 33634
|
||||||
|
|
||||||
|
// Dropdown
|
||||||
|
#define ATTR_DIRECTION 32415
|
||||||
|
#define ATTR_SYMBOL 33592
|
||||||
|
#define ATTR_OPEN 25738
|
||||||
|
#define ATTR_CLOSE 41880
|
||||||
|
#define ATTR_MAX_HEIGHT 30946
|
||||||
|
#define ATTR_SHOW_SELECTED 56029
|
||||||
|
|
||||||
// Buttonmatrix
|
// Buttonmatrix
|
||||||
#define ATTR_MAP 45628
|
#define ATTR_MAP 45628
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user