Skip to content

Commit

Permalink
HASPmota bar fixed val attribute (arendst#20208)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored and hawa-lc4 committed Dec 13, 2023
1 parent adf4bdc commit a5e26a3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
- ESP32 LVGL library from v8.3.10 to v8.3.11 (no functional change)

### Fixed
- HASPmota `bar` fixed `val` attribute

### Removed

Expand Down
40 changes: 38 additions & 2 deletions lib/libesp32/berry_tasmota/src/be_lv_haspmota.c
Original file line number Diff line number Diff line change
Expand Up @@ -5093,16 +5093,52 @@ void be_load_lvh_btnmatrix_class(bvm *vm) {

extern const bclass be_class_lvh_bar;

/********************************************************************
** Solidified function: set_val
********************************************************************/
be_local_closure(lvh_bar_set_val, /* name */
be_nested_proto(
6, /* nstack */
2, /* argc */
2, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 4]) { /* constants */
/* K0 */ be_nested_str_weak(_lv_obj),
/* K1 */ be_nested_str_weak(set_value),
/* K2 */ be_nested_str_weak(lv),
/* K3 */ be_nested_str_weak(ANIM_OFF),
}),
be_str_weak(set_val),
&be_const_str_solidified,
( &(const binstruction[ 7]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x8C080501, // 0001 GETMET R2 R2 K1
0x5C100200, // 0002 MOVE R4 R1
0xB8160400, // 0003 GETNGBL R5 K2
0x88140B03, // 0004 GETMBR R5 R5 K3
0x7C080600, // 0005 CALL R2 3
0x80000000, // 0006 RET 0
})
)
);
/*******************************************************************/


/********************************************************************
** Solidified class: lvh_bar
********************************************************************/
extern const bclass be_class_lvh_obj;
be_local_class(lvh_bar,
0,
&be_class_lvh_obj,
be_nested_map(1,
be_nested_map(2,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_const_key_weak(_lv_class, -1), be_const_class(be_class_lv_bar) },
{ be_const_key_weak(set_val, -1), be_const_closure(lvh_bar_set_val_closure) },
{ be_const_key_weak(_lv_class, 0), be_const_class(be_class_lv_bar) },
})),
be_str_weak(lvh_bar)
);
Expand Down
9 changes: 8 additions & 1 deletion tasmota/berry/haspmota_src/haspmota_core/haspmota.be
Original file line number Diff line number Diff line change
Expand Up @@ -1320,13 +1320,20 @@ class lvh_dropdown : lvh_obj
end
end

class lvh_bar : lvh_obj
static _lv_class = lv.bar

def set_val(t)
self._lv_obj.set_value(t, lv.ANIM_OFF)
end
end

#################################################################################
#
# All other subclasses than just map the LVGL object
# and doesn't have any specific behavior
#
#################################################################################
class lvh_bar : lvh_obj static _lv_class = lv.bar end
class lvh_btn : lvh_obj static _lv_class = lv.btn end
class lvh_btnmatrix : lvh_obj static _lv_class = lv.btnmatrix end
class lvh_checkbox : lvh_obj static _lv_class = lv.checkbox end
Expand Down

0 comments on commit a5e26a3

Please sign in to comment.