Berry fix button handlers

This commit is contained in:
Stephan Hadinger 2021-06-30 22:36:51 +02:00
parent 7b460a1158
commit 490412ebdc
10 changed files with 1701 additions and 1724 deletions

View File

@ -13,6 +13,9 @@
var web_add_handler var web_add_handler
var web_add_button var web_add_button
var web_add_main_button var web_add_main_button
var web_add_management_button
var web_add_config_button
var web_add_console_button
var save_before_restart var save_before_restart
var web_sensor var web_sensor
var json_append var json_append
@ -126,6 +129,9 @@ void be_load_driverlib(bvm *vm) {
{ "web_add_handler", NULL }, { "web_add_handler", NULL },
{ "web_add_button", NULL }, { "web_add_button", NULL },
{ "web_add_main_button", NULL }, { "web_add_main_button", NULL },
{ "web_add_management_button", NULL },
{ "web_add_config_button", NULL },
{ "web_add_console_button", NULL },
{ "save_before_restart", NULL }, { "save_before_restart", NULL },
{ "web_sensor", NULL }, { "web_sensor", NULL },
{ "json_append", NULL }, { "json_append", NULL },
@ -153,6 +159,9 @@ class be_class_tasmota_driver (scope: global, name: Driver) {
web_add_handler, var web_add_handler, var
web_add_button, var web_add_button, var
web_add_main_button, var web_add_main_button, var
web_add_management_button, var
web_add_config_button, var
web_add_console_button, var
save_before_restart, var save_before_restart, var
web_sensor, var web_sensor, var
json_append, var json_append, var

View File

@ -1458,205 +1458,205 @@ be_local_closure(gc, /* name */
/******************************************************************** /********************************************************************
** Solidified function: event ** Solidified function: event
********************************************************************/ ********************************************************************/
be_local_closure(event, /* name */
/********** Solidified proto: event */ be_nested_proto(
be_define_local_const_str(event_str_name, "event", -30355297, 5); 16, /* nstack */
be_define_local_const_str(event_str_source, "input", -103256197, 5); 5, /* argc */
be_define_local_const_str(event_str_0, "cmd", -158181397, 3); 0, /* has upvals */
be_define_local_const_str(event_str_1, "exec_cmd", 493567399, 8); NULL, /* no upvals */
be_define_local_const_str(event_str_2, "rule", -64077613, 4); 0, /* has sup protos */
be_define_local_const_str(event_str_3, "exec_rules", 1445221092, 10); NULL, /* no sub protos */
be_define_local_const_str(event_str_4, "mqtt_data", -1756753932, 9); 1, /* has constants */
be_define_local_const_str(event_str_5, "gc", 1042313471, 2); ( &(const bvalue[29]) { /* upvals */
be_define_local_const_str(event_str_6, "every_50ms", -1911083288, 10); { { .s=be_nested_const_str("cmd", -158181397, 3) }, BE_STRING},
be_define_local_const_str(event_str_7, "run_deferred", 371594696, 12); { { .s=be_nested_const_str("exec_cmd", 493567399, 8) }, BE_STRING},
be_define_local_const_str(event_str_8, "_drivers", -1034638311, 8); { { .s=be_nested_const_str("rule", -64077613, 4) }, BE_STRING},
be_define_local_const_str(event_str_9, "every_second", 2075451465, 12); { { .s=be_nested_const_str("exec_rules", 1445221092, 10) }, BE_STRING},
be_define_local_const_str(event_str_10, "every_100ms", 1546407804, 11); { { .s=be_nested_const_str("mqtt_data", -1756753932, 9) }, BE_STRING},
be_define_local_const_str(event_str_11, "web_add_button", -757092238, 14); { { .s=be_nested_const_str("gc", 1042313471, 2) }, BE_STRING},
be_define_local_const_str(event_str_12, "web_add_main_button", -334599632, 19); { { .s=be_nested_const_str("every_50ms", -1911083288, 10) }, BE_STRING},
be_define_local_const_str(event_str_13, "save_before_restart", 1253239338, 19); { { .s=be_nested_const_str("run_deferred", 371594696, 12) }, BE_STRING},
be_define_local_const_str(event_str_14, "web_add_handler", -304792334, 15); { { .s=be_nested_const_str("_drivers", -1034638311, 8) }, BE_STRING},
be_define_local_const_str(event_str_15, "web_sensor", -1394870324, 10); { { .s=be_nested_const_str("every_second", 2075451465, 12) }, BE_STRING},
be_define_local_const_str(event_str_16, "json_append", -1292948012, 11); { { .s=be_nested_const_str("every_100ms", 1546407804, 11) }, BE_STRING},
be_define_local_const_str(event_str_17, "button_pressed", 1694209616, 14); { { .s=be_nested_const_str("web_add_button", -757092238, 14) }, BE_STRING},
be_define_local_const_str(event_str_18, "display", 1164572437, 7); { { .s=be_nested_const_str("web_add_main_button", -334599632, 19) }, BE_STRING},
be_define_local_const_str(event_str_19, "string", 398550328, 6); { { .s=be_nested_const_str("web_add_management_button", -1556090110, 25) }, BE_STRING},
be_define_local_const_str(event_str_20, "log", 1062293841, 3); { { .s=be_nested_const_str("web_add_config_button", 639674325, 21) }, BE_STRING},
be_define_local_const_str(event_str_21, "format", -1180859054, 6); { { .s=be_nested_const_str("web_add_console_button", -813531104, 22) }, BE_STRING},
be_define_local_const_str(event_str_22, "BRY: exception %s - %m", -1290966132, 22); { { .s=be_nested_const_str("save_before_restart", 1253239338, 19) }, BE_STRING},
be_define_local_const_str(event_str_24, "stop_iteration", -121173395, 14); { { .s=be_nested_const_str("web_add_handler", -304792334, 15) }, BE_STRING},
{ { .s=be_nested_const_str("web_sensor", -1394870324, 10) }, BE_STRING},
static const bvalue event_ktab[25] = { { { .s=be_nested_const_str("json_append", -1292948012, 11) }, BE_STRING},
{ { .s=be_local_const_str(event_str_0) }, BE_STRING}, { { .s=be_nested_const_str("button_pressed", 1694209616, 14) }, BE_STRING},
{ { .s=be_local_const_str(event_str_1) }, BE_STRING}, { { .s=be_nested_const_str("button_preselif", 491115394, 15) }, BE_STRING},
{ { .s=be_local_const_str(event_str_2) }, BE_STRING}, { { .s=be_nested_const_str("display", 1164572437, 7) }, BE_STRING},
{ { .s=be_local_const_str(event_str_3) }, BE_STRING}, { { .s=be_nested_const_str("string", 398550328, 6) }, BE_STRING},
{ { .s=be_local_const_str(event_str_4) }, BE_STRING}, { { .s=be_nested_const_str("log", 1062293841, 3) }, BE_STRING},
{ { .s=be_local_const_str(event_str_5) }, BE_STRING}, { { .s=be_nested_const_str("format", -1180859054, 6) }, BE_STRING},
{ { .s=be_local_const_str(event_str_6) }, BE_STRING}, { { .s=be_nested_const_str("BRY: exception %s - %m", -1290966132, 22) }, BE_STRING},
{ { .s=be_local_const_str(event_str_7) }, BE_STRING}, { { .i=3 }, BE_INT},
{ { .s=be_local_const_str(event_str_8) }, BE_STRING}, { { .s=be_nested_const_str("stop_iteration", -121173395, 14) }, BE_STRING},
{ { .s=be_local_const_str(event_str_9) }, BE_STRING}, }),
{ { .s=be_local_const_str(event_str_10) }, BE_STRING}, (be_nested_const_str("event", -30355297, 5)),
{ { .s=be_local_const_str(event_str_11) }, BE_STRING}, (be_nested_const_str("input", -103256197, 5)),
{ { .s=be_local_const_str(event_str_12) }, BE_STRING}, ( &(const binstruction[153]) { /* code */
{ { .s=be_local_const_str(event_str_13) }, BE_STRING}, 0x1C140300, // 0000 EQ R5 R1 R256
{ { .s=be_local_const_str(event_str_14) }, BE_STRING}, 0x78160006, // 0001 JMPF R5 #0009
{ { .s=be_local_const_str(event_str_15) }, BE_STRING}, 0x8C140101, // 0002 GETMET R5 R0 R257
{ { .s=be_local_const_str(event_str_16) }, BE_STRING}, 0x5C1C0400, // 0003 MOVE R7 R2
{ { .s=be_local_const_str(event_str_17) }, BE_STRING}, 0x5C200600, // 0004 MOVE R8 R3
{ { .s=be_local_const_str(event_str_18) }, BE_STRING}, 0x5C240800, // 0005 MOVE R9 R4
{ { .s=be_local_const_str(event_str_19) }, BE_STRING}, 0x7C140800, // 0006 CALL R5 4
{ { .s=be_local_const_str(event_str_20) }, BE_STRING}, 0x80040A00, // 0007 RET 1 R5
{ { .s=be_local_const_str(event_str_21) }, BE_STRING}, 0x7002008E, // 0008 JMP #0098
{ { .s=be_local_const_str(event_str_22) }, BE_STRING}, 0x1C140302, // 0009 EQ R5 R1 R258
{ { .i=3 }, BE_INT}, 0x78160004, // 000A JMPF R5 #0010
{ { .s=be_local_const_str(event_str_24) }, BE_STRING}, 0x8C140103, // 000B GETMET R5 R0 R259
}; 0x5C1C0800, // 000C MOVE R7 R4
0x7C140400, // 000D CALL R5 2
static const uint32_t event_code[136] = { 0x80040A00, // 000E RET 1 R5
0x1C140300, // 0000 EQ R5 R1 R256 0x70020087, // 000F JMP #0098
0x78160006, // 0001 JMPF R5 #0009 0x1C140304, // 0010 EQ R5 R1 R260
0x8C140101, // 0002 GETMET R5 R0 R257 0x78160002, // 0011 JMPF R5 #0015
0x5C1C0400, // 0003 MOVE R7 R2 0x4C140000, // 0012 LDNIL 5
0x5C200600, // 0004 MOVE R8 R3 0x80040A00, // 0013 RET 1 R5
0x5C240800, // 0005 MOVE R9 R4 0x70020082, // 0014 JMP #0098
0x7C140800, // 0006 CALL R5 4 0x1C140305, // 0015 EQ R5 R1 R261
0x80040A00, // 0007 RET 1 R5 0x78160003, // 0016 JMPF R5 #001B
0x7002007D, // 0008 JMP #0087 0x8C140105, // 0017 GETMET R5 R0 R261
0x1C140302, // 0009 EQ R5 R1 R258 0x7C140200, // 0018 CALL R5 1
0x78160004, // 000A JMPF R5 #0010 0x80040A00, // 0019 RET 1 R5
0x8C140103, // 000B GETMET R5 R0 R259 0x7002007C, // 001A JMP #0098
0x5C1C0800, // 000C MOVE R7 R4 0x1C140306, // 001B EQ R5 R1 R262
0x7C140400, // 000D CALL R5 2 0x78160003, // 001C JMPF R5 #0021
0x80040A00, // 000E RET 1 R5 0x8C140107, // 001D GETMET R5 R0 R263
0x70020076, // 000F JMP #0087 0x7C140200, // 001E CALL R5 1
0x1C140304, // 0010 EQ R5 R1 R260 0x80040A00, // 001F RET 1 R5
0x78160002, // 0011 JMPF R5 #0015 0x70020076, // 0020 JMP #0098
0x4C140000, // 0012 LDNIL 5 0x88140108, // 0021 GETMBR R5 R0 R264
0x80040A00, // 0013 RET 1 R5 0x78160074, // 0022 JMPF R5 #0098
0x70020071, // 0014 JMP #0087 0x60140000, // 0023 GETGBL R5 G0
0x1C140305, // 0015 EQ R5 R1 R261 0x88180108, // 0024 GETMBR R6 R0 R264
0x78160003, // 0016 JMPF R5 #001B 0x7C140200, // 0025 CALL R5 1
0x8C140105, // 0017 GETMET R5 R0 R261 0xA802006D, // 0026 EXBLK 0 #0095
0x7C140200, // 0018 CALL R5 1 0x5C180A00, // 0027 MOVE R6 R5
0x80040A00, // 0019 RET 1 R5 0x7C180000, // 0028 CALL R6 0
0x7002006B, // 001A JMP #0087 0xA802005E, // 0029 EXBLK 0 #0089
0x1C140306, // 001B EQ R5 R1 R262 0x1C1C0309, // 002A EQ R7 R1 R265
0x78160003, // 001C JMPF R5 #0021 0x781E0004, // 002B JMPF R7 #0031
0x8C140107, // 001D GETMET R5 R0 R263 0x881C0D09, // 002C GETMBR R7 R6 R265
0x7C140200, // 001E CALL R5 1 0x781E0002, // 002D JMPF R7 #0031
0x80040A00, // 001F RET 1 R5 0x8C1C0D09, // 002E GETMET R7 R6 R265
0x70020065, // 0020 JMP #0087 0x7C1C0200, // 002F CALL R7 1
0x88140108, // 0021 GETMBR R5 R0 R264 0x70020055, // 0030 JMP #0087
0x78160063, // 0022 JMPF R5 #0087 0x1C1C030A, // 0031 EQ R7 R1 R266
0x60140000, // 0023 GETGBL R5 G0 0x781E0004, // 0032 JMPF R7 #0038
0x88180108, // 0024 GETMBR R6 R0 R264 0x881C0D0A, // 0033 GETMBR R7 R6 R266
0x7C140200, // 0025 CALL R5 1 0x781E0002, // 0034 JMPF R7 #0038
0xA802005C, // 0026 EXBLK 0 #0084 0x8C1C0D0A, // 0035 GETMET R7 R6 R266
0x5C180A00, // 0027 MOVE R6 R5 0x7C1C0200, // 0036 CALL R7 1
0x7C180000, // 0028 CALL R6 0 0x7002004E, // 0037 JMP #0087
0xA802004D, // 0029 EXBLK 0 #0078 0x1C1C030B, // 0038 EQ R7 R1 R267
0x1C1C0309, // 002A EQ R7 R1 R265 0x781E0004, // 0039 JMPF R7 #003F
0x781E0004, // 002B JMPF R7 #0031 0x881C0D0B, // 003A GETMBR R7 R6 R267
0x881C0D09, // 002C GETMBR R7 R6 R265 0x781E0002, // 003B JMPF R7 #003F
0x781E0002, // 002D JMPF R7 #0031 0x8C1C0D0B, // 003C GETMET R7 R6 R267
0x8C1C0D09, // 002E GETMET R7 R6 R265 0x7C1C0200, // 003D CALL R7 1
0x7C1C0200, // 002F CALL R7 1 0x70020047, // 003E JMP #0087
0x70020044, // 0030 JMP #0076 0x1C1C030C, // 003F EQ R7 R1 R268
0x1C1C030A, // 0031 EQ R7 R1 R266 0x781E0004, // 0040 JMPF R7 #0046
0x781E0004, // 0032 JMPF R7 #0038 0x881C0D0C, // 0041 GETMBR R7 R6 R268
0x881C0D0A, // 0033 GETMBR R7 R6 R266 0x781E0002, // 0042 JMPF R7 #0046
0x781E0002, // 0034 JMPF R7 #0038 0x8C1C0D0C, // 0043 GETMET R7 R6 R268
0x8C1C0D0A, // 0035 GETMET R7 R6 R266 0x7C1C0200, // 0044 CALL R7 1
0x7C1C0200, // 0036 CALL R7 1 0x70020040, // 0045 JMP #0087
0x7002003D, // 0037 JMP #0076 0x1C1C030D, // 0046 EQ R7 R1 R269
0x1C1C030B, // 0038 EQ R7 R1 R267 0x781E0004, // 0047 JMPF R7 #004D
0x781E0004, // 0039 JMPF R7 #003F 0x881C0D0D, // 0048 GETMBR R7 R6 R269
0x881C0D0B, // 003A GETMBR R7 R6 R267 0x781E0002, // 0049 JMPF R7 #004D
0x781E0002, // 003B JMPF R7 #003F 0x8C1C0D0D, // 004A GETMET R7 R6 R269
0x8C1C0D0B, // 003C GETMET R7 R6 R267 0x7C1C0200, // 004B CALL R7 1
0x7C1C0200, // 003D CALL R7 1 0x70020039, // 004C JMP #0087
0x70020036, // 003E JMP #0076 0x1C1C030E, // 004D EQ R7 R1 R270
0x1C1C030C, // 003F EQ R7 R1 R268 0x781E0004, // 004E JMPF R7 #0054
0x781E0004, // 0040 JMPF R7 #0046 0x881C0D0E, // 004F GETMBR R7 R6 R270
0x881C0D0C, // 0041 GETMBR R7 R6 R268 0x781E0002, // 0050 JMPF R7 #0054
0x781E0002, // 0042 JMPF R7 #0046 0x8C1C0D0E, // 0051 GETMET R7 R6 R270
0x8C1C0D0C, // 0043 GETMET R7 R6 R268 0x7C1C0200, // 0052 CALL R7 1
0x7C1C0200, // 0044 CALL R7 1 0x70020032, // 0053 JMP #0087
0x7002002F, // 0045 JMP #0076 0x1C1C030F, // 0054 EQ R7 R1 R271
0x1C1C030D, // 0046 EQ R7 R1 R269 0x781E0004, // 0055 JMPF R7 #005B
0x781E0004, // 0047 JMPF R7 #004D 0x881C0D0F, // 0056 GETMBR R7 R6 R271
0x881C0D0D, // 0048 GETMBR R7 R6 R269 0x781E0002, // 0057 JMPF R7 #005B
0x781E0002, // 0049 JMPF R7 #004D 0x8C1C0D0F, // 0058 GETMET R7 R6 R271
0x8C1C0D0D, // 004A GETMET R7 R6 R269 0x7C1C0200, // 0059 CALL R7 1
0x7C1C0200, // 004B CALL R7 1 0x7002002B, // 005A JMP #0087
0x70020028, // 004C JMP #0076 0x1C1C0310, // 005B EQ R7 R1 R272
0x1C1C030E, // 004D EQ R7 R1 R270 0x781E0004, // 005C JMPF R7 #0062
0x781E0004, // 004E JMPF R7 #0054 0x881C0D10, // 005D GETMBR R7 R6 R272
0x881C0D0E, // 004F GETMBR R7 R6 R270 0x781E0002, // 005E JMPF R7 #0062
0x781E0002, // 0050 JMPF R7 #0054 0x8C1C0D10, // 005F GETMET R7 R6 R272
0x8C1C0D0E, // 0051 GETMET R7 R6 R270 0x7C1C0200, // 0060 CALL R7 1
0x7C1C0200, // 0052 CALL R7 1 0x70020024, // 0061 JMP #0087
0x70020021, // 0053 JMP #0076 0x1C1C0311, // 0062 EQ R7 R1 R273
0x1C1C030F, // 0054 EQ R7 R1 R271 0x781E0004, // 0063 JMPF R7 #0069
0x781E0004, // 0055 JMPF R7 #005B 0x881C0D11, // 0064 GETMBR R7 R6 R273
0x881C0D0F, // 0056 GETMBR R7 R6 R271 0x781E0002, // 0065 JMPF R7 #0069
0x781E0002, // 0057 JMPF R7 #005B 0x8C1C0D11, // 0066 GETMET R7 R6 R273
0x8C1C0D0F, // 0058 GETMET R7 R6 R271 0x7C1C0200, // 0067 CALL R7 1
0x7C1C0200, // 0059 CALL R7 1 0x7002001D, // 0068 JMP #0087
0x7002001A, // 005A JMP #0076 0x1C1C0312, // 0069 EQ R7 R1 R274
0x1C1C0310, // 005B EQ R7 R1 R272 0x781E0004, // 006A JMPF R7 #0070
0x781E0004, // 005C JMPF R7 #0062 0x881C0D12, // 006B GETMBR R7 R6 R274
0x881C0D10, // 005D GETMBR R7 R6 R272 0x781E0002, // 006C JMPF R7 #0070
0x781E0002, // 005E JMPF R7 #0062 0x8C1C0D12, // 006D GETMET R7 R6 R274
0x8C1C0D10, // 005F GETMET R7 R6 R272 0x7C1C0200, // 006E CALL R7 1
0x7C1C0200, // 0060 CALL R7 1 0x70020016, // 006F JMP #0087
0x70020013, // 0061 JMP #0076 0x1C1C0313, // 0070 EQ R7 R1 R275
0x1C1C0311, // 0062 EQ R7 R1 R273 0x781E0004, // 0071 JMPF R7 #0077
0x781E0004, // 0063 JMPF R7 #0069 0x881C0D13, // 0072 GETMBR R7 R6 R275
0x881C0D11, // 0064 GETMBR R7 R6 R273 0x781E0002, // 0073 JMPF R7 #0077
0x781E0002, // 0065 JMPF R7 #0069 0x8C1C0D13, // 0074 GETMET R7 R6 R275
0x8C1C0D11, // 0066 GETMET R7 R6 R273 0x7C1C0200, // 0075 CALL R7 1
0x7C1C0200, // 0067 CALL R7 1 0x7002000F, // 0076 JMP #0087
0x7002000C, // 0068 JMP #0076 0x1C1C0314, // 0077 EQ R7 R1 R276
0x1C1C030E, // 0069 EQ R7 R1 R270 0x781E0007, // 0078 JMPF R7 #0081
0x781E0004, // 006A JMPF R7 #0070 0x881C0D14, // 0079 GETMBR R7 R6 R276
0x881C0D12, // 006B GETMBR R7 R6 R274 0x781E0005, // 007A JMPF R7 #0081
0x781E0002, // 006C JMPF R7 #0070 0x1C1C0311, // 007B EQ R7 R1 R273
0x8C1C0D12, // 006D GETMET R7 R6 R274 0x781DFFFE, // 007C JMPF R7 #007C
0x7C1C0200, // 006E CALL R7 1 0x881C0D16, // 007D GETMBR R7 R6 R278
0x70020005, // 006F JMP #0076 0x8C1C0D16, // 007E GETMET R7 R6 R278
0x1C1C0312, // 0070 EQ R7 R1 R274 0x7C1C0200, // 007F CALL R7 1
0x781E0003, // 0071 JMPF R7 #0076 0x70020005, // 0080 JMP #0087
0x881C0D12, // 0072 GETMBR R7 R6 R274 0x1C1C0316, // 0081 EQ R7 R1 R278
0x781E0001, // 0073 JMPF R7 #0076 0x781E0003, // 0082 JMPF R7 #0087
0x8C1C0D12, // 0074 GETMET R7 R6 R274 0x881C0D16, // 0083 GETMBR R7 R6 R278
0x7C1C0200, // 0075 CALL R7 1 0x781E0001, // 0084 JMPF R7 #0087
0xA8040001, // 0076 EXBLK 1 1 0x8C1C0D16, // 0085 GETMET R7 R6 R278
0x7002000A, // 0077 JMP #0083 0x7C1C0200, // 0086 CALL R7 1
0xAC1C0002, // 0078 CATCH R7 0 2 0xA8040001, // 0087 EXBLK 1 1
0x70020007, // 0079 JMP #0082 0x7002000A, // 0088 JMP #0094
0xA4262600, // 007A IMPORT R9 R275 0xAC1C0002, // 0089 CATCH R7 0 2
0x8C280114, // 007B GETMET R10 R0 R276 0x70020007, // 008A JMP #0093
0x8C301315, // 007C GETMET R12 R9 R277 0xA4262E00, // 008B IMPORT R9 R279
0x58380016, // 007D LDCONST R14 K22 0x8C280118, // 008C GETMET R10 R0 R280
0x583C0017, // 007E LDCONST R15 K23 0x8C301319, // 008D GETMET R12 R9 R281
0x7C300600, // 007F CALL R12 3 0x5838001A, // 008E LDCONST R14 K26
0x7C280400, // 0080 CALL R10 2 0x583C001B, // 008F LDCONST R15 K27
0x70020000, // 0081 JMP #0083 0x7C300600, // 0090 CALL R12 3
0xB0080000, // 0082 RAISE 2 R0 R0 0x7C280400, // 0091 CALL R10 2
0x7001FFA2, // 0083 JMP #0027 0x70020000, // 0092 JMP #0094
0x58140018, // 0084 LDCONST R5 K24 0xB0080000, // 0093 RAISE 2 R0 R0
0xAC140200, // 0085 CATCH R5 1 0 0x7001FF91, // 0094 JMP #0027
0xB0080000, // 0086 RAISE 2 R0 R0 0x5814001C, // 0095 LDCONST R5 K28
0x80000000, // 0087 RET 0 R0 0xAC140200, // 0096 CATCH R5 1 0
}; 0xB0080000, // 0097 RAISE 2 R0 R0
0x80000000, // 0098 RET 0 R0
be_define_local_proto(event, 16, 5, 1, 0, 0); })
be_define_local_closure(event); )
);
/*******************************************************************/ /*******************************************************************/
/******************************************************************** /********************************************************************

View File

@ -47,17 +47,20 @@ class Tasmota2 : Tasmota
elif self._drivers elif self._drivers
for d:self._drivers for d:self._drivers
try try
if type=='every_second' && d.every_second d.every_second() if type=='every_second' && d.every_second d.every_second()
elif type=='every_100ms' && d.every_100ms d.every_100ms() elif type=='every_100ms' && d.every_100ms d.every_100ms()
elif type=='web_add_button' && d.web_add_button d.web_add_button() elif type=='web_add_button' && d.web_add_button d.web_add_button()
elif type=='web_add_main_button' && d.web_add_main_button d.web_add_main_button() elif type=='web_add_main_button' && d.web_add_main_button d.web_add_main_button()
elif type=='save_before_restart' && d.save_before_restart d.save_before_restart() elif type=='web_add_management_button' && d.web_add_management_button d.web_add_management_button()
elif type=='web_add_handler' && d.web_add_handler d.web_add_handler() elif type=='web_add_config_button' && d.web_add_config_button d.web_add_config_button()
elif type=='web_sensor' && d.web_sensor d.web_sensor() elif type=='web_add_console_button' && d.web_add_console_button d.web_add_console_button()
elif type=='json_append' && d.json_append d.json_append() elif type=='save_before_restart' && d.save_before_restart d.save_before_restart()
elif type=='button_pressed' && d.button_pressed d.button_pressed() elif type=='web_add_handler' && d.web_add_handler d.web_add_handler()
elif type=='web_add_handler' && d.display d.display() elif type=='web_sensor' && d.web_sensor d.web_sensor()
elif type=='display' && d.display d.display() elif type=='json_append' && d.json_append d.json_append()
elif type=='button_pressed' && d.button_pressed d.button_pressed()
elif type=='web_add_handler' && d.display d.display()
elif type=='display' && d.display d.display()
end end
except .. as e,m except .. as e,m
import string import string

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,31 @@
#include "be_constobj.h" #include "be_constobj.h"
static be_define_const_map_slots(be_class_tasmota_driver_map) { static be_define_const_map_slots(be_class_tasmota_driver_map) {
{ be_const_key(every_100ms, -1), be_const_int(0) }, { be_const_key(every_second, 1), be_const_int(0) },
{ be_const_key(display, -1), be_const_int(1) }, { be_const_key(web_add_config_button, -1), be_const_int(1) },
{ be_const_key(web_add_handler, -1), be_const_int(2) }, { be_const_key(web_sensor, 5), be_const_int(2) },
{ be_const_key(save_before_restart, -1), be_const_int(3) }, { be_const_key(web_add_button, 10), be_const_int(3) },
{ be_const_key(web_add_main_button, 10), be_const_int(4) },
{ be_const_key(json_append, -1), be_const_int(5) },
{ be_const_key(web_add_button, 3), be_const_int(6) },
{ be_const_key(add_cmd, -1), be_const_closure(add_cmd_closure) }, { be_const_key(add_cmd, -1), be_const_closure(add_cmd_closure) },
{ be_const_key(button_pressed, 4), be_const_int(7) }, { be_const_key(web_add_console_button, 12), be_const_int(4) },
{ be_const_key(every_second, -1), be_const_int(8) }, { be_const_key(web_add_management_button, -1), be_const_int(5) },
{ be_const_key(web_sensor, 5), be_const_int(9) }, { be_const_key(display, -1), be_const_int(6) },
{ be_const_key(get_tasmota, -1), be_const_closure(get_tasmota_closure) }, { be_const_key(get_tasmota, 13), be_const_closure(get_tasmota_closure) },
{ be_const_key(every_100ms, -1), be_const_int(7) },
{ be_const_key(save_before_restart, -1), be_const_int(8) },
{ be_const_key(button_pressed, -1), be_const_int(9) },
{ be_const_key(web_add_handler, -1), be_const_int(10) },
{ be_const_key(web_add_main_button, -1), be_const_int(11) },
{ be_const_key(json_append, 8), be_const_int(12) },
}; };
static be_define_const_map( static be_define_const_map(
be_class_tasmota_driver_map, be_class_tasmota_driver_map,
12 15
); );
BE_EXPORT_VARIABLE be_define_const_class( BE_EXPORT_VARIABLE be_define_const_class(
be_class_tasmota_driver, be_class_tasmota_driver,
10, 13,
NULL, NULL,
Driver Driver
); );

View File

@ -1,25 +0,0 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_tasmota_driver_map) {
{ be_const_key(get_tasmota, -1), be_const_func(d_getTasmotaGlob) },
{ be_const_key(web_sensor, -1), be_const_int(0) },
{ be_const_key(json_append, 0), be_const_int(1) },
{ be_const_key(every_second, 4), be_const_int(2) },
{ be_const_key(every_100ms, 7), be_const_int(3) },
{ be_const_key(web_add_main_button, -1), be_const_int(4) },
{ be_const_key(web_add_button, -1), be_const_int(5) },
{ be_const_key(save_before_restart, -1), be_const_int(6) },
{ be_const_key(button_pressed, 1), be_const_int(7) },
};
static be_define_const_map(
be_tasmota_driver_map,
9
);
BE_EXPORT_VARIABLE be_define_const_class(
be_tasmota_driver,
8,
NULL,
Driver
);

View File

@ -1,2 +0,0 @@
#include "be_constobj.h"

View File

@ -1,25 +0,0 @@
#include "be_constobj.h"
static be_define_const_map_slots(tasmota_driver_map) {
{ be_const_key(get_tasmota, -1), be_const_func(d_getTasmotaGlob) },
{ be_const_key(web_sensor, -1), be_const_int(0) },
{ be_const_key(json_append, 0), be_const_int(1) },
{ be_const_key(every_second, 4), be_const_int(2) },
{ be_const_key(every_100ms, 7), be_const_int(3) },
{ be_const_key(web_add_main_button, -1), be_const_int(4) },
{ be_const_key(web_add_button, -1), be_const_int(5) },
{ be_const_key(save_before_restart, -1), be_const_int(6) },
{ be_const_key(button_pressed, 1), be_const_int(7) },
};
static be_define_const_map(
tasmota_driver_map,
9
);
BE_EXPORT_VARIABLE be_define_const_class(
tasmota_driver,
8,
NULL,
Driver
);

View File

@ -751,11 +751,18 @@ bool Xdrv52(uint8_t function)
} else { } else {
WSContentSend_P(HTTP_BTN_BERRY_CONSOLE); WSContentSend_P(HTTP_BTN_BERRY_CONSOLE);
callBerryEventDispatcher(PSTR("web_add_button"), nullptr, 0, nullptr); callBerryEventDispatcher(PSTR("web_add_button"), nullptr, 0, nullptr);
callBerryEventDispatcher(PSTR("web_add_console_button"), nullptr, 0, nullptr);
} }
break; break;
case FUNC_WEB_ADD_MAIN_BUTTON: case FUNC_WEB_ADD_MAIN_BUTTON:
callBerryEventDispatcher(PSTR("web_add_main_button"), nullptr, 0, nullptr); callBerryEventDispatcher(PSTR("web_add_main_button"), nullptr, 0, nullptr);
break; break;
case FUNC_WEB_ADD_MANAGEMENT_BUTTON:
callBerryEventDispatcher(PSTR("web_add_management_button"), nullptr, 0, nullptr);
break;
case FUNC_WEB_ADD_BUTTON:
callBerryEventDispatcher(PSTR("web_add_config_button"), nullptr, 0, nullptr);
break;
case FUNC_WEB_ADD_HANDLER: case FUNC_WEB_ADD_HANDLER:
callBerryEventDispatcher(PSTR("web_add_handler"), nullptr, 0, nullptr); callBerryEventDispatcher(PSTR("web_add_handler"), nullptr, 0, nullptr);
WebServer_on(PSTR("/bc"), HandleBerryConsole); WebServer_on(PSTR("/bc"), HandleBerryConsole);