From d9cfe6128a134d6d6de36b279dfffc7944f54883 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 5 Apr 2022 21:38:43 +0200 Subject: [PATCH] Berry prep for OpenHASP --- .../Zip-readonly-FS/src/ZipReadFS.cpp | 3 + lib/libesp32/berry/generate/be_const_strtab.h | 4 +- .../berry/generate/be_const_strtab_def.h | 12 +- .../berry_mapping/src/be_class_wrapper.c | 7 +- .../lv_binding_berry/src/be_lvgl_glob_lib.c | 1527 +++++++++-------- .../src/embedded/lvgl_glob.be | 92 +- tasmota/berry/lvgl_examples/lv.be | 25 +- .../berry/lvgl_examples/lv_tasmota_info.be | 12 +- tasmota/berry/lvgl_examples/lv_tasmota_log.be | 80 +- .../lvgl_examples/lv_tasmota_log_roboto.be | 73 +- tasmota/berry/lvgl_examples/lv_wifi_graph.be | 7 + 11 files changed, 1060 insertions(+), 782 deletions(-) diff --git a/lib/libesp32/Zip-readonly-FS/src/ZipReadFS.cpp b/lib/libesp32/Zip-readonly-FS/src/ZipReadFS.cpp index f0cd4823d..da9b42645 100644 --- a/lib/libesp32/Zip-readonly-FS/src/ZipReadFS.cpp +++ b/lib/libesp32/Zip-readonly-FS/src/ZipReadFS.cpp @@ -308,7 +308,9 @@ bool ZipArchive::parse(void) { const size_t zip_header_size = sizeof(header) - sizeof(header.padding); while (1) { + // AddLog(LOG_LEVEL_DEBUG, "ZIP: f->seek(%i)", offset); f->seek(offset); + // AddLog(LOG_LEVEL_DEBUG, "ZIP: f->read(%i)", zip_header_size); int32_t bytes_read = f->read(sizeof(header.padding) + (uint8_t*) &header, zip_header_size); if (bytes_read != zip_header_size) { break; @@ -348,6 +350,7 @@ bool ZipArchive::parse(void) { // read full filename char fname[header.filename_size + 1]; + // AddLog(LOG_LEVEL_DEBUG, "ZIP: f->read(%i)", header.filename_size); if (f->read((uint8_t*) &fname[0], header.filename_size) != header.filename_size) { return false; } diff --git a/lib/libesp32/berry/generate/be_const_strtab.h b/lib/libesp32/berry/generate/be_const_strtab.h index 04d90dc30..26d4948b0 100644 --- a/lib/libesp32/berry/generate/be_const_strtab.h +++ b/lib/libesp32/berry/generate/be_const_strtab.h @@ -65,7 +65,6 @@ extern const bcstring be_const_str_I2C_X3A; extern const bcstring be_const_str_INTERNAL_DAC; extern const bcstring be_const_str_INTERNAL_PDM; extern const bcstring be_const_str_LVG_X3A_X20call_X20to_X20unsupported_X20callback; -extern const bcstring be_const_str_LVG_X3A_X20object_X3A; extern const bcstring be_const_str_Leds; extern const bcstring be_const_str_MAX_RMT; extern const bcstring be_const_str_MD5; @@ -247,6 +246,7 @@ extern const bcstring be_const_str_abs; extern const bcstring be_const_str_acos; extern const bcstring be_const_str_add; extern const bcstring be_const_str_add_anim; +extern const bcstring be_const_str_add_cb_event_closure; extern const bcstring be_const_str_add_cmd; extern const bcstring be_const_str_add_cron; extern const bcstring be_const_str_add_driver; @@ -472,6 +472,7 @@ extern const bcstring be_const_str_get_cb_list; extern const bcstring be_const_str_get_coords; extern const bcstring be_const_str_get_current_module_name; extern const bcstring be_const_str_get_current_module_path; +extern const bcstring be_const_str_get_event_cb; extern const bcstring be_const_str_get_free_heap; extern const bcstring be_const_str_get_height; extern const bcstring be_const_str_get_hor_res; @@ -505,7 +506,6 @@ extern const bcstring be_const_str_group_def; extern const bcstring be_const_str_groups; extern const bcstring be_const_str_h; extern const bcstring be_const_str_has; -extern const bcstring be_const_str_has_X20already_X20an_X20event_X20callback; extern const bcstring be_const_str_has_arg; extern const bcstring be_const_str_height_def; extern const bcstring be_const_str_hex; diff --git a/lib/libesp32/berry/generate/be_const_strtab_def.h b/lib/libesp32/berry/generate/be_const_strtab_def.h index efe146842..d2c51ccaf 100644 --- a/lib/libesp32/berry/generate/be_const_strtab_def.h +++ b/lib/libesp32/berry/generate/be_const_strtab_def.h @@ -139,13 +139,12 @@ be_define_const_str(I2C_Driver, "I2C_Driver", 1714501658u, 0, 10, &be_const_str_ be_define_const_str(INTERNAL_DAC, "INTERNAL_DAC", 1097623719u, 0, 12, &be_const_str_flush); be_define_const_str(INTERNAL_PDM, "INTERNAL_PDM", 3043685628u, 0, 12, &be_const_str_SERIAL_5E2); be_define_const_str(LVG_X3A_X20call_X20to_X20unsupported_X20callback, "LVG: call to unsupported callback", 504176819u, 0, 33, &be_const_str_lv_wifi_arcs); -be_define_const_str(LVG_X3A_X20object_X3A, "LVG: object:", 3824079937u, 0, 12, &be_const_str_set_chr); be_define_const_str(Leds, "Leds", 2709245275u, 0, 4, &be_const_str_read_sensors); be_define_const_str(MAX_RMT, "MAX_RMT", 1615574873u, 0, 7, NULL); be_define_const_str(MD5, "MD5", 1935726387u, 0, 3, &be_const_str_create_segment); be_define_const_str(MI32, "MI32", 4074273414u, 0, 4, &be_const_str_init_draw_line_dsc); be_define_const_str(None, "None", 810547195u, 0, 4, NULL); -be_define_const_str(OPTION_A, "OPTION_A", 1133299440u, 0, 8, NULL); +be_define_const_str(OPTION_A, "OPTION_A", 1133299440u, 0, 8, &be_const_str_get_event_cb); be_define_const_str(OneWire, "OneWire", 2298990722u, 0, 7, &be_const_str_set_ldo_voltage); be_define_const_str(PART_MAIN, "PART_MAIN", 2473491508u, 0, 9, &be_const_str_lv_clock); be_define_const_str(POST, "POST", 1929554311u, 0, 4, &be_const_str_has); @@ -208,7 +207,7 @@ be_define_const_str(_ccmd, "_ccmd", 2163421413u, 0, 5, &be_const_str_argument_X2 be_define_const_str(_change_buffer, "_change_buffer", 2101848693u, 0, 14, NULL); be_define_const_str(_class, "_class", 2732146350u, 0, 6, &be_const_str_delete_all_configs); be_define_const_str(_cmd, "_cmd", 3419822142u, 0, 4, NULL); -be_define_const_str(_crons, "_crons", 1000733579u, 0, 6, &be_const_str_has_X20already_X20an_X20event_X20callback); +be_define_const_str(_crons, "_crons", 1000733579u, 0, 6, &be_const_str_tasmota_X2Eget_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eget_X28_X29); be_define_const_str(_debug_present, "_debug_present", 4063411725u, 0, 14, &be_const_str_wifi_bars); be_define_const_str(_def, "_def", 1985022181u, 0, 4, &be_const_str_decode); be_define_const_str(_dirty, "_dirty", 283846766u, 0, 6, &be_const_str_local); @@ -239,6 +238,7 @@ be_define_const_str(abs, "abs", 709362235u, 0, 3, NULL); be_define_const_str(acos, "acos", 1006755615u, 0, 4, &be_const_str_pixels_buffer); be_define_const_str(add, "add", 993596020u, 0, 3, &be_const_str_publish); be_define_const_str(add_anim, "add_anim", 3980662668u, 0, 8, &be_const_str_get_hor_res); +be_define_const_str(add_cb_event_closure, "add_cb_event_closure", 1775958321u, 0, 20, &be_const_str_split); be_define_const_str(add_cmd, "add_cmd", 3361630879u, 0, 7, NULL); be_define_const_str(add_cron, "add_cron", 2475327477u, 0, 8, &be_const_str_content_button); be_define_const_str(add_driver, "add_driver", 1654458371u, 0, 10, &be_const_str_argument_X20must_X20be_X20a_X20list); @@ -464,6 +464,7 @@ be_define_const_str(get_cb_list, "get_cb_list", 1605319182u, 0, 11, &be_const_st be_define_const_str(get_coords, "get_coords", 1044089006u, 0, 10, NULL); be_define_const_str(get_current_module_name, "get_current_module_name", 2379270740u, 0, 23, &be_const_str_param); be_define_const_str(get_current_module_path, "get_current_module_path", 3206673408u, 0, 23, &be_const_str_set_alternate); +be_define_const_str(get_event_cb, "get_event_cb", 375876088u, 0, 12, NULL); be_define_const_str(get_free_heap, "get_free_heap", 625069757u, 0, 13, &be_const_str_rule); be_define_const_str(get_height, "get_height", 3571755523u, 0, 10, &be_const_str_min); be_define_const_str(get_hor_res, "get_hor_res", 37131144u, 0, 11, &be_const_str_get_vbus_current); @@ -497,7 +498,6 @@ be_define_const_str(group_def, "group_def", 1524213328u, 0, 9, &be_const_str_int be_define_const_str(groups, "groups", 2943077229u, 0, 6, NULL); be_define_const_str(h, "h", 3977000791u, 0, 1, NULL); be_define_const_str(has, "has", 3988721635u, 0, 3, &be_const_str_tolower); -be_define_const_str(has_X20already_X20an_X20event_X20callback, "has already an event callback", 2421565249u, 0, 29, &be_const_str_tasmota_X2Eget_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eget_X28_X29); be_define_const_str(has_arg, "has_arg", 424878688u, 0, 7, NULL); be_define_const_str(height_def, "height_def", 2348238838u, 0, 10, NULL); be_define_const_str(hex, "hex", 4273249610u, 0, 3, NULL); @@ -1013,7 +1013,7 @@ static const bstring* const m_string_table[] = { (const bstring *)&be_const_str__archive, (const bstring *)&be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_persist_X2Ejson, (const bstring *)&be_const_str_SERIAL_7O2, - (const bstring *)&be_const_str_LVG_X3A_X20object_X3A, + (const bstring *)&be_const_str_set_chr, (const bstring *)&be_const_str_AudioOpusDecoder, (const bstring *)&be_const_str_solidified, (const bstring *)&be_const_str_time_str, @@ -1123,7 +1123,7 @@ static const bstring* const m_string_table[] = { (const bstring *)&be_const_str_zip, (const bstring *)&be_const_str_widget_destructor, (const bstring *)&be_const_str_AXP192, - (const bstring *)&be_const_str_split, + (const bstring *)&be_const_str_add_cb_event_closure, (const bstring *)&be_const_str_SERIAL_6O1, (const bstring *)&be_const_str_out_X20of_X20range, (const bstring *)&be_const_str_web_send, diff --git a/lib/libesp32/berry_mapping/src/be_class_wrapper.c b/lib/libesp32/berry_mapping/src/be_class_wrapper.c index 63e4ffa14..0458b1c97 100644 --- a/lib/libesp32/berry_mapping/src/be_class_wrapper.c +++ b/lib/libesp32/berry_mapping/src/be_class_wrapper.c @@ -181,10 +181,11 @@ intptr_t be_convert_single_elt(bvm *vm, int idx, const char * arg_type, int *buf arg_type++; // skip first character if (be_isclosure(vm, idx)) { ret = be_find_global_or_module_member(vm, "cb.make_cb"); + // ret may 1 if direct function, or 2 if method+instance. 0 indicates an error if (ret) { - be_pushvalue(vm, idx); - be_pushvalue(vm, 1); - be_pushstring(vm, arg_type); + be_pushvalue(vm, idx); // push function/closure as arg1 + be_pushvalue(vm, 1); // push `self` as arg2 + be_pushstring(vm, arg_type); // push name of the callback type (string) as arg3 be_call(vm, 2 + ret); const void * func = be_tocomptr(vm, -(3 + ret)); be_pop(vm, 3 + ret); diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c index 3223c475f..736f32471 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c +++ b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c @@ -3,260 +3,6 @@ *******************************************************************/ #include "be_constobj.h" -/******************************************************************** -** Solidified function: make_cb -********************************************************************/ -be_local_closure(LVGL_glob_make_cb, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 2]) { - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(lvgl_event_dispatch), - }), - &be_const_str__X3Clambda_X3E, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x68040000, // 0000 GETUPV R1 U0 - 0x8C040300, // 0001 GETMET R1 R1 K0 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C040400, // 0003 CALL R1 2 - 0x80040200, // 0004 RET 1 R1 - }) - ), - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(lvgl_timer_dispatch), - }), - &be_const_str__X3Clambda_X3E, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x68040000, // 0000 GETUPV R1 U0 - 0x8C040300, // 0001 GETMET R1 R1 K0 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C040400, // 0003 CALL R1 2 - 0x80040200, // 0004 RET 1 R1 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[19]) { /* constants */ - /* K0 */ be_nested_str(cb), - /* K1 */ be_nested_str(lv_event_cb), - /* K2 */ be_nested_str(cb_event_closure), - /* K3 */ be_nested_str(event_cb), - /* K4 */ be_nested_str(gen_cb), - /* K5 */ be_nested_str(register_obj), - /* K6 */ be_nested_str(contains), - /* K7 */ be_nested_str(_p), - /* K8 */ be_nested_str(tasmota), - /* K9 */ be_nested_str(log), - /* K10 */ be_nested_str(LVG_X3A_X20object_X3A), - /* K11 */ be_nested_str(has_X20already_X20an_X20event_X20callback), - /* K12 */ be_const_int(2), - /* K13 */ be_nested_str(lv_timer_cb), - /* K14 */ be_nested_str(timer_cb), - /* K15 */ be_const_int(0), - /* K16 */ be_nested_str(lv_), - /* K17 */ be_nested_str(null_cb), - /* K18 */ be_nested_str(cb_do_nothing), - }), - &be_const_str_make_cb, - &be_const_str_solidified, - ( &(const binstruction[101]) { /* code */ - 0xA4120000, // 0000 IMPORT R4 K0 - 0x1C140701, // 0001 EQ R5 R3 K1 - 0x78160026, // 0002 JMPF R5 #002A - 0x88140102, // 0003 GETMBR R5 R0 K2 - 0x4C180000, // 0004 LDNIL R6 - 0x1C140A06, // 0005 EQ R5 R5 R6 - 0x78160002, // 0006 JMPF R5 #000A - 0x60140013, // 0007 GETGBL R5 G19 - 0x7C140000, // 0008 CALL R5 0 - 0x90020405, // 0009 SETMBR R0 K2 R5 - 0x88140103, // 000A GETMBR R5 R0 K3 - 0x4C180000, // 000B LDNIL R6 - 0x1C140A06, // 000C EQ R5 R5 R6 - 0x78160003, // 000D JMPF R5 #0012 - 0x8C140904, // 000E GETMET R5 R4 K4 - 0x841C0000, // 000F CLOSURE R7 P0 - 0x7C140400, // 0010 CALL R5 2 - 0x90020605, // 0011 SETMBR R0 K3 R5 - 0x8C140105, // 0012 GETMET R5 R0 K5 - 0x5C1C0400, // 0013 MOVE R7 R2 - 0x7C140400, // 0014 CALL R5 2 - 0x88140102, // 0015 GETMBR R5 R0 K2 - 0x8C140B06, // 0016 GETMET R5 R5 K6 - 0x881C0507, // 0017 GETMBR R7 R2 K7 - 0x7C140400, // 0018 CALL R5 2 - 0x78160008, // 0019 JMPF R5 #0023 - 0xB8161000, // 001A GETNGBL R5 K8 - 0x8C140B09, // 001B GETMET R5 R5 K9 - 0x601C0008, // 001C GETGBL R7 G8 - 0x5C200400, // 001D MOVE R8 R2 - 0x7C1C0200, // 001E CALL R7 1 - 0x001E1407, // 001F ADD R7 K10 R7 - 0x001C0F0B, // 0020 ADD R7 R7 K11 - 0x5820000C, // 0021 LDCONST R8 K12 - 0x7C140600, // 0022 CALL R5 3 - 0x88140507, // 0023 GETMBR R5 R2 K7 - 0x88180102, // 0024 GETMBR R6 R0 K2 - 0x98180A01, // 0025 SETIDX R6 R5 R1 - 0x88140103, // 0026 GETMBR R5 R0 K3 - 0xA0000000, // 0027 CLOSE R0 - 0x80040A00, // 0028 RET 1 R5 - 0x70020038, // 0029 JMP #0063 - 0x1C14070D, // 002A EQ R5 R3 K13 - 0x78160023, // 002B JMPF R5 #0050 - 0x88140102, // 002C GETMBR R5 R0 K2 - 0x4C180000, // 002D LDNIL R6 - 0x1C140A06, // 002E EQ R5 R5 R6 - 0x78160002, // 002F JMPF R5 #0033 - 0x60140013, // 0030 GETGBL R5 G19 - 0x7C140000, // 0031 CALL R5 0 - 0x90020405, // 0032 SETMBR R0 K2 R5 - 0x8814010E, // 0033 GETMBR R5 R0 K14 - 0x4C180000, // 0034 LDNIL R6 - 0x1C140A06, // 0035 EQ R5 R5 R6 - 0x78160003, // 0036 JMPF R5 #003B - 0x8C140904, // 0037 GETMET R5 R4 K4 - 0x841C0001, // 0038 CLOSURE R7 P1 - 0x7C140400, // 0039 CALL R5 2 - 0x90021C05, // 003A SETMBR R0 K14 R5 - 0x88140102, // 003B GETMBR R5 R0 K2 - 0x8C140B06, // 003C GETMET R5 R5 K6 - 0x881C0507, // 003D GETMBR R7 R2 K7 - 0x7C140400, // 003E CALL R5 2 - 0x78160008, // 003F JMPF R5 #0049 - 0xB8161000, // 0040 GETNGBL R5 K8 - 0x8C140B09, // 0041 GETMET R5 R5 K9 - 0x601C0008, // 0042 GETGBL R7 G8 - 0x5C200400, // 0043 MOVE R8 R2 - 0x7C1C0200, // 0044 CALL R7 1 - 0x001E1407, // 0045 ADD R7 K10 R7 - 0x001C0F0B, // 0046 ADD R7 R7 K11 - 0x5820000C, // 0047 LDCONST R8 K12 - 0x7C140600, // 0048 CALL R5 3 - 0x88140507, // 0049 GETMBR R5 R2 K7 - 0x88180102, // 004A GETMBR R6 R0 K2 - 0x98180A01, // 004B SETIDX R6 R5 R1 - 0x8814010E, // 004C GETMBR R5 R0 K14 - 0xA0000000, // 004D CLOSE R0 - 0x80040A00, // 004E RET 1 R5 - 0x70020012, // 004F JMP #0063 - 0x40161F0C, // 0050 CONNECT R5 K15 K12 - 0x94140605, // 0051 GETIDX R5 R3 R5 - 0x1C140B10, // 0052 EQ R5 R5 K16 - 0x7816000B, // 0053 JMPF R5 #0060 - 0x88140111, // 0054 GETMBR R5 R0 K17 - 0x4C180000, // 0055 LDNIL R6 - 0x1C140A06, // 0056 EQ R5 R5 R6 - 0x78160003, // 0057 JMPF R5 #005C - 0x8C140904, // 0058 GETMET R5 R4 K4 - 0x881C0112, // 0059 GETMBR R7 R0 K18 - 0x7C140400, // 005A CALL R5 2 - 0x90022205, // 005B SETMBR R0 K17 R5 - 0x88140111, // 005C GETMBR R5 R0 K17 - 0xA0000000, // 005D CLOSE R0 - 0x80040A00, // 005E RET 1 R5 - 0x70020002, // 005F JMP #0063 - 0x4C140000, // 0060 LDNIL R5 - 0xA0000000, // 0061 CLOSE R0 - 0x80040A00, // 0062 RET 1 R5 - 0xA0000000, // 0063 CLOSE R0 - 0x80000000, // 0064 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(LVGL_glob_init, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 8, /* nstack */ - 3, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(make_cb), - }), - &be_const_str__X3Clambda_X3E, - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x680C0000, // 0000 GETUPV R3 U0 - 0x8C0C0700, // 0001 GETMET R3 R3 K0 - 0x5C140000, // 0002 MOVE R5 R0 - 0x5C180200, // 0003 MOVE R6 R1 - 0x5C1C0400, // 0004 MOVE R7 R2 - 0x7C0C0800, // 0005 CALL R3 4 - 0x80040600, // 0006 RET 1 R3 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(cb), - /* K1 */ be_nested_str(add_handler), - /* K2 */ be_nested_str(lv_extra), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x8C080301, // 0001 GETMET R2 R1 K1 - 0x84100000, // 0002 CLOSURE R4 P0 - 0x7C080400, // 0003 CALL R2 2 - 0xA40A0400, // 0004 IMPORT R2 K2 - 0xA0000000, // 0005 CLOSE R0 - 0x80000000, // 0006 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: get_object_from_ptr ********************************************************************/ @@ -293,6 +39,35 @@ be_local_closure(LVGL_glob_get_object_from_ptr, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: _anonymous_ +********************************************************************/ +be_local_closure(LVGL_glob__anonymous_, /* name */ + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* 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(LVG_X3A_X20call_X20to_X20unsupported_X20callback), + }), + &be_const_str__anonymous_, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x60000001, // 0000 GETGBL R0 G1 + 0x58040000, // 0001 LDCONST R1 K0 + 0x7C000200, // 0002 CALL R0 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: widget_ctor_impl ********************************************************************/ @@ -355,6 +130,624 @@ be_local_closure(LVGL_glob_widget_ctor_impl, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: add_cb_event_closure +********************************************************************/ +be_local_closure(LVGL_glob_add_cb_event_closure, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(cb_event_closure), + /* K1 */ be_nested_str(contains), + /* K2 */ be_nested_str(function), + /* K3 */ be_const_int(1), + /* K4 */ be_nested_str(push), + /* K5 */ be_const_int(0), + }), + &be_const_str_add_cb_event_closure, + &be_const_str_solidified, + ( &(const binstruction[43]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x4C100000, // 0001 LDNIL R4 + 0x1C0C0604, // 0002 EQ R3 R3 R4 + 0x780E0002, // 0003 JMPF R3 #0007 + 0x600C0013, // 0004 GETGBL R3 G19 + 0x7C0C0000, // 0005 CALL R3 0 + 0x90020003, // 0006 SETMBR R0 K0 R3 + 0x880C0100, // 0007 GETMBR R3 R0 K0 + 0x8C0C0701, // 0008 GETMET R3 R3 K1 + 0x5C140200, // 0009 MOVE R5 R1 + 0x7C0C0400, // 000A CALL R3 2 + 0x780E001A, // 000B JMPF R3 #0027 + 0x880C0100, // 000C GETMBR R3 R0 K0 + 0x940C0601, // 000D GETIDX R3 R3 R1 + 0x60100004, // 000E GETGBL R4 G4 + 0x5C140600, // 000F MOVE R5 R3 + 0x7C100200, // 0010 CALL R4 1 + 0x1C100902, // 0011 EQ R4 R4 K2 + 0x78120007, // 0012 JMPF R4 #001B + 0x88100100, // 0013 GETMBR R4 R0 K0 + 0x60140012, // 0014 GETGBL R5 G18 + 0x7C140000, // 0015 CALL R5 0 + 0x40180A03, // 0016 CONNECT R6 R5 R3 + 0x40180A02, // 0017 CONNECT R6 R5 R2 + 0x98100205, // 0018 SETIDX R4 R1 R5 + 0x80060600, // 0019 RET 1 K3 + 0x7002000A, // 001A JMP #0026 + 0x88100100, // 001B GETMBR R4 R0 K0 + 0x94100801, // 001C GETIDX R4 R4 R1 + 0x8C100904, // 001D GETMET R4 R4 K4 + 0x5C180400, // 001E MOVE R6 R2 + 0x7C100400, // 001F CALL R4 2 + 0x6010000C, // 0020 GETGBL R4 G12 + 0x88140100, // 0021 GETMBR R5 R0 K0 + 0x94140A01, // 0022 GETIDX R5 R5 R1 + 0x7C100200, // 0023 CALL R4 1 + 0x04100903, // 0024 SUB R4 R4 K3 + 0x80040800, // 0025 RET 1 R4 + 0x70020002, // 0026 JMP #002A + 0x880C0100, // 0027 GETMBR R3 R0 K0 + 0x980C0202, // 0028 SETIDX R3 R1 R2 + 0x80060A00, // 0029 RET 1 K5 + 0x80000000, // 002A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_cb +********************************************************************/ +be_local_closure(LVGL_glob_widget_cb, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 3]) { + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(widget_ctor_impl), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68080000, // 0000 GETUPV R2 U0 + 0x8C080500, // 0001 GETMET R2 R2 K0 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ), + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(widget_dtor_impl), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68080000, // 0000 GETUPV R2 U0 + 0x8C080500, // 0001 GETMET R2 R2 K0 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ), + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(widget_event_impl), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68080000, // 0000 GETUPV R2 U0 + 0x8C080500, // 0001 GETMET R2 R2 K0 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[15]) { /* constants */ + /* K0 */ be_nested_str(cb), + /* K1 */ be_nested_str(widget_ctor_cb), + /* K2 */ be_nested_str(gen_cb), + /* K3 */ be_nested_str(widget_dtor_cb), + /* K4 */ be_nested_str(widget_event_cb), + /* K5 */ be_nested_str(widget_struct_default), + /* K6 */ be_nested_str(lv), + /* K7 */ be_nested_str(lv_obj_class), + /* K8 */ be_nested_str(lv_obj), + /* K9 */ be_nested_str(_class), + /* K10 */ be_nested_str(copy), + /* K11 */ be_nested_str(base_class), + /* K12 */ be_nested_str(constructor_cb), + /* K13 */ be_nested_str(destructor_cb), + /* K14 */ be_nested_str(event_cb), + }), + &be_const_str_widget_cb, + &be_const_str_solidified, + ( &(const binstruction[54]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x88080101, // 0001 GETMBR R2 R0 K1 + 0x4C0C0000, // 0002 LDNIL R3 + 0x1C080403, // 0003 EQ R2 R2 R3 + 0x780A0003, // 0004 JMPF R2 #0009 + 0x8C080302, // 0005 GETMET R2 R1 K2 + 0x84100000, // 0006 CLOSURE R4 P0 + 0x7C080400, // 0007 CALL R2 2 + 0x90020202, // 0008 SETMBR R0 K1 R2 + 0x88080103, // 0009 GETMBR R2 R0 K3 + 0x4C0C0000, // 000A LDNIL R3 + 0x1C080403, // 000B EQ R2 R2 R3 + 0x780A0003, // 000C JMPF R2 #0011 + 0x8C080302, // 000D GETMET R2 R1 K2 + 0x84100001, // 000E CLOSURE R4 P1 + 0x7C080400, // 000F CALL R2 2 + 0x90020602, // 0010 SETMBR R0 K3 R2 + 0x88080104, // 0011 GETMBR R2 R0 K4 + 0x4C0C0000, // 0012 LDNIL R3 + 0x1C080403, // 0013 EQ R2 R2 R3 + 0x780A0003, // 0014 JMPF R2 #0019 + 0x8C080302, // 0015 GETMET R2 R1 K2 + 0x84100002, // 0016 CLOSURE R4 P2 + 0x7C080400, // 0017 CALL R2 2 + 0x90020802, // 0018 SETMBR R0 K4 R2 + 0x88080105, // 0019 GETMBR R2 R0 K5 + 0x4C0C0000, // 001A LDNIL R3 + 0x1C080403, // 001B EQ R2 R2 R3 + 0x780A0016, // 001C JMPF R2 #0034 + 0xB80A0C00, // 001D GETNGBL R2 K6 + 0x8C080507, // 001E GETMET R2 R2 K7 + 0xB8120C00, // 001F GETNGBL R4 K6 + 0x88100908, // 0020 GETMBR R4 R4 K8 + 0x88100909, // 0021 GETMBR R4 R4 K9 + 0x7C080400, // 0022 CALL R2 2 + 0x8C08050A, // 0023 GETMET R2 R2 K10 + 0x7C080200, // 0024 CALL R2 1 + 0x90020A02, // 0025 SETMBR R0 K5 R2 + 0x88080105, // 0026 GETMBR R2 R0 K5 + 0xB80E0C00, // 0027 GETNGBL R3 K6 + 0x880C0708, // 0028 GETMBR R3 R3 K8 + 0x880C0709, // 0029 GETMBR R3 R3 K9 + 0x900A1603, // 002A SETMBR R2 K11 R3 + 0x88080105, // 002B GETMBR R2 R0 K5 + 0x880C0101, // 002C GETMBR R3 R0 K1 + 0x900A1803, // 002D SETMBR R2 K12 R3 + 0x88080105, // 002E GETMBR R2 R0 K5 + 0x880C0103, // 002F GETMBR R3 R0 K3 + 0x900A1A03, // 0030 SETMBR R2 K13 R3 + 0x88080105, // 0031 GETMBR R2 R0 K5 + 0x880C0104, // 0032 GETMBR R3 R0 K4 + 0x900A1C03, // 0033 SETMBR R2 K14 R3 + 0xA0000000, // 0034 CLOSE R0 + 0x80000000, // 0035 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(LVGL_glob_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(make_cb), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x680C0000, // 0000 GETUPV R3 U0 + 0x8C0C0700, // 0001 GETMET R3 R3 K0 + 0x5C140000, // 0002 MOVE R5 R0 + 0x5C180200, // 0003 MOVE R6 R1 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x7C0C0800, // 0005 CALL R3 4 + 0x80040600, // 0006 RET 1 R3 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(cb), + /* K1 */ be_nested_str(add_handler), + /* K2 */ be_nested_str(lv_extra), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x84100000, // 0002 CLOSURE R4 P0 + 0x7C080400, // 0003 CALL R2 2 + 0xA40A0400, // 0004 IMPORT R2 K2 + 0xA0000000, // 0005 CLOSE R0 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_event_cb +********************************************************************/ +be_local_closure(LVGL_glob_get_event_cb, /* name */ + be_nested_proto( + 9, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 2]) { /* upvals */ + be_local_const_upval(1, 0), + be_local_const_upval(1, 4), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(lvgl_event_dispatch), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68040000, // 0000 GETUPV R1 U0 + 0x8C040300, // 0001 GETMET R1 R1 K0 + 0x680C0001, // 0002 GETUPV R3 U1 + 0x5C100000, // 0003 MOVE R4 R0 + 0x7C040600, // 0004 CALL R1 3 + 0x80040200, // 0005 RET 1 R1 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(event_cb), + /* K1 */ be_nested_str(cb), + /* K2 */ be_nested_str(gen_cb), + /* K3 */ be_nested_str(push), + /* K4 */ be_nested_str(stop_iteration), + }), + &be_const_str_get_event_cb, + &be_const_str_solidified, + ( &(const binstruction[32]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x780A0002, // 0003 JMPF R2 #0007 + 0x60080012, // 0004 GETGBL R2 G18 + 0x7C080000, // 0005 CALL R2 0 + 0x90020002, // 0006 SETMBR R0 K0 R2 + 0x88080100, // 0007 GETMBR R2 R0 K0 + 0x600C0010, // 0008 GETGBL R3 G16 + 0x6010000C, // 0009 GETGBL R4 G12 + 0x5C140400, // 000A MOVE R5 R2 + 0x7C100200, // 000B CALL R4 1 + 0x40100801, // 000C CONNECT R4 R4 R1 + 0x7C0C0200, // 000D CALL R3 1 + 0xA802000A, // 000E EXBLK 0 #001A + 0x5C100600, // 000F MOVE R4 R3 + 0x7C100000, // 0010 CALL R4 0 + 0xB8160200, // 0011 GETNGBL R5 K1 + 0x8C140B02, // 0012 GETMET R5 R5 K2 + 0x841C0000, // 0013 CLOSURE R7 P0 + 0x7C140400, // 0014 CALL R5 2 + 0x8C180503, // 0015 GETMET R6 R2 K3 + 0x5C200A00, // 0016 MOVE R8 R5 + 0x7C180400, // 0017 CALL R6 2 + 0xA00C0000, // 0018 CLOSE R3 + 0x7001FFF4, // 0019 JMP #000F + 0x580C0004, // 001A LDCONST R3 K4 + 0xAC0C0200, // 001B CATCH R3 1 0 + 0xB0080000, // 001C RAISE 2 R0 R0 + 0x940C0401, // 001D GETIDX R3 R2 R1 + 0xA0000000, // 001E CLOSE R0 + 0x80040600, // 001F RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: lvgl_timer_dispatch +********************************************************************/ +be_local_closure(LVGL_glob_lvgl_timer_dispatch, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(toptr), + /* K2 */ be_nested_str(cb_event_closure), + /* K3 */ be_nested_str(function), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + }), + &be_const_str_lvgl_timer_dispatch, + &be_const_str_solidified, + ( &(const binstruction[27]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x8C0C0501, // 0001 GETMET R3 R2 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x7C0C0400, // 0003 CALL R3 2 + 0x88100102, // 0004 GETMBR R4 R0 K2 + 0x94100803, // 0005 GETIDX R4 R4 R3 + 0x60140004, // 0006 GETGBL R5 G4 + 0x5C180800, // 0007 MOVE R6 R4 + 0x7C140200, // 0008 CALL R5 1 + 0x1C140B03, // 0009 EQ R5 R5 K3 + 0x78160003, // 000A JMPF R5 #000F + 0x5C140800, // 000B MOVE R5 R4 + 0x5C180600, // 000C MOVE R6 R3 + 0x7C140200, // 000D CALL R5 1 + 0x7002000A, // 000E JMP #001A + 0x58140004, // 000F LDCONST R5 K4 + 0x6018000C, // 0010 GETGBL R6 G12 + 0x5C1C0800, // 0011 MOVE R7 R4 + 0x7C180200, // 0012 CALL R6 1 + 0x14180A06, // 0013 LT R6 R5 R6 + 0x781A0004, // 0014 JMPF R6 #001A + 0x94180805, // 0015 GETIDX R6 R4 R5 + 0x5C1C0600, // 0016 MOVE R7 R3 + 0x7C180200, // 0017 CALL R6 1 + 0x00140B05, // 0018 ADD R5 R5 K5 + 0x7001FFF5, // 0019 JMP #0010 + 0x80000000, // 001A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_dtor_impl +********************************************************************/ +be_local_closure(LVGL_glob_widget_dtor_impl, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(lv_obj_class), + /* K3 */ be_nested_str(get_object_from_ptr), + /* K4 */ be_nested_str(instance), + /* K5 */ be_nested_str(get), + /* K6 */ be_nested_str(widget_destructor), + }), + &be_const_str_widget_dtor_impl, + &be_const_str_solidified, + ( &(const binstruction[22]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0xB8120200, // 0001 GETNGBL R4 K1 + 0x8C100902, // 0002 GETMET R4 R4 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C100400, // 0004 CALL R4 2 + 0x8C140103, // 0005 GETMET R5 R0 K3 + 0x5C1C0400, // 0006 MOVE R7 R2 + 0x7C140400, // 0007 CALL R5 2 + 0x60180004, // 0008 GETGBL R6 G4 + 0x5C1C0A00, // 0009 MOVE R7 R5 + 0x7C180200, // 000A CALL R6 1 + 0x1C180D04, // 000B EQ R6 R6 K4 + 0x781A0007, // 000C JMPF R6 #0015 + 0x8C180705, // 000D GETMET R6 R3 K5 + 0x5C200A00, // 000E MOVE R8 R5 + 0x58240006, // 000F LDCONST R9 K6 + 0x7C180600, // 0010 CALL R6 3 + 0x781A0002, // 0011 JMPF R6 #0015 + 0x8C180B06, // 0012 GETMET R6 R5 K6 + 0x5C200800, // 0013 MOVE R8 R4 + 0x7C180400, // 0014 CALL R6 2 + 0x80000000, // 0015 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: make_cb +********************************************************************/ +be_local_closure(LVGL_glob_make_cb, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(lvgl_timer_dispatch), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x68040000, // 0000 GETUPV R1 U0 + 0x8C040300, // 0001 GETMET R1 R1 K0 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C040400, // 0003 CALL R1 2 + 0x80040200, // 0004 RET 1 R1 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[14]) { /* constants */ + /* K0 */ be_nested_str(cb), + /* K1 */ be_nested_str(lv_event_cb), + /* K2 */ be_nested_str(register_obj), + /* K3 */ be_nested_str(add_cb_event_closure), + /* K4 */ be_nested_str(_p), + /* K5 */ be_nested_str(get_event_cb), + /* K6 */ be_nested_str(lv_timer_cb), + /* K7 */ be_nested_str(timer_cb), + /* K8 */ be_nested_str(gen_cb), + /* K9 */ be_const_int(0), + /* K10 */ be_const_int(2), + /* K11 */ be_nested_str(lv_), + /* K12 */ be_nested_str(null_cb), + /* K13 */ be_nested_str(cb_do_nothing), + }), + &be_const_str_make_cb, + &be_const_str_solidified, + ( &(const binstruction[54]) { /* code */ + 0xA4120000, // 0000 IMPORT R4 K0 + 0x1C140701, // 0001 EQ R5 R3 K1 + 0x7816000B, // 0002 JMPF R5 #000F + 0x8C140102, // 0003 GETMET R5 R0 K2 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x7C140400, // 0005 CALL R5 2 + 0x8C140103, // 0006 GETMET R5 R0 K3 + 0x881C0504, // 0007 GETMBR R7 R2 K4 + 0x5C200200, // 0008 MOVE R8 R1 + 0x7C140600, // 0009 CALL R5 3 + 0x8C180105, // 000A GETMET R6 R0 K5 + 0x5C200A00, // 000B MOVE R8 R5 + 0x7C180400, // 000C CALL R6 2 + 0x80040C00, // 000D RET 1 R6 + 0x70020024, // 000E JMP #0034 + 0x1C140706, // 000F EQ R5 R3 K6 + 0x7816000F, // 0010 JMPF R5 #0021 + 0x88140107, // 0011 GETMBR R5 R0 K7 + 0x4C180000, // 0012 LDNIL R6 + 0x1C140A06, // 0013 EQ R5 R5 R6 + 0x78160003, // 0014 JMPF R5 #0019 + 0x8C140908, // 0015 GETMET R5 R4 K8 + 0x841C0000, // 0016 CLOSURE R7 P0 + 0x7C140400, // 0017 CALL R5 2 + 0x90020E05, // 0018 SETMBR R0 K7 R5 + 0x8C140103, // 0019 GETMET R5 R0 K3 + 0x881C0504, // 001A GETMBR R7 R2 K4 + 0x5C200200, // 001B MOVE R8 R1 + 0x7C140600, // 001C CALL R5 3 + 0x88140107, // 001D GETMBR R5 R0 K7 + 0xA0000000, // 001E CLOSE R0 + 0x80040A00, // 001F RET 1 R5 + 0x70020012, // 0020 JMP #0034 + 0x4016130A, // 0021 CONNECT R5 K9 K10 + 0x94140605, // 0022 GETIDX R5 R3 R5 + 0x1C140B0B, // 0023 EQ R5 R5 K11 + 0x7816000B, // 0024 JMPF R5 #0031 + 0x8814010C, // 0025 GETMBR R5 R0 K12 + 0x4C180000, // 0026 LDNIL R6 + 0x1C140A06, // 0027 EQ R5 R5 R6 + 0x78160003, // 0028 JMPF R5 #002D + 0x8C140908, // 0029 GETMET R5 R4 K8 + 0x881C010D, // 002A GETMBR R7 R0 K13 + 0x7C140400, // 002B CALL R5 2 + 0x90021805, // 002C SETMBR R0 K12 R5 + 0x8814010C, // 002D GETMBR R5 R0 K12 + 0xA0000000, // 002E CLOSE R0 + 0x80040A00, // 002F RET 1 R5 + 0x70020002, // 0030 JMP #0034 + 0x4C140000, // 0031 LDNIL R5 + 0xA0000000, // 0032 CLOSE R0 + 0x80040A00, // 0033 RET 1 R5 + 0xA0000000, // 0034 CLOSE R0 + 0x80000000, // 0035 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: register_obj ********************************************************************/ @@ -392,6 +785,162 @@ be_local_closure(LVGL_glob_register_obj, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: widget_event_impl +********************************************************************/ +be_local_closure(LVGL_glob_widget_event_impl, /* name */ + be_nested_proto( + 12, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[12]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(lv_obj_class), + /* K3 */ be_nested_str(lv_event), + /* K4 */ be_nested_str(target), + /* K5 */ be_nested_str(get_object_from_ptr), + /* K6 */ be_nested_str(instance), + /* K7 */ be_nested_str(code), + /* K8 */ be_nested_str(EVENT_DELETE), + /* K9 */ be_nested_str(get), + /* K10 */ be_nested_str(before_del), + /* K11 */ be_nested_str(widget_event), + }), + &be_const_str_widget_event_impl, + &be_const_str_solidified, + ( &(const binstruction[43]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0xB8120200, // 0001 GETNGBL R4 K1 + 0x8C100902, // 0002 GETMET R4 R4 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C100400, // 0004 CALL R4 2 + 0xB8160200, // 0005 GETNGBL R5 K1 + 0x8C140B03, // 0006 GETMET R5 R5 K3 + 0x5C1C0400, // 0007 MOVE R7 R2 + 0x7C140400, // 0008 CALL R5 2 + 0x88180B04, // 0009 GETMBR R6 R5 K4 + 0x8C1C0105, // 000A GETMET R7 R0 K5 + 0x5C240C00, // 000B MOVE R9 R6 + 0x7C1C0400, // 000C CALL R7 2 + 0x60200004, // 000D GETGBL R8 G4 + 0x5C240E00, // 000E MOVE R9 R7 + 0x7C200200, // 000F CALL R8 1 + 0x1C201106, // 0010 EQ R8 R8 K6 + 0x78220017, // 0011 JMPF R8 #002A + 0x88200B07, // 0012 GETMBR R8 R5 K7 + 0xB8260200, // 0013 GETNGBL R9 K1 + 0x88241308, // 0014 GETMBR R9 R9 K8 + 0x1C201009, // 0015 EQ R8 R8 R9 + 0x78220009, // 0016 JMPF R8 #0021 + 0x8C200709, // 0017 GETMET R8 R3 K9 + 0x5C280E00, // 0018 MOVE R10 R7 + 0x582C000A, // 0019 LDCONST R11 K10 + 0x7C200600, // 001A CALL R8 3 + 0x78220004, // 001B JMPF R8 #0021 + 0x8C200F0A, // 001C GETMET R8 R7 K10 + 0x5C280800, // 001D MOVE R10 R4 + 0x5C2C0A00, // 001E MOVE R11 R5 + 0x7C200600, // 001F CALL R8 3 + 0x70020008, // 0020 JMP #002A + 0x8C200709, // 0021 GETMET R8 R3 K9 + 0x5C280E00, // 0022 MOVE R10 R7 + 0x582C000B, // 0023 LDCONST R11 K11 + 0x7C200600, // 0024 CALL R8 3 + 0x78220003, // 0025 JMPF R8 #002A + 0x8C200F0B, // 0026 GETMET R8 R7 K11 + 0x5C280800, // 0027 MOVE R10 R4 + 0x5C2C0A00, // 0028 MOVE R11 R5 + 0x7C200600, // 0029 CALL R8 3 + 0x80000000, // 002A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: lvgl_event_dispatch +********************************************************************/ +be_local_closure(LVGL_glob_lvgl_event_dispatch, /* name */ + be_nested_proto( + 11, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(toptr), + /* K2 */ be_nested_str(event), + /* K3 */ be_nested_str(_change_buffer), + /* K4 */ be_nested_str(lv), + /* K5 */ be_nested_str(lv_event), + /* K6 */ be_nested_str(target), + /* K7 */ be_nested_str(get_object_from_ptr), + /* K8 */ be_nested_str(cb_event_closure), + /* K9 */ be_nested_str(function), + }), + &be_const_str_lvgl_event_dispatch, + &be_const_str_solidified, + ( &(const binstruction[43]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0x8C100701, // 0001 GETMET R4 R3 K1 + 0x5C180400, // 0002 MOVE R6 R2 + 0x7C100400, // 0003 CALL R4 2 + 0x88140102, // 0004 GETMBR R5 R0 K2 + 0x78160004, // 0005 JMPF R5 #000B + 0x88140102, // 0006 GETMBR R5 R0 K2 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0x5C1C0800, // 0008 MOVE R7 R4 + 0x7C140400, // 0009 CALL R5 2 + 0x70020004, // 000A JMP #0010 + 0xB8160800, // 000B GETNGBL R5 K4 + 0x8C140B05, // 000C GETMET R5 R5 K5 + 0x5C1C0800, // 000D MOVE R7 R4 + 0x7C140400, // 000E CALL R5 2 + 0x90020405, // 000F SETMBR R0 K2 R5 + 0x88140102, // 0010 GETMBR R5 R0 K2 + 0x88140B06, // 0011 GETMBR R5 R5 K6 + 0x8C180107, // 0012 GETMET R6 R0 K7 + 0x5C200A00, // 0013 MOVE R8 R5 + 0x7C180400, // 0014 CALL R6 2 + 0x881C0108, // 0015 GETMBR R7 R0 K8 + 0x941C0E05, // 0016 GETIDX R7 R7 R5 + 0x60200004, // 0017 GETGBL R8 G4 + 0x5C240E00, // 0018 MOVE R9 R7 + 0x7C200200, // 0019 CALL R8 1 + 0x1C201109, // 001A EQ R8 R8 K9 + 0x78220004, // 001B JMPF R8 #0021 + 0x5C200E00, // 001C MOVE R8 R7 + 0x5C240C00, // 001D MOVE R9 R6 + 0x88280102, // 001E GETMBR R10 R0 K2 + 0x7C200400, // 001F CALL R8 2 + 0x70020008, // 0020 JMP #002A + 0x6020000C, // 0021 GETGBL R8 G12 + 0x5C240E00, // 0022 MOVE R9 R7 + 0x7C200200, // 0023 CALL R8 1 + 0x14200208, // 0024 LT R8 R1 R8 + 0x78220003, // 0025 JMPF R8 #002A + 0x94200E01, // 0026 GETIDX R8 R7 R1 + 0x5C240C00, // 0027 MOVE R9 R6 + 0x88280102, // 0028 GETMBR R10 R0 K2 + 0x7C200400, // 0029 CALL R8 2 + 0x80000000, // 002A RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: deregister_obj ********************************************************************/ @@ -573,466 +1122,40 @@ be_local_closure(LVGL_glob_create_custom_widget, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: lvgl_timer_dispatch -********************************************************************/ -be_local_closure(LVGL_glob_lvgl_timer_dispatch, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(introspect), - /* K1 */ be_nested_str(toptr), - /* K2 */ be_nested_str(cb_event_closure), - }), - &be_const_str_lvgl_timer_dispatch, - &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0x8C0C0501, // 0001 GETMET R3 R2 K1 - 0x5C140200, // 0002 MOVE R5 R1 - 0x7C0C0400, // 0003 CALL R3 2 - 0x88100102, // 0004 GETMBR R4 R0 K2 - 0x94100803, // 0005 GETIDX R4 R4 R3 - 0x5C140800, // 0006 MOVE R5 R4 - 0x5C180600, // 0007 MOVE R6 R3 - 0x7C140200, // 0008 CALL R5 1 - 0x80000000, // 0009 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: lvgl_event_dispatch -********************************************************************/ -be_local_closure(LVGL_glob_lvgl_event_dispatch, /* name */ - be_nested_proto( - 10, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(introspect), - /* K1 */ be_nested_str(toptr), - /* K2 */ be_nested_str(event), - /* K3 */ be_nested_str(_change_buffer), - /* K4 */ be_nested_str(lv), - /* K5 */ be_nested_str(lv_event), - /* K6 */ be_nested_str(target), - /* K7 */ be_nested_str(cb_event_closure), - /* K8 */ be_nested_str(get_object_from_ptr), - }), - &be_const_str_lvgl_event_dispatch, - &be_const_str_solidified, - ( &(const binstruction[28]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0x8C0C0501, // 0001 GETMET R3 R2 K1 - 0x5C140200, // 0002 MOVE R5 R1 - 0x7C0C0400, // 0003 CALL R3 2 - 0x88100102, // 0004 GETMBR R4 R0 K2 - 0x78120004, // 0005 JMPF R4 #000B - 0x88100102, // 0006 GETMBR R4 R0 K2 - 0x8C100903, // 0007 GETMET R4 R4 K3 - 0x5C180600, // 0008 MOVE R6 R3 - 0x7C100400, // 0009 CALL R4 2 - 0x70020004, // 000A JMP #0010 - 0xB8120800, // 000B GETNGBL R4 K4 - 0x8C100905, // 000C GETMET R4 R4 K5 - 0x5C180600, // 000D MOVE R6 R3 - 0x7C100400, // 000E CALL R4 2 - 0x90020404, // 000F SETMBR R0 K2 R4 - 0x88100102, // 0010 GETMBR R4 R0 K2 - 0x88100906, // 0011 GETMBR R4 R4 K6 - 0x88140107, // 0012 GETMBR R5 R0 K7 - 0x94140A04, // 0013 GETIDX R5 R5 R4 - 0x8C180108, // 0014 GETMET R6 R0 K8 - 0x5C200800, // 0015 MOVE R8 R4 - 0x7C180400, // 0016 CALL R6 2 - 0x5C1C0A00, // 0017 MOVE R7 R5 - 0x5C200C00, // 0018 MOVE R8 R6 - 0x88240102, // 0019 GETMBR R9 R0 K2 - 0x7C1C0400, // 001A CALL R7 2 - 0x80000000, // 001B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: widget_dtor_impl -********************************************************************/ -be_local_closure(LVGL_glob_widget_dtor_impl, /* name */ - be_nested_proto( - 10, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str(introspect), - /* K1 */ be_nested_str(lv), - /* K2 */ be_nested_str(lv_obj_class), - /* K3 */ be_nested_str(get_object_from_ptr), - /* K4 */ be_nested_str(instance), - /* K5 */ be_nested_str(get), - /* K6 */ be_nested_str(widget_destructor), - }), - &be_const_str_widget_dtor_impl, - &be_const_str_solidified, - ( &(const binstruction[22]) { /* code */ - 0xA40E0000, // 0000 IMPORT R3 K0 - 0xB8120200, // 0001 GETNGBL R4 K1 - 0x8C100902, // 0002 GETMET R4 R4 K2 - 0x5C180200, // 0003 MOVE R6 R1 - 0x7C100400, // 0004 CALL R4 2 - 0x8C140103, // 0005 GETMET R5 R0 K3 - 0x5C1C0400, // 0006 MOVE R7 R2 - 0x7C140400, // 0007 CALL R5 2 - 0x60180004, // 0008 GETGBL R6 G4 - 0x5C1C0A00, // 0009 MOVE R7 R5 - 0x7C180200, // 000A CALL R6 1 - 0x1C180D04, // 000B EQ R6 R6 K4 - 0x781A0007, // 000C JMPF R6 #0015 - 0x8C180705, // 000D GETMET R6 R3 K5 - 0x5C200A00, // 000E MOVE R8 R5 - 0x58240006, // 000F LDCONST R9 K6 - 0x7C180600, // 0010 CALL R6 3 - 0x781A0002, // 0011 JMPF R6 #0015 - 0x8C180B06, // 0012 GETMET R6 R5 K6 - 0x5C200800, // 0013 MOVE R8 R4 - 0x7C180400, // 0014 CALL R6 2 - 0x80000000, // 0015 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: widget_event_impl -********************************************************************/ -be_local_closure(LVGL_glob_widget_event_impl, /* name */ - be_nested_proto( - 12, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[12]) { /* constants */ - /* K0 */ be_nested_str(introspect), - /* K1 */ be_nested_str(lv), - /* K2 */ be_nested_str(lv_obj_class), - /* K3 */ be_nested_str(lv_event), - /* K4 */ be_nested_str(target), - /* K5 */ be_nested_str(get_object_from_ptr), - /* K6 */ be_nested_str(instance), - /* K7 */ be_nested_str(code), - /* K8 */ be_nested_str(EVENT_DELETE), - /* K9 */ be_nested_str(get), - /* K10 */ be_nested_str(before_del), - /* K11 */ be_nested_str(widget_event), - }), - &be_const_str_widget_event_impl, - &be_const_str_solidified, - ( &(const binstruction[43]) { /* code */ - 0xA40E0000, // 0000 IMPORT R3 K0 - 0xB8120200, // 0001 GETNGBL R4 K1 - 0x8C100902, // 0002 GETMET R4 R4 K2 - 0x5C180200, // 0003 MOVE R6 R1 - 0x7C100400, // 0004 CALL R4 2 - 0xB8160200, // 0005 GETNGBL R5 K1 - 0x8C140B03, // 0006 GETMET R5 R5 K3 - 0x5C1C0400, // 0007 MOVE R7 R2 - 0x7C140400, // 0008 CALL R5 2 - 0x88180B04, // 0009 GETMBR R6 R5 K4 - 0x8C1C0105, // 000A GETMET R7 R0 K5 - 0x5C240C00, // 000B MOVE R9 R6 - 0x7C1C0400, // 000C CALL R7 2 - 0x60200004, // 000D GETGBL R8 G4 - 0x5C240E00, // 000E MOVE R9 R7 - 0x7C200200, // 000F CALL R8 1 - 0x1C201106, // 0010 EQ R8 R8 K6 - 0x78220017, // 0011 JMPF R8 #002A - 0x88200B07, // 0012 GETMBR R8 R5 K7 - 0xB8260200, // 0013 GETNGBL R9 K1 - 0x88241308, // 0014 GETMBR R9 R9 K8 - 0x1C201009, // 0015 EQ R8 R8 R9 - 0x78220009, // 0016 JMPF R8 #0021 - 0x8C200709, // 0017 GETMET R8 R3 K9 - 0x5C280E00, // 0018 MOVE R10 R7 - 0x582C000A, // 0019 LDCONST R11 K10 - 0x7C200600, // 001A CALL R8 3 - 0x78220004, // 001B JMPF R8 #0021 - 0x8C200F0A, // 001C GETMET R8 R7 K10 - 0x5C280800, // 001D MOVE R10 R4 - 0x5C2C0A00, // 001E MOVE R11 R5 - 0x7C200600, // 001F CALL R8 3 - 0x70020008, // 0020 JMP #002A - 0x8C200709, // 0021 GETMET R8 R3 K9 - 0x5C280E00, // 0022 MOVE R10 R7 - 0x582C000B, // 0023 LDCONST R11 K11 - 0x7C200600, // 0024 CALL R8 3 - 0x78220003, // 0025 JMPF R8 #002A - 0x8C200F0B, // 0026 GETMET R8 R7 K11 - 0x5C280800, // 0027 MOVE R10 R4 - 0x5C2C0A00, // 0028 MOVE R11 R5 - 0x7C200600, // 0029 CALL R8 3 - 0x80000000, // 002A RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: _anonymous_ -********************************************************************/ -be_local_closure(LVGL_glob__anonymous_, /* name */ - be_nested_proto( - 2, /* nstack */ - 0, /* argc */ - 0, /* 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(LVG_X3A_X20call_X20to_X20unsupported_X20callback), - }), - &be_const_str__anonymous_, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x60000001, // 0000 GETGBL R0 G1 - 0x58040000, // 0001 LDCONST R1 K0 - 0x7C000200, // 0002 CALL R0 1 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: widget_cb -********************************************************************/ -be_local_closure(LVGL_glob_widget_cb, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 3]) { - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(widget_ctor_impl), - }), - &be_const_str__X3Clambda_X3E, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x68080000, // 0000 GETUPV R2 U0 - 0x8C080500, // 0001 GETMET R2 R2 K0 - 0x5C100000, // 0002 MOVE R4 R0 - 0x5C140200, // 0003 MOVE R5 R1 - 0x7C080600, // 0004 CALL R2 3 - 0x80040400, // 0005 RET 1 R2 - }) - ), - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(widget_dtor_impl), - }), - &be_const_str__X3Clambda_X3E, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x68080000, // 0000 GETUPV R2 U0 - 0x8C080500, // 0001 GETMET R2 R2 K0 - 0x5C100000, // 0002 MOVE R4 R0 - 0x5C140200, // 0003 MOVE R5 R1 - 0x7C080600, // 0004 CALL R2 3 - 0x80040400, // 0005 RET 1 R2 - }) - ), - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(widget_event_impl), - }), - &be_const_str__X3Clambda_X3E, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x68080000, // 0000 GETUPV R2 U0 - 0x8C080500, // 0001 GETMET R2 R2 K0 - 0x5C100000, // 0002 MOVE R4 R0 - 0x5C140200, // 0003 MOVE R5 R1 - 0x7C080600, // 0004 CALL R2 3 - 0x80040400, // 0005 RET 1 R2 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[15]) { /* constants */ - /* K0 */ be_nested_str(cb), - /* K1 */ be_nested_str(widget_ctor_cb), - /* K2 */ be_nested_str(gen_cb), - /* K3 */ be_nested_str(widget_dtor_cb), - /* K4 */ be_nested_str(widget_event_cb), - /* K5 */ be_nested_str(widget_struct_default), - /* K6 */ be_nested_str(lv), - /* K7 */ be_nested_str(lv_obj_class), - /* K8 */ be_nested_str(lv_obj), - /* K9 */ be_nested_str(_class), - /* K10 */ be_nested_str(copy), - /* K11 */ be_nested_str(base_class), - /* K12 */ be_nested_str(constructor_cb), - /* K13 */ be_nested_str(destructor_cb), - /* K14 */ be_nested_str(event_cb), - }), - &be_const_str_widget_cb, - &be_const_str_solidified, - ( &(const binstruction[54]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x88080101, // 0001 GETMBR R2 R0 K1 - 0x4C0C0000, // 0002 LDNIL R3 - 0x1C080403, // 0003 EQ R2 R2 R3 - 0x780A0003, // 0004 JMPF R2 #0009 - 0x8C080302, // 0005 GETMET R2 R1 K2 - 0x84100000, // 0006 CLOSURE R4 P0 - 0x7C080400, // 0007 CALL R2 2 - 0x90020202, // 0008 SETMBR R0 K1 R2 - 0x88080103, // 0009 GETMBR R2 R0 K3 - 0x4C0C0000, // 000A LDNIL R3 - 0x1C080403, // 000B EQ R2 R2 R3 - 0x780A0003, // 000C JMPF R2 #0011 - 0x8C080302, // 000D GETMET R2 R1 K2 - 0x84100001, // 000E CLOSURE R4 P1 - 0x7C080400, // 000F CALL R2 2 - 0x90020602, // 0010 SETMBR R0 K3 R2 - 0x88080104, // 0011 GETMBR R2 R0 K4 - 0x4C0C0000, // 0012 LDNIL R3 - 0x1C080403, // 0013 EQ R2 R2 R3 - 0x780A0003, // 0014 JMPF R2 #0019 - 0x8C080302, // 0015 GETMET R2 R1 K2 - 0x84100002, // 0016 CLOSURE R4 P2 - 0x7C080400, // 0017 CALL R2 2 - 0x90020802, // 0018 SETMBR R0 K4 R2 - 0x88080105, // 0019 GETMBR R2 R0 K5 - 0x4C0C0000, // 001A LDNIL R3 - 0x1C080403, // 001B EQ R2 R2 R3 - 0x780A0016, // 001C JMPF R2 #0034 - 0xB80A0C00, // 001D GETNGBL R2 K6 - 0x8C080507, // 001E GETMET R2 R2 K7 - 0xB8120C00, // 001F GETNGBL R4 K6 - 0x88100908, // 0020 GETMBR R4 R4 K8 - 0x88100909, // 0021 GETMBR R4 R4 K9 - 0x7C080400, // 0022 CALL R2 2 - 0x8C08050A, // 0023 GETMET R2 R2 K10 - 0x7C080200, // 0024 CALL R2 1 - 0x90020A02, // 0025 SETMBR R0 K5 R2 - 0x88080105, // 0026 GETMBR R2 R0 K5 - 0xB80E0C00, // 0027 GETNGBL R3 K6 - 0x880C0708, // 0028 GETMBR R3 R3 K8 - 0x880C0709, // 0029 GETMBR R3 R3 K9 - 0x900A1603, // 002A SETMBR R2 K11 R3 - 0x88080105, // 002B GETMBR R2 R0 K5 - 0x880C0101, // 002C GETMBR R3 R0 K1 - 0x900A1803, // 002D SETMBR R2 K12 R3 - 0x88080105, // 002E GETMBR R2 R0 K5 - 0x880C0103, // 002F GETMBR R3 R0 K3 - 0x900A1A03, // 0030 SETMBR R2 K13 R3 - 0x88080105, // 0031 GETMBR R2 R0 K5 - 0x880C0104, // 0032 GETMBR R3 R0 K4 - 0x900A1C03, // 0033 SETMBR R2 K14 R3 - 0xA0000000, // 0034 CLOSE R0 - 0x80000000, // 0035 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified class: LVGL_glob ********************************************************************/ be_local_class(LVGL_glob, 11, NULL, - be_nested_map(24, + be_nested_map(26, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(widget_ctor_cb, -1), be_const_var(6) }, - { be_const_key(make_cb, 8), be_const_closure(LVGL_glob_make_cb_closure) }, - { be_const_key(widget_struct_by_class, 4), be_const_var(10) }, - { be_const_key(init, -1), be_const_closure(LVGL_glob_init_closure) }, - { be_const_key(register_obj, -1), be_const_closure(LVGL_glob_register_obj_closure) }, - { be_const_key(widget_dtor_cb, -1), be_const_var(7) }, - { be_const_key(deregister_obj, -1), be_const_closure(LVGL_glob_deregister_obj_closure) }, - { be_const_key(widget_ctor_impl, -1), be_const_closure(LVGL_glob_widget_ctor_impl_closure) }, - { be_const_key(widget_event_impl, 11), be_const_closure(LVGL_glob_widget_event_impl_closure) }, - { be_const_key(get_object_from_ptr, 12), be_const_closure(LVGL_glob_get_object_from_ptr_closure) }, - { be_const_key(widget_event_cb, 21), be_const_var(8) }, - { be_const_key(lvgl_timer_dispatch, -1), be_const_closure(LVGL_glob_lvgl_timer_dispatch_closure) }, - { be_const_key(event_cb, 6), be_const_var(2) }, { be_const_key(cb_event_closure, -1), be_const_var(1) }, + { be_const_key(create_custom_widget, 20), be_const_closure(LVGL_glob_create_custom_widget_closure) }, + { be_const_key(widget_event_cb, -1), be_const_var(8) }, + { be_const_key(event_cb, -1), be_const_var(2) }, + { be_const_key(cb_do_nothing, 15), be_const_static_closure(LVGL_glob__anonymous__closure) }, + { be_const_key(get_object_from_ptr, 9), be_const_closure(LVGL_glob_get_object_from_ptr_closure) }, + { be_const_key(timer_cb, 22), be_const_var(3) }, + { be_const_key(add_cb_event_closure, -1), be_const_closure(LVGL_glob_add_cb_event_closure_closure) }, + { be_const_key(null_cb, -1), be_const_var(5) }, + { be_const_key(widget_ctor_impl, -1), be_const_closure(LVGL_glob_widget_ctor_impl_closure) }, { be_const_key(lvgl_event_dispatch, -1), be_const_closure(LVGL_glob_lvgl_event_dispatch_closure) }, { be_const_key(event, -1), be_const_var(4) }, - { be_const_key(timer_cb, 19), be_const_var(3) }, + { be_const_key(widget_ctor_cb, -1), be_const_var(6) }, { be_const_key(widget_struct_default, -1), be_const_var(9) }, - { be_const_key(cb_obj, 16), be_const_var(0) }, + { be_const_key(init, -1), be_const_closure(LVGL_glob_init_closure) }, + { be_const_key(register_obj, -1), be_const_closure(LVGL_glob_register_obj_closure) }, + { be_const_key(get_event_cb, 10), be_const_closure(LVGL_glob_get_event_cb_closure) }, + { be_const_key(lvgl_timer_dispatch, -1), be_const_closure(LVGL_glob_lvgl_timer_dispatch_closure) }, + { be_const_key(make_cb, 14), be_const_closure(LVGL_glob_make_cb_closure) }, + { be_const_key(widget_dtor_cb, 18), be_const_var(7) }, { be_const_key(widget_dtor_impl, -1), be_const_closure(LVGL_glob_widget_dtor_impl_closure) }, - { be_const_key(null_cb, -1), be_const_var(5) }, - { be_const_key(create_custom_widget, -1), be_const_closure(LVGL_glob_create_custom_widget_closure) }, - { be_const_key(cb_do_nothing, -1), be_const_static_closure(LVGL_glob__anonymous__closure) }, - { be_const_key(widget_cb, -1), be_const_closure(LVGL_glob_widget_cb_closure) }, + { be_const_key(widget_event_impl, -1), be_const_closure(LVGL_glob_widget_event_impl_closure) }, + { be_const_key(cb_obj, -1), be_const_var(0) }, + { be_const_key(deregister_obj, -1), be_const_closure(LVGL_glob_deregister_obj_closure) }, + { be_const_key(widget_struct_by_class, 1), be_const_var(10) }, + { be_const_key(widget_cb, 0), be_const_closure(LVGL_glob_widget_cb_closure) }, })), be_str_literal("LVGL_glob") ); diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_glob.be b/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_glob.be index 0fde41f24..53d117e5c 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_glob.be +++ b/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_glob.be @@ -5,8 +5,8 @@ class LVGL_glob # all variables are lazily initialized to reduce the memory pressure. Until they are used, they consume zero memory var cb_obj # map between a native C pointer (as int) and the corresponding lv.lv_* berry object, also helps marking the objects as non-gc-able - var cb_event_closure # mapping for event closures per LVGL native pointer (int) - var event_cb # native callback for lv.lv_event + var cb_event_closure # mapping for event closures per LVGL native pointer (int). For each int key, contains either a closure or an array with multiple closures + var event_cb # array of native callback for lv.lv_event (when multiple are needed) var timer_cb # native callback for lv.lv_timer var event # keep aroud the current lv_event to avoid repeated allocation @@ -14,7 +14,7 @@ class LVGL_glob var null_cb # cb called if type is not supported var widget_ctor_cb var widget_dtor_cb - var widget_event_cb + var widget_event_cb # callback object that calls `widget_event_impl(object, event)` var widget_struct_default var widget_struct_by_class @@ -36,25 +36,42 @@ class LVGL_glob self.cb_obj[obj._p] = obj end + # get event callback by rank number, expand the list if needed + def get_event_cb(n) + if self.event_cb == nil self.event_cb = [] end # lazy initial initialization + + var cb_arr = self.event_cb + for i: size(cb_arr) .. n + var next_cb = cb.gen_cb(/ event_ptr -> self.lvgl_event_dispatch(i, event_ptr)) + cb_arr.push(next_cb) + end + + return cb_arr[n] + end + def get_object_from_ptr(ptr) if self.cb_obj != nil return self.cb_obj.find(ptr) # raise an exception if something is wrong end end - def lvgl_event_dispatch(event_ptr_i) + def lvgl_event_dispatch(rank, event_ptr_i) import introspect var event_ptr = introspect.toptr(event_ptr_i) + # use always the same instance of lv.lv_event by changing pointer, create a new the first time if self.event self.event._change_buffer(event_ptr) else self.event = lv.lv_event(event_ptr) end - var target = self.event.target - var f = self.cb_event_closure[target] - var obj = self.get_object_from_ptr(target) - #print('>> lvgl_event_dispatch', f, obj, event) - f(obj, self.event) + var target = self.event.target # LVGL native object as target of the event (comptr) + var obj = self.get_object_from_ptr(target) # get the corresponding Berry LVGL object previously recorded as its container + var f = self.cb_event_closure[target] # get the closure or closure list known for this object + if type(f) == 'function' # if only one callback, just use it + f(obj, self.event) + elif rank < size(f) # if more than one, then it's a list - use the closure for `rank` + f[rank](obj, self.event) + end end def lvgl_timer_dispatch(timer_int) @@ -63,7 +80,38 @@ class LVGL_glob var timer_ptr = introspect.toptr(timer_int) var f = self.cb_event_closure[timer_ptr] #print('>> lvgl_timer_dispatch', f, obj, event) - f(timer_ptr) + if type(f) == 'function' + f(timer_ptr) + else + # array + var i = 0 + while i < size(f) + f[i](timer_ptr) + i += 1 + end + end + end + + # add a closure `f` to the object `o` + # + # returns: rank of the cb for this object, starting at `0` + def add_cb_event_closure(o, f) + if self.cb_event_closure == nil self.cb_event_closure = {} end # lazy instanciation + if self.cb_event_closure.contains(o) + # contains already a value, create an array if needed + var cur = self.cb_event_closure[o] + if type(cur) == 'function' + self.cb_event_closure[o] = [cur, f] + return 1 + else + # should be already an array + self.cb_event_closure[o].push(f) + return size(self.cb_event_closure[o]) - 1 + end + else + self.cb_event_closure[o] = f + return 0 + end end def make_cb(f, obj, name) @@ -71,25 +119,18 @@ class LVGL_glob # print('>> make_cb', f, name, obj) # record the object, whatever the callback - if name == "lv_event_cb" - if self.cb_event_closure == nil self.cb_event_closure = {} end # lazy instanciation - if self.event_cb == nil self.event_cb = cb.gen_cb(/ event_ptr -> self.lvgl_event_dispatch(event_ptr)) end # encapsulate 'self' in closure - + if name == "lv_event_cb" self.register_obj(obj) # keep a record of the object to prevent from being gc'ed - if self.cb_event_closure.contains(obj._p) - tasmota.log("LVG: object:" + str(obj) + "has already an event callback", 2) - end - self.cb_event_closure[obj._p] = f # keep a mapping of the closure to call, indexed by internal lvgl native pointer - return self.event_cb + var rank = self.add_cb_event_closure(obj._p, f) + # if self.cb_event_closure.contains(obj._p) + # tasmota.log("LVG: object:" + str(obj) + "has already an event callback", 2) + # end + # self.cb_event_closure[obj._p] = f # keep a mapping of the closure to call, indexed by internal lvgl native pointer + return self.get_event_cb(rank) elif name == "lv_timer_cb" - if self.cb_event_closure == nil self.cb_event_closure = {} end # lazy instanciation if self.timer_cb == nil self.timer_cb = cb.gen_cb(/ timer_ptr -> self.lvgl_timer_dispatch(timer_ptr)) end # encapsulate 'self' in closure - # no need to register the object since it's only a pointer to a timer - if self.cb_event_closure.contains(obj._p) - tasmota.log("LVG: object:" + str(obj) + "has already an event callback", 2) - end - self.cb_event_closure[obj._p] = f # keep a mapping of the closure to call, indexed by internal lvgl native pointer + self.add_cb_event_closure(obj._p, f) return self.timer_cb # elif name == "" @@ -133,7 +174,6 @@ class LVGL_glob obj.widget_event(cl, event) end end - # print("widget_event_impl", cl, obj_ptr, obj, event) end diff --git a/tasmota/berry/lvgl_examples/lv.be b/tasmota/berry/lvgl_examples/lv.be index 24b70f0d0..dcf116b67 100644 --- a/tasmota/berry/lvgl_examples/lv.be +++ b/tasmota/berry/lvgl_examples/lv.be @@ -1,4 +1,6 @@ #- start LVGL and init environment -# +import global + lv.start() hres = lv.get_hor_res() # should be 320 @@ -80,28 +82,33 @@ prev_btn.add_event_cb(btn_clicked_cb, lv.EVENT_CLICKED, 0) next_btn.add_event_cb(btn_clicked_cb, lv.EVENT_CLICKED, 0) home_btn.add_event_cb(btn_clicked_cb, lv.EVENT_CLICKED, 0) - import lv_wifi_graph ws_h = 40 ws_w = 80 ws = lv_wifi_graph(scr) ws.set_size(ws_w,ws_h) -ws.set_pos(hres-ws_w, stat_line.get_height()) -tasmota.add_driver(ws) +ws.set_pos(hres-ws_w - 3, stat_line.get_height() + 3) # info bloc import lv_tasmota_info var info = lv_tasmota_info(scr) -info.set_pos(0, stat_line.get_height()) -info.set_size(hres - 80 + 1, 40) -tasmota.add_driver(info) +info.set_pos(3, stat_line.get_height()+ 3) +info.set_size(hres - 80 + 1 - 10, 40) # logs import lv_tasmota_log_roboto var lg = lv_tasmota_log_roboto(scr, 6) -lg.set_size(hres, 90) -lg.set_pos(0, stat_line.get_height() + 40 - 1) -tasmota.add_driver(lg) +lg.set_size(hres - 6, 90) +lg.set_pos(3, stat_line.get_height() + 40 + 6) + +# 3D cube +var cube +if global.accelerator + import lv_3D_cube_widget + cube = lv_3D_cube_widget(scr, global.accelerator) + cube.set_pos(3,161) +end + #- sb120 = lv.load_freetype_font("sketchbook.ttf", 120, 0) diff --git a/tasmota/berry/lvgl_examples/lv_tasmota_info.be b/tasmota/berry/lvgl_examples/lv_tasmota_info.be index 250e7b417..a8fcc2621 100644 --- a/tasmota/berry/lvgl_examples/lv_tasmota_info.be +++ b/tasmota/berry/lvgl_examples/lv_tasmota_info.be @@ -26,14 +26,17 @@ class lv_tasmota_info : lv.label self.msg = "IP: - \nFree: - kB" self.set_text(self.msg) self.delay = 1 + + self.add_event_cb(/->self.before_del(), lv.EVENT_DELETE, 0) # register `before_del` to be called when object is deleted + tasmota.add_driver(self) end def update() - var wifi_ip = "IP: " + tasmota.wifi().find('ip', '') + " " + tasmota.eth().find('ip', '') + var wifi_ip = "IP: " + tasmota.wifi().find('ip', '') + " " + tasmota.eth().find('ip', '') var tas_mem = tasmota.memory() - var mem_msg = "Free: " + str(tas_mem['heap_free']) + " kB" + var mem_msg = "Free: " + str(tas_mem['heap_free']) + " kB" if tas_mem.contains('psram_free') - mem_msg += " | PSRam: " + str(tas_mem['psram_free']) + " kB" + mem_msg += " PSRam: " + str(tas_mem['psram_free']) + " kB" end var msg = wifi_ip + "\n" + mem_msg @@ -51,6 +54,9 @@ class lv_tasmota_info : lv.label end end + def before_del() + tasmota.remove_driver(self) + end end return lv_tasmota_info diff --git a/tasmota/berry/lvgl_examples/lv_tasmota_log.be b/tasmota/berry/lvgl_examples/lv_tasmota_log.be index 40261a99b..0bf2b42de 100644 --- a/tasmota/berry/lvgl_examples/lv_tasmota_log.be +++ b/tasmota/berry/lvgl_examples/lv_tasmota_log.be @@ -1,12 +1,13 @@ # lv_tasmota_log class -class lv_tasmota_log : lv.label +class lv_tasmota_log : lv.obj + var label # contains the sub lv_label object var lines var line_len var log_reader var log_level - def init(parent, line_len) + def init(parent) super(self).init(parent) self.set_width(parent.get_width()) self.set_pos(0, 0) @@ -19,21 +20,68 @@ class lv_tasmota_log : lv.label self.set_style_pad_all(2, lv.PART_MAIN | lv.STATE_DEFAULT) self.set_style_border_color(lv.color(0x0099EE), lv.PART_MAIN | lv.STATE_DEFAULT) self.set_style_border_width(1, lv.PART_MAIN | lv.STATE_DEFAULT) + self.refr_size() + self.refr_pos() - self.set_style_text_color(lv.color(0x00FF00), lv.PART_MAIN | lv.STATE_DEFAULT) - self.set_long_mode(lv.LABEL_LONG_CLIP) - var lg_font = lv.font_montserrat(10) - self.set_style_text_font(lg_font, lv.PART_MAIN | lv.STATE_DEFAULT) - self.set_text("") + self.label = lv.label(self) + self.label.set_width(self.get_width() - 12) - self.line_len = line_len + self.label.set_style_text_color(lv.color(0x00FF00), lv.PART_MAIN | lv.STATE_DEFAULT) + self.label.set_long_mode(lv.LABEL_LONG_CLIP) + self.label.set_text("") # bug, still displays "Text" + + self.add_event_cb( / obj, evt -> self.size_changed_cb(obj, evt), lv.EVENT_SIZE_CHANGED | lv.EVENT_STYLE_CHANGED | lv.EVENT_DELETE, 0) + + self.lines = [] + self.line_len = 0 self.log_reader = tasmota_log_reader() self.log_level = 2 + self._size_changed() - # fill with empty strings - self.lines = [] - for i:1..line_len - self.lines.push("") + tasmota.add_driver(self) + end + + def set_lines_count(line_len) + if line_len > self.line_len # increase lines + for i: self.line_len .. line_len-1 + self.lines.insert(0, "") + end + elif line_len < self.line_len # decrease lines + for i: line_len .. self.line_len-1 + self.lines.remove(0) + end + end + self.line_len = line_len + end + + def _size_changed() + # print(">>> lv.EVENT_SIZE_CHANGED") + var pad_hor = self.get_style_pad_left(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_pad_right(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_border_width(lv.PART_MAIN | lv.STATE_DEFAULT) * 2 + + 3 + var pad_ver = self.get_style_pad_top(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_pad_bottom(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_border_width(lv.PART_MAIN | lv.STATE_DEFAULT) * 2 + + 3 + var w = self.get_width() - pad_hor + var h = self.get_height() - pad_ver + self.label.set_size(w, h) + # print("w",w,"h",h,"pad_hor",pad_hor,"pad_ver",pad_ver) + + # compute how many lines should be displayed + var h_font = lv.font_get_line_height(self.label.get_style_text_font(0)) # current font's height + var lines_count = ((h * 2 / h_font) + 1 ) / 2 + # print("h_font",h_font,"h",h,"lines_count",lines_count) + self.set_lines_count(lines_count) + end + + def size_changed_cb(obj, event) + var code = event.code + if code == lv.EVENT_SIZE_CHANGED || code == lv.EVENT_STYLE_CHANGED + self._size_changed() + elif code == lv.EVENT_DELETE + tasmota.remove_driver(self) end end @@ -51,14 +99,8 @@ class lv_tasmota_log : lv.label def update() var msg = self.lines.concat("\n") - self.set_text(msg) + self.label.set_text(msg) end end return lv_tasmota_log - -# import lv_tasmota_log -# var lg = lv_tasmota_log(scr, 8) -# lg.set_size(hres, 95) -# lg.set_pos(0, stat_line.get_height() + 40) -# tasmota.add_driver(lg) diff --git a/tasmota/berry/lvgl_examples/lv_tasmota_log_roboto.be b/tasmota/berry/lvgl_examples/lv_tasmota_log_roboto.be index c002d9b5a..79462aa85 100644 --- a/tasmota/berry/lvgl_examples/lv_tasmota_log_roboto.be +++ b/tasmota/berry/lvgl_examples/lv_tasmota_log_roboto.be @@ -1,12 +1,13 @@ # lv_tasmota_log class -class lv_tasmota_log_roboto : lv.label +class lv_tasmota_log_roboto : lv.obj + var label # contains the sub lv_label object var lines var line_len var log_reader var log_level - def init(parent, line_len) + def init(parent) super(self).init(parent) self.set_width(parent.get_width()) self.set_pos(0, 0) @@ -19,23 +20,71 @@ class lv_tasmota_log_roboto : lv.label self.set_style_pad_all(2, lv.PART_MAIN | lv.STATE_DEFAULT) self.set_style_border_color(lv.color(0x0099EE), lv.PART_MAIN | lv.STATE_DEFAULT) self.set_style_border_width(1, lv.PART_MAIN | lv.STATE_DEFAULT) + self.refr_size() + self.refr_pos() - self.set_style_text_color(lv.color(0x00FF00), lv.PART_MAIN | lv.STATE_DEFAULT) - self.set_long_mode(lv.LABEL_LONG_CLIP) + self.label = lv.label(self) + self.label.set_width(self.get_width() - 12) + + self.label.set_style_text_color(lv.color(0x00FF00), lv.PART_MAIN | lv.STATE_DEFAULT) + self.label.set_long_mode(lv.LABEL_LONG_CLIP) var roboto12 = lv.font_robotocondensed_latin1(12) - self.set_style_text_font(roboto12, lv.PART_MAIN | lv.STATE_DEFAULT) + self.label.set_style_text_font(roboto12, lv.PART_MAIN | lv.STATE_DEFAULT) # var lg_font = lv.font_montserrat(10) # self.set_style_text_font(lg_font, lv.PART_MAIN | lv.STATE_DEFAULT) - self.set_text("") + self.label.set_text("") # bug, still displays "Text" - self.line_len = line_len + self.add_event_cb( / obj, evt -> self.size_changed_cb(obj, evt), lv.EVENT_SIZE_CHANGED | lv.EVENT_STYLE_CHANGED | lv.EVENT_DELETE, 0) + + self.lines = [] + self.line_len = 0 self.log_reader = tasmota_log_reader() self.log_level = 2 + self._size_changed() - # fill with empty strings - self.lines = [] - for i:1..line_len - self.lines.push("") + tasmota.add_driver(self) + end + + def set_lines_count(line_len) + if line_len > self.line_len # increase lines + for i: self.line_len .. line_len-1 + self.lines.insert(0, "") + end + elif line_len < self.line_len # decrease lines + for i: line_len .. self.line_len-1 + self.lines.remove(0) + end + end + self.line_len = line_len + end + + def _size_changed() + # print(">>> lv.EVENT_SIZE_CHANGED") + var pad_hor = self.get_style_pad_left(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_pad_right(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_border_width(lv.PART_MAIN | lv.STATE_DEFAULT) * 2 + + 3 + var pad_ver = self.get_style_pad_top(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_pad_bottom(lv.PART_MAIN | lv.STATE_DEFAULT) + + self.get_style_border_width(lv.PART_MAIN | lv.STATE_DEFAULT) * 2 + + 3 + var w = self.get_width() - pad_hor + var h = self.get_height() - pad_ver + self.label.set_size(w, h) + + # compute how many lines should be displayed + var h_font = lv.font_get_line_height(self.label.get_style_text_font(0)) # current font's height + var lines_count = ((h * 2 / h_font) + 1 ) / 2 + # print("h_font",h_font,"h",h,"lines_count",lines_count) + self.set_lines_count(lines_count) + end + + def size_changed_cb(obj, event) + var code = event.code + if code == lv.EVENT_SIZE_CHANGED || code == lv.EVENT_STYLE_CHANGED + self._size_changed() + elif code == lv.EVENT_DELETE + tasmota.remove_driver(self) end end @@ -53,7 +102,7 @@ class lv_tasmota_log_roboto : lv.label def update() var msg = self.lines.concat("\n") - self.set_text(msg) + self.label.set_text(msg) end end diff --git a/tasmota/berry/lvgl_examples/lv_wifi_graph.be b/tasmota/berry/lvgl_examples/lv_wifi_graph.be index f522da5d1..bb03ec6c7 100644 --- a/tasmota/berry/lvgl_examples/lv_wifi_graph.be +++ b/tasmota/berry/lvgl_examples/lv_wifi_graph.be @@ -38,6 +38,9 @@ class lv_wifi_graph : lv.chart self.wsl.set_align(lv.ALIGN_BOTTOM_MID) self.delay = 1 + + self.add_event_cb(/->self.before_del(), lv.EVENT_DELETE, 0) # register `before_del` to be called when object is deleted + tasmota.add_driver(self) end def add_wifi_point() @@ -55,6 +58,10 @@ class lv_wifi_graph : lv.chart self.delay = 2 end end + + def before_del() + tasmota.remove_driver(self) + end end return lv_wifi_graph