mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Add type to spinner objecfr
This commit is contained in:
parent
caa226c70f
commit
f362cff718
@ -829,6 +829,24 @@ static hasp_attribute_type_t hasp_process_arc_attribute(lv_obj_t* obj, uint16_t
|
||||
return HASP_ATTR_TYPE_INT;
|
||||
}
|
||||
|
||||
static hasp_attribute_type_t hasp_process_spinner_attribute(lv_obj_t* obj, uint16_t attr_hash, int32_t& val, bool update)
|
||||
{
|
||||
// We already know it's a spnner object
|
||||
switch(attr_hash) {
|
||||
case ATTR_TYPE:
|
||||
if(update)
|
||||
lv_spinner_set_type(obj, val % 3);
|
||||
else
|
||||
val = lv_spinner_get_type(obj);
|
||||
break;
|
||||
|
||||
default:
|
||||
return HASP_ATTR_TYPE_NOT_FOUND;
|
||||
}
|
||||
|
||||
return HASP_ATTR_TYPE_INT;
|
||||
}
|
||||
|
||||
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
|
||||
@ -2264,6 +2282,11 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char
|
||||
ret = hasp_process_arc_attribute(obj, attr_hash, val, update);
|
||||
break;
|
||||
|
||||
case LV_HASP_SPINNER:
|
||||
val = strtol(payload, nullptr, DEC);
|
||||
ret = hasp_process_spinner_attribute(obj, attr_hash, val, update);
|
||||
break;
|
||||
|
||||
case LV_HASP_GAUGE:
|
||||
val = strtol(payload, nullptr, DEC);
|
||||
ret = hasp_process_gauge_attribute(obj, attr_hash, val, update);
|
||||
|
Loading…
x
Reference in New Issue
Block a user