diff --git a/lib/libesp32/Berry/default/be_autoconf_lib.c b/lib/libesp32/Berry/default/be_autoconf_lib.c index bec1382ea..9f638d6d7 100644 --- a/lib/libesp32/Berry/default/be_autoconf_lib.c +++ b/lib/libesp32/Berry/default/be_autoconf_lib.c @@ -40,10 +40,10 @@ be_local_closure(page_autoconf_ctl, /* name */ /* K16 */ be_nested_string("arg", 1047474471, 3), /* K17 */ be_nested_string("reset", 1695364032, 5), /* K18 */ be_nested_string("format", -1180859054, 6), - /* K19 */ be_nested_string("https://raw.githubusercontent.com/tasmota/autoconf/main/%s/%s_autoconf.zip", 2084253523, 74), + /* K19 */ be_nested_string("https://raw.githubusercontent.com/tasmota/autoconf/main/%s/%s.autoconf", -1551440987, 70), /* K20 */ be_nested_string("arch", -1342162999, 4), /* K21 */ be_nested_string("CFG: downloading '%s'", 589480701, 21), - /* K22 */ be_nested_string("%s_autoconf.zip", -1148460718, 15), + /* K22 */ be_nested_string("%s.autoconf", -734583772, 11), /* K23 */ be_nested_string("webclient", -218578150, 9), /* K24 */ be_nested_string("begin", 1748273790, 5), /* K25 */ be_nested_string("GET", -1763262857, 3), @@ -453,7 +453,7 @@ be_local_closure(page_autoconf_mgr, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[38]) { /* constants */ + ( &(const bvalue[39]) { /* constants */ /* K0 */ be_nested_string("webserver", 1572454038, 9), /* K1 */ be_nested_string("string", 398550328, 6), /* K2 */ be_nested_string("check_privileged_access", -602033328, 23), @@ -464,34 +464,35 @@ be_local_closure(page_autoconf_mgr, /* name */ /* K7 */ be_nested_string("

 (This feature requires an internet connection)

", -1575700810, 74), /* K8 */ be_nested_string("get_current_module_path", -1088293888, 23), /* K9 */ be_nested_string("tr", 1195724803, 2), - /* K10 */ be_nested_string("_", -636741266, 1), - /* K11 */ be_nested_string(" ", 621580159, 1), - /* K12 */ be_nested_string("_error", 1132109656, 6), - /* K13 */ be_nested_string("<Error: apply new or remove>", -1439459347, 34), - /* K14 */ be_nested_string("<None>", -1692801798, 12), - /* K15 */ be_nested_string("
", 842307168, 77), - /* K16 */ be_nested_string("format", -1180859054, 6), - /* K17 */ be_nested_string(" Current auto-configuration", -82466516, 82), - /* K18 */ be_nested_string("

Current configuration:

%s

", -179311535, 46), - /* K19 */ be_nested_string("

", 232646018, 57), - /* K21 */ be_nested_string("", -1147033080, 82), - /* K22 */ be_nested_string("

", -748395557, 11), - /* K23 */ be_nested_string("

", 2052843416, 25), - /* K24 */ be_nested_string(" Select new auto-configuration", 1926223891, 80), - /* K25 */ be_nested_string("

", -502554737, 94), - /* K27 */ be_nested_string("
", 1336654704, 49), - /* K28 */ be_nested_string("

", 1863865923, 16), - /* K34 */ be_nested_string("", 1205771629, 72), - /* K35 */ be_nested_string("content_button", 1956476087, 14), - /* K36 */ be_nested_string("BUTTON_CONFIGURATION", 70820856, 20), - /* K37 */ be_nested_string("content_stop", 658554751, 12), + /* K10 */ be_nested_string("get_current_module_name", -1915696556, 23), + /* K11 */ be_nested_string("_", -636741266, 1), + /* K12 */ be_nested_string(" ", 621580159, 1), + /* K13 */ be_nested_string("_error", 1132109656, 6), + /* K14 */ be_nested_string("<Error: apply new or remove>", -1439459347, 34), + /* K15 */ be_nested_string("<None>", -1692801798, 12), + /* K16 */ be_nested_string("
", 842307168, 77), + /* K17 */ be_nested_string("format", -1180859054, 6), + /* K18 */ be_nested_string(" Current auto-configuration", -82466516, 82), + /* K19 */ be_nested_string("

Current configuration:

%s

", -179311535, 46), + /* K20 */ be_nested_string("

", 232646018, 57), + /* K22 */ be_nested_string("", -1147033080, 82), + /* K23 */ be_nested_string("

", -748395557, 11), + /* K24 */ be_nested_string("

", 2052843416, 25), + /* K25 */ be_nested_string(" Select new auto-configuration", 1926223891, 80), + /* K26 */ be_nested_string("

", -502554737, 94), + /* K28 */ be_nested_string("
", 1336654704, 49), + /* K29 */ be_nested_string("

", 1863865923, 16), + /* K35 */ be_nested_string("", 1205771629, 72), + /* K36 */ be_nested_string("content_button", 1956476087, 14), + /* K37 */ be_nested_string("BUTTON_CONFIGURATION", 70820856, 20), + /* K38 */ be_nested_string("content_stop", 658554751, 12), }), (be_nested_const_str("page_autoconf_mgr", -651030265, 17)), ((bstring*) &be_const_str_input), @@ -515,71 +516,71 @@ be_local_closure(page_autoconf_mgr, /* name */ 0x7C0C0200, // 0010 CALL R3 1 0x780E0006, // 0011 JMPF R3 #0019 0x8C100509, // 0012 GETMET R4 R2 K9 - 0x8C180108, // 0013 GETMET R6 R0 K8 + 0x8C18010A, // 0013 GETMET R6 R0 K10 0x7C180200, // 0014 CALL R6 1 - 0x581C000A, // 0015 LDCONST R7 K10 - 0x5820000B, // 0016 LDCONST R8 K11 + 0x581C000B, // 0015 LDCONST R7 K11 + 0x5820000C, // 0016 LDCONST R8 K12 0x7C100800, // 0017 CALL R4 4 0x70020004, // 0018 JMP #001E - 0x8810010C, // 0019 GETMBR R4 R0 K12 + 0x8810010D, // 0019 GETMBR R4 R0 K13 0x78120001, // 001A JMPF R4 #001D - 0x5810000D, // 001B LDCONST R4 K13 + 0x5810000E, // 001B LDCONST R4 K14 0x70020000, // 001C JMP #001E - 0x5810000E, // 001D LDCONST R4 K14 + 0x5810000F, // 001D LDCONST R4 K15 0x8C140306, // 001E GETMET R5 R1 K6 - 0x581C000F, // 001F LDCONST R7 K15 + 0x581C0010, // 001F LDCONST R7 K16 0x7C140400, // 0020 CALL R5 2 0x8C140306, // 0021 GETMET R5 R1 K6 - 0x8C1C0510, // 0022 GETMET R7 R2 K16 - 0x58240011, // 0023 LDCONST R9 K17 + 0x8C1C0511, // 0022 GETMET R7 R2 K17 + 0x58240012, // 0023 LDCONST R9 K18 0x7C1C0400, // 0024 CALL R7 2 0x7C140400, // 0025 CALL R5 2 0x8C140306, // 0026 GETMET R5 R1 K6 - 0x8C1C0510, // 0027 GETMET R7 R2 K16 - 0x58240012, // 0028 LDCONST R9 K18 + 0x8C1C0511, // 0027 GETMET R7 R2 K17 + 0x58240013, // 0028 LDCONST R9 K19 0x5C280800, // 0029 MOVE R10 R4 0x7C1C0600, // 002A CALL R7 3 0x7C140400, // 002B CALL R5 2 0x780E000B, // 002C JMPF R3 #0039 0x8C140306, // 002D GETMET R5 R1 K6 - 0x581C0013, // 002E LDCONST R7 K19 + 0x581C0014, // 002E LDCONST R7 K20 0x7C140400, // 002F CALL R5 2 0x8C140306, // 0030 GETMET R5 R1 K6 - 0x581C0014, // 0031 LDCONST R7 K20 + 0x581C0015, // 0031 LDCONST R7 K21 0x7C140400, // 0032 CALL R5 2 0x8C140306, // 0033 GETMET R5 R1 K6 - 0x581C0015, // 0034 LDCONST R7 K21 + 0x581C0016, // 0034 LDCONST R7 K22 0x7C140400, // 0035 CALL R5 2 0x8C140306, // 0036 GETMET R5 R1 K6 - 0x581C0016, // 0037 LDCONST R7 K22 + 0x581C0017, // 0037 LDCONST R7 K23 0x7C140400, // 0038 CALL R5 2 0x8C140306, // 0039 GETMET R5 R1 K6 - 0x581C0017, // 003A LDCONST R7 K23 + 0x581C0018, // 003A LDCONST R7 K24 0x7C140400, // 003B CALL R5 2 0x8C140306, // 003C GETMET R5 R1 K6 - 0x581C000F, // 003D LDCONST R7 K15 + 0x581C0010, // 003D LDCONST R7 K16 0x7C140400, // 003E CALL R5 2 0x8C140306, // 003F GETMET R5 R1 K6 - 0x8C1C0510, // 0040 GETMET R7 R2 K16 - 0x58240018, // 0041 LDCONST R9 K24 + 0x8C1C0511, // 0040 GETMET R7 R2 K17 + 0x58240019, // 0041 LDCONST R9 K25 0x7C1C0400, // 0042 CALL R7 2 0x7C140400, // 0043 CALL R5 2 0x8C140306, // 0044 GETMET R5 R1 K6 - 0x581C0019, // 0045 LDCONST R7 K25 + 0x581C001A, // 0045 LDCONST R7 K26 0x7C140400, // 0046 CALL R5 2 0x8C140306, // 0047 GETMET R5 R1 K6 - 0x581C001A, // 0048 LDCONST R7 K26 + 0x581C001B, // 0048 LDCONST R7 K27 0x7C140400, // 0049 CALL R5 2 0x8C140306, // 004A GETMET R5 R1 K6 - 0x581C001B, // 004B LDCONST R7 K27 + 0x581C001C, // 004B LDCONST R7 K28 0x7C140400, // 004C CALL R5 2 0x8C140306, // 004D GETMET R5 R1 K6 - 0x581C001C, // 004E LDCONST R7 K28 + 0x581C001D, // 004E LDCONST R7 K29 0x7C140400, // 004F CALL R5 2 - 0x8C14011D, // 0050 GETMET R5 R0 K29 + 0x8C14011E, // 0050 GETMET R5 R0 K30 0x7C140200, // 0051 CALL R5 1 0x8C180306, // 0052 GETMET R6 R1 K6 - 0x5820001E, // 0053 LDCONST R8 K30 + 0x5820001F, // 0053 LDCONST R8 K31 0x7C180400, // 0054 CALL R6 2 0x60180010, // 0055 GETGBL R6 G16 0x5C1C0A00, // 0056 MOVE R7 R5 @@ -588,36 +589,36 @@ be_local_closure(page_autoconf_mgr, /* name */ 0x5C1C0C00, // 0059 MOVE R7 R6 0x7C1C0000, // 005A CALL R7 0 0x8C200306, // 005B GETMET R8 R1 K6 - 0x8C280510, // 005C GETMET R10 R2 K16 - 0x5830001F, // 005D LDCONST R12 K31 + 0x8C280511, // 005C GETMET R10 R2 K17 + 0x58300020, // 005D LDCONST R12 K32 0x5C340E00, // 005E MOVE R13 R7 0x8C380509, // 005F GETMET R14 R2 K9 0x5C400E00, // 0060 MOVE R16 R7 - 0x5844000A, // 0061 LDCONST R17 K10 - 0x5848000B, // 0062 LDCONST R18 K11 + 0x5844000B, // 0061 LDCONST R17 K11 + 0x5848000C, // 0062 LDCONST R18 K12 0x7C380800, // 0063 CALL R14 4 0x7C280800, // 0064 CALL R10 4 0x7C200400, // 0065 CALL R8 2 0x7001FFF1, // 0066 JMP #0059 - 0x58180020, // 0067 LDCONST R6 K32 + 0x58180021, // 0067 LDCONST R6 K33 0xAC180200, // 0068 CATCH R6 1 0 0xB0080000, // 0069 RAISE 2 R0 R0 0x8C180306, // 006A GETMET R6 R1 K6 - 0x58200021, // 006B LDCONST R8 K33 + 0x58200022, // 006B LDCONST R8 K34 0x7C180400, // 006C CALL R6 2 0x8C180306, // 006D GETMET R6 R1 K6 - 0x58200022, // 006E LDCONST R8 K34 + 0x58200023, // 006E LDCONST R8 K35 0x7C180400, // 006F CALL R6 2 0x8C180306, // 0070 GETMET R6 R1 K6 - 0x58200016, // 0071 LDCONST R8 K22 + 0x58200017, // 0071 LDCONST R8 K23 0x7C180400, // 0072 CALL R6 2 0x8C180306, // 0073 GETMET R6 R1 K6 - 0x58200017, // 0074 LDCONST R8 K23 + 0x58200018, // 0074 LDCONST R8 K24 0x7C180400, // 0075 CALL R6 2 - 0x8C180323, // 0076 GETMET R6 R1 K35 - 0x88200324, // 0077 GETMBR R8 R1 K36 + 0x8C180324, // 0076 GETMET R6 R1 K36 + 0x88200325, // 0077 GETMBR R8 R1 K37 0x7C180400, // 0078 CALL R6 2 - 0x8C180325, // 0079 GETMET R6 R1 K37 + 0x8C180326, // 0079 GETMET R6 R1 K38 0x7C180200, // 007A CALL R6 1 0x80000000, // 007B RET 0 }) @@ -646,7 +647,7 @@ be_local_closure(get_current_module_name, /* name */ (be_nested_const_str("get_current_module_name", -1915696556, 23)), ((bstring*) &be_const_str_input), ( &(const binstruction[ 5]) { /* code */ - 0x5405FFF2, // 0000 LDINT R1 -13 + 0x5405FFF5, // 0000 LDINT R1 -10 0x40060201, // 0001 CONNECT R1 K1 R1 0x88080100, // 0002 GETMBR R2 R0 K0 0x94040401, // 0003 GETIDX R1 R2 R1 @@ -676,7 +677,7 @@ be_local_closure(delete_all_configs, /* name */ /* K2 */ be_nested_string("listdir", 2005220720, 7), /* K3 */ be_nested_string("/", 705468254, 1), /* K4 */ be_nested_string("find", -1108310694, 4), - /* K5 */ be_nested_string("_autoconf.zip", 1641927766, 13), + /* K5 */ be_nested_string(".autoconf", -1770288208, 9), /* K6 */ be_const_int(0), /* K7 */ be_nested_string("remove", -611183107, 6), /* K8 */ be_nested_string("stop_iteration", -121173395, 14), @@ -782,7 +783,7 @@ be_local_closure(load_templates, /* name */ /* K16 */ be_nested_string("load", -435725847, 4), /* K17 */ be_nested_string("CFG: loaded '%s'", 1699028828, 16), /* K18 */ be_nested_string("find", -1108310694, 4), - /* K19 */ be_nested_string("zip", -1417514060, 3), + /* K19 */ be_nested_string("files", 1055342736, 5), /* K20 */ be_nested_string("CFG: exception '%s' - '%s'", -199559383, 26), }), (be_nested_const_str("load_templates", -781097163, 14)), @@ -969,12 +970,12 @@ be_local_closure(init, /* name */ /* K5 */ be_nested_string("add_driver", 1654458371, 10), /* K6 */ be_const_int(0), /* K7 */ be_nested_string("find", -1108310694, 4), - /* K8 */ be_nested_string("_autoconf.zip", 1641927766, 13), + /* K8 */ be_nested_string(".autoconf", -1770288208, 9), /* K9 */ be_nested_string("format", -1180859054, 6), /* K10 */ be_nested_string("CFG: multiple autoconf files found, aborting ('%s' + '%s')", 197663371, 58), /* K11 */ be_nested_string("_error", 1132109656, 6), /* K12 */ be_const_int(1), - /* K13 */ be_nested_string("CFG: no '*_autoconf.zip' file found", -1047382425, 35), + /* K13 */ be_nested_string("CFG: no '*.autoconf' file found", 127493957, 31), /* K14 */ be_nested_string("_archive", -290407892, 8), }), (be_nested_const_str("init", 380752755, 4)), @@ -1115,7 +1116,7 @@ be_local_closure(reset, /* name */ /* K3 */ be_nested_string("/", 705468254, 1), /* K4 */ be_const_int(0), /* K5 */ be_nested_string("find", -1108310694, 4), - /* K6 */ be_nested_string("_autoconf.zip", 1641927766, 13), + /* K6 */ be_nested_string(".autoconf", -1770288208, 9), /* K7 */ be_nested_string("remove", -611183107, 6), /* K8 */ be_nested_string("format", -1180859054, 6), /* K9 */ be_nested_string("CFG: removed file '%s'", 2048602473, 22), diff --git a/lib/libesp32/Berry/default/be_modtab.c b/lib/libesp32/Berry/default/be_modtab.c index 1b219658f..7e1a1bad9 100644 --- a/lib/libesp32/Berry/default/be_modtab.c +++ b/lib/libesp32/Berry/default/be_modtab.c @@ -27,6 +27,7 @@ be_extern_native_module(strict); be_extern_native_module(python_compat); be_extern_native_module(persist); be_extern_native_module(autoconf); +be_extern_native_module(tapp); be_extern_native_module(light); be_extern_native_module(gpio); be_extern_native_module(display); @@ -90,6 +91,7 @@ BERRY_LOCAL const bntvmodule* const be_module_table[] = { #ifdef USE_AUTOCONF &be_native_module(autoconf), #endif // USE_AUTOCONF + &be_native_module(tapp), &be_native_module(gpio), #ifdef USE_DISPLAY &be_native_module(display), diff --git a/lib/libesp32/Berry/default/be_tapp_lib.c b/lib/libesp32/Berry/default/be_tapp_lib.c new file mode 100644 index 000000000..7a8cbe693 --- /dev/null +++ b/lib/libesp32/Berry/default/be_tapp_lib.c @@ -0,0 +1,164 @@ +/******************************************************************** + * Tasmota App manager + * + * To use: `import tapp` + * + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(init, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* 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_string("tasmota", 424643812, 7), + /* K1 */ be_nested_string("add_driver", 1654458371, 10), + }), + (be_nested_const_str("init", 380752755, 4)), + ((bstring*) &be_const_str_input), + ( &(const binstruction[ 5]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C040400, // 0003 CALL R1 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: autoexec +********************************************************************/ +be_local_closure(autoexec, /* name */ + be_nested_proto( + 11, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_string("path", -2071507658, 4), + /* K1 */ be_nested_string("string", 398550328, 6), + /* K2 */ be_nested_string("listdir", 2005220720, 7), + /* K3 */ be_nested_string("/", 705468254, 1), + /* K4 */ be_nested_string("find", -1108310694, 4), + /* K5 */ be_nested_string(".tapp", 1363391594, 5), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_string("format", -1180859054, 6), + /* K8 */ be_nested_string("TAP: found Tasmota App '%s'", -1651814898, 27), + /* K9 */ be_nested_string("tasmota", 424643812, 7), + /* K10 */ be_nested_string("load", -435725847, 4), + /* K11 */ be_nested_string("#autoexec.be", 1181757091, 12), + /* K12 */ be_nested_string("stop_iteration", -121173395, 14), + }), + (be_nested_const_str("autoexec", -618105405, 8)), + ((bstring*) &be_const_str_input), + ( &(const binstruction[32]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x8C0C0302, // 0002 GETMET R3 R1 K2 + 0x58140003, // 0003 LDCONST R5 K3 + 0x7C0C0400, // 0004 CALL R3 2 + 0x60100010, // 0005 GETGBL R4 G16 + 0x5C140600, // 0006 MOVE R5 R3 + 0x7C100200, // 0007 CALL R4 1 + 0xA8020012, // 0008 EXBLK 0 #001C + 0x5C140800, // 0009 MOVE R5 R4 + 0x7C140000, // 000A CALL R5 0 + 0x8C180504, // 000B GETMET R6 R2 K4 + 0x5C200A00, // 000C MOVE R8 R5 + 0x58240005, // 000D LDCONST R9 K5 + 0x7C180600, // 000E CALL R6 3 + 0x24180D06, // 000F GT R6 R6 K6 + 0x781A0009, // 0010 JMPF R6 #001B + 0x60180001, // 0011 GETGBL R6 G1 + 0x8C1C0507, // 0012 GETMET R7 R2 K7 + 0x58240008, // 0013 LDCONST R9 K8 + 0x5C280A00, // 0014 MOVE R10 R5 + 0x7C1C0600, // 0015 CALL R7 3 + 0x7C180200, // 0016 CALL R6 1 + 0xB81A1200, // 0017 GETNGBL R6 K9 + 0x8C180D0A, // 0018 GETMET R6 R6 K10 + 0x00200B0B, // 0019 ADD R8 R5 K11 + 0x7C180400, // 001A CALL R6 2 + 0x7001FFEC, // 001B JMP #0009 + 0x5810000C, // 001C LDCONST R4 K12 + 0xAC100200, // 001D CATCH R4 1 0 + 0xB0080000, // 001E RAISE 2 R0 R0 + 0x80000000, // 001F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Tapp +********************************************************************/ +be_local_class(Tapp, + 0, + NULL, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_closure(init_closure) }, + { be_nested_key("autoexec", -618105405, 8, 0), be_const_closure(autoexec_closure) }, + })), + (be_nested_const_str("Tapp", 2012315062, 4)) +); + +/******************************************************************** +** Solidified function: _anonymous_ +********************************************************************/ +be_local_closure(_anonymous_, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* 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_const_class(be_class_Tapp), + }), + (be_nested_const_str("_anonymous_", 1957281476, 11)), + ((bstring*) &be_const_str_input), + ( &(const binstruction[ 5]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0xB4000000, // 0001 CLASS K0 + 0x5C080200, // 0002 MOVE R2 R1 + 0x7C080000, // 0003 CALL R2 0 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified module: tapp +********************************************************************/ +be_local_module(tapp, + "tapp", + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_closure(_anonymous__closure) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(tapp); +/********************************************************************/ diff --git a/lib/libesp32/Berry/default/embedded/autoconf.be b/lib/libesp32/Berry/default/embedded/autoconf.be index 3be35fe1e..3f9586e04 100644 --- a/lib/libesp32/Berry/default/embedded/autoconf.be +++ b/lib/libesp32/Berry/default/embedded/autoconf.be @@ -36,7 +36,7 @@ autoconf_module.init = def (m) var i = 0 while i < size(dir) - if string.find(dir[i], "_autoconf.zip") > 0 # does the file contain '*_autoconf.zip' + if string.find(dir[i], ".autoconf") > 0 # does the file contain '*.autoconf', >0 to skip `.autoconf` if entry != nil # we have multiple configuration files, not allowed print(string.format("CFG: multiple autoconf files found, aborting ('%s' + '%s')", entry, dir[i])) @@ -49,7 +49,7 @@ autoconf_module.init = def (m) end if entry == nil - print("CFG: no '*_autoconf.zip' file found") + print("CFG: no '*.autoconf' file found") return nil end @@ -82,7 +82,7 @@ autoconf_module.init = def (m) var dir = path.listdir("/") for d:dir - if string.find(d, "_autoconf.zip") > 0 # does the file contain '*_autoconf.zip' + if string.find(d, ".autoconf") > 0 # does the file contain '*.autoconf' path.remove(d) end end @@ -90,14 +90,14 @@ autoconf_module.init = def (m) # #################################################################################################### # Get current module - # contains the name of the archive without leading `/`, ex: `M5Stack_Fire_autoconf.zip` + # contains the name of the archive without leading `/`, ex: `M5Stack_Fire.autoconf` # or `nil` if none # #################################################################################################### def get_current_module_path() return self._archive end def get_current_module_name() - return self._archive[0..-13] + return self._archive[0..-10] end # #################################################################################################### @@ -123,7 +123,7 @@ autoconf_module.init = def (m) var j = json.load(s) tasmota.log(string.format("CFG: loaded '%s'", str(j)), 3) - var t = j.find("zip") + var t = j.find("files") if isinstance(t, list) return t end @@ -156,7 +156,7 @@ autoconf_module.init = def (m) webserver.content_send("

 (This feature requires an internet connection)

") var cur_module = self.get_current_module_path() - var cur_module_display = cur_module ? string.tr(self.get_current_module_path(), "_", " ") : self._error ? "<Error: apply new or remove>" : "<None>" + var cur_module_display = cur_module ? string.tr(self.get_current_module_name(), "_", " ") : self._error ? "<Error: apply new or remove>" : "<None>" webserver.content_send("
") webserver.content_send(string.format(" Current auto-configuration")) @@ -227,10 +227,10 @@ autoconf_module.init = def (m) var arch_name = webserver.arg("zip") if arch_name != "reset" - var url = string.format("https://raw.githubusercontent.com/tasmota/autoconf/main/%s/%s_autoconf.zip", tasmota.arch(), arch_name) + var url = string.format("https://raw.githubusercontent.com/tasmota/autoconf/main/%s/%s.autoconf", tasmota.arch(), arch_name) tasmota.log(string.format("CFG: downloading '%s'", url), 2); - var local_file = string.format("%s_autoconf.zip", arch_name) + var local_file = string.format("%s.autoconf", arch_name) # download file and write directly to file system var cl = webclient() @@ -282,7 +282,7 @@ autoconf_module.init = def (m) var i = 0 while i < size(dir) var fname = dir[i] - if string.find(fname, "_autoconf.zip") > 0 # does the file contain '*_autoconf.zip' + if string.find(fname, ".autoconf") > 0 # does the file contain '*.autoconf' path.remove(fname) print(string.format("CFG: removed file '%s'", fname)) end diff --git a/lib/libesp32/Berry/default/embedded/tapp.be b/lib/libesp32/Berry/default/embedded/tapp.be new file mode 100644 index 000000000..3c3528e3a --- /dev/null +++ b/lib/libesp32/Berry/default/embedded/tapp.be @@ -0,0 +1,35 @@ +#- Tasmota apps module for Berry -# +#- -# + +var tapp_module = module("tapp") + +tapp_module.init = def (m) + + class Tapp + + def init() + tasmota.add_driver(self) + end + + def autoexec() + import path + import string + + var dir = path.listdir("/") + + for d: dir + if string.find(d, ".tapp") > 0 + print(string.format("TAP: found Tasmota App '%s'", d)) + tasmota.load(d + "#autoexec.be") + end + end + end + end + + return Tapp() # return an instance of this class +end + +# aa = autoconf_module.init(autoconf_module) +# import webserver +# webserver.on('/ac2', / -> aa.page_autoconf_mgr(), webserver.HTTP_GET) +return tapp_module diff --git a/lib/libesp32/Berry/src/be_code.c b/lib/libesp32/Berry/src/be_code.c index 6a332bb07..40e067265 100644 --- a/lib/libesp32/Berry/src/be_code.c +++ b/lib/libesp32/Berry/src/be_code.c @@ -335,12 +335,15 @@ static void free_suffix(bfuncinfo *finfo, bexpdesc *e) } } -static int suffix_destreg(bfuncinfo *finfo, bexpdesc *e1, int dst) +static int suffix_destreg(bfuncinfo *finfo, bexpdesc *e1, int dst, bbool no_reg_reuse) { int cand_dst = dst; /* candidate for new dst */ int nlocal = be_list_count(finfo->local); int reg1 = (e1->v.ss.tt == ETREG) ? e1->v.ss.obj : -1; /* check if obj is ETREG or -1 */ int reg2 = (!isK(e1->v.ss.idx) && e1->v.ss.idx >= nlocal) ? e1->v.ss.idx : -1; /* check if idx is ETREG or -1 */ + if (no_reg_reuse) { /* if no_reg_reuse flag, then don't reuse any register, this is useful for compound assignments */ + reg1 = reg2 = -1; + } if (reg1 >= 0 && reg2 >= 0) { /* both are ETREG, we keep the lowest and discard the other */ @@ -364,9 +367,9 @@ static int suffix_destreg(bfuncinfo *finfo, bexpdesc *e1, int dst) return dst; } -static int code_suffix(bfuncinfo *finfo, bopcode op, bexpdesc *e, int dst) +static int code_suffix(bfuncinfo *finfo, bopcode op, bexpdesc *e, int dst, bbool no_reg_reuse) { - dst = suffix_destreg(finfo, e, dst); + dst = suffix_destreg(finfo, e, dst, no_reg_reuse); if (dst > finfo->freereg) { dst = finfo->freereg; } @@ -400,6 +403,7 @@ static bbool constint(bfuncinfo *finfo, bint i) /* At exit, If dst is `freereg`, the register is allocated */ static int var2reg(bfuncinfo *finfo, bexpdesc *e, int dst) { + bbool no_reg_reuse = (dst >= 0); /* if dst reg is explicitly specified, do not optimize register allocation */ if (dst < 0) { /* if unspecified, allocate a new register if needed */ dst = finfo->freereg; } @@ -434,10 +438,10 @@ static int var2reg(bfuncinfo *finfo, bexpdesc *e, int dst) codeABx(finfo, OP_GETUPV, dst, e->v.idx); break; case ETMEMBER: - dst = code_suffix(finfo, OP_GETMBR, e, dst); + dst = code_suffix(finfo, OP_GETMBR, e, dst, no_reg_reuse); break; case ETINDEX: - dst = code_suffix(finfo, OP_GETIDX, e, dst); + dst = code_suffix(finfo, OP_GETIDX, e, dst, no_reg_reuse); break; case ETLOCAL: case ETREG: case ETCONST: return e->v.idx; @@ -479,6 +483,7 @@ static int exp2reg(bfuncinfo *finfo, bexpdesc *e, int dst) /* Returns the destination register, guaranteed to be ETREG */ static int codedestreg(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, int dst) { + if (dst < 0) { dst = finfo->freereg; } int cand_dst = dst; int con1 = e1->type == ETREG, con2 = e2->type == ETREG; @@ -506,7 +511,6 @@ static int codedestreg(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, int dst) /* On exit, e1 is guaranteed to be ETREG, which may have been allocated */ static void binaryexp(bfuncinfo *finfo, bopcode op, bexpdesc *e1, bexpdesc *e2, int dst) { - if (dst < 0) { dst = finfo->freereg; } int src1 = exp2reg(finfo, e1, dst); /* potentially force the target for src1 reg */ int src2 = exp2anyreg(finfo, e2); dst = codedestreg(finfo, e1, e2, dst); @@ -561,7 +565,10 @@ static void unaryexp(bfuncinfo *finfo, bopcode op, bexpdesc *e) { int src = exp2anyreg(finfo, e); int dst = e->type == ETREG ? src : be_code_allocregs(finfo, 1); - codeABC(finfo, op, dst, src, 0); + if (!(op == OP_MOVE && src == dst)) { + /* skip if MOVE from same src / dst */ + codeABC(finfo, op, dst, src, 0); + } e->type = ETREG; e->v.idx = dst; } @@ -720,7 +727,7 @@ int be_code_getmethod(bfuncinfo *finfo, bexpdesc *e) { int dst = finfo->freereg; be_assert(e->type == ETMEMBER); - dst = code_suffix(finfo, OP_GETMET, e, dst); + dst = code_suffix(finfo, OP_GETMET, e, dst, bfalse); /* method [object] args */ be_code_allocregs(finfo, dst == finfo->freereg ? 2 : 1); return dst; diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h index 4c8478ea0..d4015f984 100644 --- a/tasmota/language/bg_BG.h +++ b/tasmota/language/bg_BG.h @@ -249,7 +249,7 @@ #define D_REDIRECTED "Пренасочено към портала за настройка" #define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "Wifimanager set AccessPoint and keep Station" #define D_WIFIMANAGER_SET_ACCESSPOINT "Wifimanager set AccessPoint" -#define D_TRYING_TO_CONNECT "Извършва се опит за свързване на устройството към мрежата" +#define D_TRYING_TO_CONNECT "Oпит за свързване към избраната мрежа" #define D_RESTART_IN "Рестарт след" #define D_SECONDS "секунди" @@ -336,7 +336,7 @@ #define D_SINGLE_DEVICE "едно устройство" #define D_MULTI_DEVICE "много устройства" -#define D_CONFIGURE_TEMPLATE "Настройка на шаблона" +#define D_CONFIGURE_TEMPLATE "Настройки на шаблона" #define D_TEMPLATE_PARAMETERS "Параметри на шаблона" #define D_TEMPLATE_NAME "Име" #define D_BASE_TYPE "Основан на" @@ -364,7 +364,7 @@ #define D_ESP_CHIP_ID "ID на чипа на ESP" #define D_FLASH_CHIP_ID "ID на чипа на флаш-паметта" #define D_FLASH_CHIP_SIZE "Размер на флаш-паметта" -#define D_FREE_PROGRAM_SPACE "Свободно пространство за програми" +#define D_FREE_PROGRAM_SPACE "Свободно място за програми" #define D_UPGRADE_BY_WEBSERVER "Обновяване от сървър" #define D_OTA_URL "Адрес на сървър за OTA" @@ -376,7 +376,7 @@ #define D_UPLOAD_TRANSFER "Upload transfer" #define D_TRANSFER_STARTED "Transfer started" #define D_UPLOAD_ERR_1 "Не е избран файл" -#define D_UPLOAD_ERR_2 "Недостатъчно свободно пространство" +#define D_UPLOAD_ERR_2 "Недостатъчно свободно място" #define D_UPLOAD_ERR_3 "Недействителен подпис на файла" #define D_UPLOAD_ERR_4 "Размерът на програмата е по-голям от размера на флаш-паметта" #define D_UPLOAD_ERR_5 "Грешка при сравняване на буфери" @@ -413,11 +413,11 @@ #define D_WEMO_BASIC_EVENT "Основно събитие на WeMo" #define D_WEMO_EVENT_SERVICE "Услуга за събития на WeMo" #define D_WEMO_META_SERVICE "Мета-услуга на WeMo" -#define D_WEMO_SETUP "Настройка на WeMo" +#define D_WEMO_SETUP "Настройки на WeMo" #define D_RESPONSE_SENT "Отговорът е изпратен" #define D_HUE "Hue" -#define D_HUE_BRIDGE_SETUP "Настройка на Hue" +#define D_HUE_BRIDGE_SETUP "Настройки на Hue" #define D_HUE_API_NOT_IMPLEMENTED "ППИ на Hue не е реализиран" #define D_HUE_API "ППИ на Hue" #define D_HUE_POST_ARGS "Параметри на Hue по POST" @@ -442,18 +442,18 @@ #define D_DOMOTICZ_UPDATE_TIMER "Период на обновяване" // xdrv_09_timers.ino -#define D_CONFIGURE_TIMER "Настройка на графика" +#define D_CONFIGURE_TIMER "Настройки на график" #define D_TIMER_PARAMETERS "Параметри на графиците" #define D_TIMER_ENABLE "Използване на графици" #define D_TIMER_ARM "Включване" #define D_TIMER_TIME "Време" #define D_TIMER_DAYS "Дни" -#define D_TIMER_REPEAT "Периодичен" +#define D_TIMER_REPEAT "Повтаряне" #define D_TIMER_OUTPUT "Изход" #define D_TIMER_ACTION "Действие" // xdrv_10_knx.ino -#define D_CONFIGURE_KNX "Настройка на KNX" +#define D_CONFIGURE_KNX "Настройки на KNX" #define D_KNX_PARAMETERS "Параметри на KNX" #define D_KNX_GENERAL_CONFIG "Основни" #define D_KNX_PHYSICAL_ADDRESS "Физически адрес" @@ -513,7 +513,7 @@ #define D_DOMOTICZ_SHUTTER "Щора" // xdrv_28_pcf8574.ino -#define D_CONFIGURE_PCF8574 "Настройка на PCF8574" +#define D_CONFIGURE_PCF8574 "Настройки на PCF8574" #define D_PCF8574_PARAMETERS "Параметри на PCF8574" #define D_INVERT_PORTS "Размяна на портовете" #define D_DEVICE "Устройство" @@ -563,7 +563,7 @@ #define D_HX_CAL_DONE "Калибрирано" #define D_HX_CAL_FAIL "Грешка при калибриране" #define D_RESET_HX711 "Нулиране на везната" -#define D_CONFIGURE_HX711 "Настройка на везната" +#define D_CONFIGURE_HX711 "Настройки на везната" #define D_HX711_PARAMETERS "Параметри на везната" #define D_ITEM_WEIGHT "Тегло" #define D_REFERENCE_WEIGHT "Еталонна тежест" @@ -608,7 +608,7 @@ // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Няма" -#define D_SENSOR_USER "Потребител" +#define D_SENSOR_USER "Потребителско" #define D_SENSOR_OPTION "Настройки" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" diff --git a/tasmota/xdrv_52_7_berry_embedded.ino b/tasmota/xdrv_52_7_berry_embedded.ino index 4d16ced05..a51409406 100644 --- a/tasmota/xdrv_52_7_berry_embedded.ino +++ b/tasmota/xdrv_52_7_berry_embedded.ino @@ -48,6 +48,8 @@ const char berry_prog[] = "import autoconf " #endif // USE_AUTOCONF + "import tapp " + #ifdef USE_LVGL "import lv " // create the '_lvgl' global singleton diff --git a/tasmota/xdrv_52_9_berry.ino b/tasmota/xdrv_52_9_berry.ino index 751dec823..46cc5692f 100644 --- a/tasmota/xdrv_52_9_berry.ino +++ b/tasmota/xdrv_52_9_berry.ino @@ -793,6 +793,9 @@ bool Xdrv52(uint8_t function) // Run 'autoconf.preinit()' callBerryAutoconf("autoexec"); + // we generate a synthetic event `autoexec` + callBerryEventDispatcher(PSTR("autoexec"), nullptr, 0, nullptr); + BrLoad("autoexec.be"); // run autoexec.be at first tick, so we know all modules are initialized berry.autoexec_done = true; }