From 4306823ba60b6266f25b861da325016ba47f2d26 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Mon, 17 Feb 2025 23:04:04 +0100 Subject: [PATCH] HASPmota exception when clicking on a checkbox (#23022) --- CHANGELOG.md | 1 + .../lv_haspmota/src/embedded/lv_haspmota.be | 16 ++++- .../src/solidify/solidified_lv_haspmota.h | 66 ++++++++++++++++++- 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 877e9b0e96ac..2bbe0560550e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file. - Berry parser error in rare case (#22997) - ESP32 TasMesh broker MAC address all zeros (#23005) - Wrong RMT channels for ESP32S3, now depends on `soc_caps.h` +- HASPmota exception when clicking on a checkbox ### Removed diff --git a/lib/libesp32_lvgl/lv_haspmota/src/embedded/lv_haspmota.be b/lib/libesp32_lvgl/lv_haspmota/src/embedded/lv_haspmota.be index b8a77a7cce08..6c4a1f3cf339 100644 --- a/lib/libesp32_lvgl/lv_haspmota/src/embedded/lv_haspmota.be +++ b/lib/libesp32_lvgl/lv_haspmota/src/embedded/lv_haspmota.be @@ -1051,7 +1051,7 @@ class lvh_obj : lvh_root style_modifier = self.digits_to_style(suffix_digits) end end - # print(f">>>: getmember {k=} {style_modifier=}") + #print(f">>>: member {k=} {style_modifier=}") # if attribute name is in ignore list, abort if self._attr_ignore.find(k) != nil return end @@ -2537,7 +2537,19 @@ end #@ solidify:lvh_btn,weak class lvh_btn : lvh_obj static var _lv_class = lv.button end #@ solidify:lvh_checkbox,weak -class lvh_checkbox : lvh_obj static var _lv_class = lv.checkbox end +class lvh_checkbox : lvh_obj + static var _lv_class = lv.checkbox + static var _lv_part2_selector = lv.PART_INDICATOR + # static var _EVENTS = EVENTS_ALL + # map val to toggle + def set_val(t) + self._val = t + return self.set_toggle(t) + end + def get_val() + return self.get_toggle() + end +end # class lvh_textarea : lvh_obj static var _lv_class = lv.textarea end # special case for scr (which is actually lv_obj) #@ solidify:lvh_scr,weak diff --git a/lib/libesp32_lvgl/lv_haspmota/src/solidify/solidified_lv_haspmota.h b/lib/libesp32_lvgl/lv_haspmota/src/solidify/solidified_lv_haspmota.h index 01dea9fb71ac..52f67557f4b4 100644 --- a/lib/libesp32_lvgl/lv_haspmota/src/solidify/solidified_lv_haspmota.h +++ b/lib/libesp32_lvgl/lv_haspmota/src/solidify/solidified_lv_haspmota.h @@ -11145,6 +11145,65 @@ be_local_class(lvh_btn, extern const bclass be_class_lvh_checkbox; +/******************************************************************** +** Solidified function: set_val +********************************************************************/ +be_local_closure(class_lvh_checkbox_set_val, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_val), + /* K1 */ be_nested_str_weak(set_toggle), + }), + be_str_weak(set_val), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x8C080101, // 0001 GETMET R2 R0 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_val +********************************************************************/ +be_local_closure(class_lvh_checkbox_get_val, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(get_toggle), + }), + be_str_weak(get_val), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x80040200, // 0002 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified class: lvh_checkbox ********************************************************************/ @@ -11152,9 +11211,12 @@ extern const bclass be_class_lvh_obj; be_local_class(lvh_checkbox, 0, &be_class_lvh_obj, - be_nested_map(1, + be_nested_map(4, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(_lv_class, -1), be_const_class(be_class_lv_checkbox) }, + { be_const_key_weak(get_val, 1), be_const_closure(class_lvh_checkbox_get_val_closure) }, + { be_const_key_weak(set_val, -1), be_const_closure(class_lvh_checkbox_set_val_closure) }, + { be_const_key_weak(_lv_part2_selector, -1), be_const_int(131072) }, + { be_const_key_weak(_lv_class, 0), be_const_class(be_class_lv_checkbox) }, })), be_str_weak(lvh_checkbox) );