From f796915fd1a449282563a7336ff6d0668e5c8312 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Mon, 11 Dec 2023 22:13:24 +0100 Subject: [PATCH] HASPmota `bar` fixed `val` attribute (#20208) --- CHANGELOG.md | 1 + .../berry_tasmota/src/be_lv_haspmota.c | 40 ++++++++++++++++++- .../haspmota_src/haspmota_core/haspmota.be | 9 ++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e5c75a7a..81d862bb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c b/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c index 2a49774f8..bf20a03e5 100644 --- a/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c +++ b/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c @@ -5093,6 +5093,41 @@ 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 ********************************************************************/ @@ -5100,9 +5135,10 @@ 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) ); diff --git a/tasmota/berry/haspmota_src/haspmota_core/haspmota.be b/tasmota/berry/haspmota_src/haspmota_core/haspmota.be index 637d1c709..a960af47b 100644 --- a/tasmota/berry/haspmota_src/haspmota_core/haspmota.be +++ b/tasmota/berry/haspmota_src/haspmota_core/haspmota.be @@ -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