-
|
What is the best method to locally check the status of e.g. a buttonis on or off in custom code? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
First you need to get the object pointer: uint8_t page = 1; // the page of the object you want
uint8_t id = 150; // the id of the object you want
lv_obj_t* my_obj = hasp_find_obj_from_page_id(page, id);
if(!my_obj ) return; // object doesn't existThen you can use the object pointer to get the state, for example: lv_state_t val = lv_btn_get_state(my_obj );
if (val & LV_STATE_CHECKED) {
// do something
} else {
// do something
} |
Beta Was this translation helpful? Give feedback.
-
|
Perfect, and it even works ;) Thank you. ps. Can other resources be read in a similar way? e.g. current text from the label - received value from mqtt that is not a castom message |
Beta Was this translation helpful? Give feedback.
First you need to get the object pointer:
Then you can use the object pointer to get the state, for example:
lv_btn_get_state(my_obj)which will return the current state.