Merge pull request #13095 from s-hadinger/lvgl_wifi_widgets

Improved wifi widgets
This commit is contained in:
s-hadinger 2021-09-08 20:04:59 +02:00 committed by GitHub
commit 16e8e35e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 2878 additions and 1860 deletions

View File

@ -0,0 +1,439 @@
/********************************************************************
* Tasmota LVGL lv_signal_bars widget
*******************************************************************/
#include "be_constobj.h"
#ifdef USE_LVGL
#include "lvgl.h"
/********************************************************************
** Solidified function: my_design_cb
********************************************************************/
be_local_closure(my_design_cb, /* name */
be_nested_proto(
26, /* nstack */
3, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
1, /* has sup protos */
( &(const struct bproto*[ 1]) {
be_nested_proto(
2, /* 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_int(1),
}),
(be_nested_const_str("atleast1", 1956331672, 8)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 6]) { /* code */
0x28040100, // 0000 GE R1 R0 K0
0x78060001, // 0001 JMPF R1 #0004
0x80040000, // 0002 RET 1 R0
0x70020000, // 0003 JMP #0005
0x80060000, // 0004 RET 1 K0
0x80000000, // 0005 RET 0
})
),
}),
1, /* has constants */
( &(const bvalue[35]) { /* constants */
/* K0 */ be_nested_string("math", -293037681, 4),
/* K1 */ be_nested_string("get_height", -723211773, 10),
/* K2 */ be_nested_string("get_width", -1001549996, 9),
/* K3 */ be_const_int(2),
/* K4 */ be_const_int(3),
/* K5 */ be_nested_string("lv", 1529997255, 2),
/* K6 */ be_nested_string("DESIGN_COVER_CHK", -1298406708, 16),
/* K7 */ be_nested_string("ancestor_design", 421545719, 15),
/* K8 */ be_nested_string("call", -1276017495, 4),
/* K9 */ be_nested_string("DESIGN_DRAW_MAIN", -904475754, 16),
/* K10 */ be_nested_string("get_coords", 1044089006, 10),
/* K11 */ be_nested_string("area", -1693507260, 4),
/* K12 */ be_nested_string("x1", 274927234, 2),
/* K13 */ be_nested_string("y1", -1939865569, 2),
/* K14 */ be_nested_string("draw_line_dsc_init", -428273650, 18),
/* K15 */ be_nested_string("line_dsc", -200476318, 8),
/* K16 */ be_nested_string("init_draw_line_dsc", -1787031256, 18),
/* K17 */ be_nested_string("OBJ_PART_MAIN", 658062838, 13),
/* K18 */ be_nested_string("round_start", -1345482912, 11),
/* K19 */ be_const_int(1),
/* K20 */ be_nested_string("round_end", 985288225, 9),
/* K21 */ be_nested_string("width", -1786286561, 5),
/* K22 */ be_nested_string("get_style_line_color", 805371932, 20),
/* K23 */ be_nested_string("STATE_DEFAULT", 712406428, 13),
/* K24 */ be_nested_string("get_style_bg_color", 964794381, 18),
/* K25 */ be_nested_string("deg", -967213025, 3),
/* K26 */ be_nested_string("acos", 1006755615, 4),
/* K27 */ be_nested_string("p1", -1605446022, 2),
/* K28 */ be_nested_string("x", -49524601, 1),
/* K29 */ be_nested_string("y", -66302220, 1),
/* K30 */ be_nested_string("color", 1031692888, 5),
/* K31 */ be_nested_string("percentage", -1756136011, 10),
/* K32 */ be_nested_string("draw_arc", 1828251676, 8),
/* K33 */ be_const_int(0),
/* K34 */ be_nested_string("DESIGN_RES_OK", -1265307123, 13),
}),
(be_nested_const_str("my_design_cb", -1173588798, 12)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[179]) { /* code */
0xA40E0000, // 0000 IMPORT R3 K0
0x84100000, // 0001 CLOSURE R4 P0
0x8C140101, // 0002 GETMET R5 R0 K1
0x7C140200, // 0003 CALL R5 1
0x8C180102, // 0004 GETMET R6 R0 K2
0x7C180200, // 0005 CALL R6 1
0x5C1C0800, // 0006 MOVE R7 R4
0x54220007, // 0007 LDINT R8 8
0x0C200A08, // 0008 DIV R8 R5 R8
0x7C1C0200, // 0009 CALL R7 1
0x5C200800, // 000A MOVE R8 R4
0x08240F03, // 000B MUL R9 R7 K3
0x04240A09, // 000C SUB R9 R5 R9
0x0C241304, // 000D DIV R9 R9 K4
0x7C200200, // 000E CALL R8 1
0x0C241103, // 000F DIV R9 R8 K3
0xB82A0A00, // 0010 GETNGBL R10 K5
0x88281506, // 0011 GETMBR R10 R10 K6
0x1C28040A, // 0012 EQ R10 R2 R10
0x782A0007, // 0013 JMPF R10 #001C
0x88280107, // 0014 GETMBR R10 R0 K7
0x8C281508, // 0015 GETMET R10 R10 K8
0x5C300000, // 0016 MOVE R12 R0
0x5C340200, // 0017 MOVE R13 R1
0x5C380400, // 0018 MOVE R14 R2
0x7C280800, // 0019 CALL R10 4
0x80041400, // 001A RET 1 R10
0x70020093, // 001B JMP #00B0
0xB82A0A00, // 001C GETNGBL R10 K5
0x88281509, // 001D GETMBR R10 R10 K9
0x1C28040A, // 001E EQ R10 R2 R10
0x782A008F, // 001F JMPF R10 #00B0
0x8C28010A, // 0020 GETMET R10 R0 K10
0x8830010B, // 0021 GETMBR R12 R0 K11
0x7C280400, // 0022 CALL R10 2
0x8828010B, // 0023 GETMBR R10 R0 K11
0x8828150C, // 0024 GETMBR R10 R10 K12
0x882C010B, // 0025 GETMBR R11 R0 K11
0x882C170D, // 0026 GETMBR R11 R11 K13
0xB8320A00, // 0027 GETNGBL R12 K5
0x8C30190E, // 0028 GETMET R12 R12 K14
0x8838010F, // 0029 GETMBR R14 R0 K15
0x7C300400, // 002A CALL R12 2
0x8C300110, // 002B GETMET R12 R0 K16
0xB83A0A00, // 002C GETNGBL R14 K5
0x88381D11, // 002D GETMBR R14 R14 K17
0x883C010F, // 002E GETMBR R15 R0 K15
0x7C300600, // 002F CALL R12 3
0x8830010F, // 0030 GETMBR R12 R0 K15
0x90322513, // 0031 SETMBR R12 K18 K19
0x8830010F, // 0032 GETMBR R12 R0 K15
0x90322913, // 0033 SETMBR R12 K20 K19
0x8830010F, // 0034 GETMBR R12 R0 K15
0x08341104, // 0035 MUL R13 R8 K4
0x00341B13, // 0036 ADD R13 R13 K19
0x543A0003, // 0037 LDINT R14 4
0x0C341A0E, // 0038 DIV R13 R13 R14
0x90322A0D, // 0039 SETMBR R12 K21 R13
0x8C300116, // 003A GETMET R12 R0 K22
0xB83A0A00, // 003B GETNGBL R14 K5
0x88381D11, // 003C GETMBR R14 R14 K17
0xB83E0A00, // 003D GETNGBL R15 K5
0x883C1F17, // 003E GETMBR R15 R15 K23
0x7C300600, // 003F CALL R12 3
0x8C340118, // 0040 GETMET R13 R0 K24
0xB83E0A00, // 0041 GETNGBL R15 K5
0x883C1F11, // 0042 GETMBR R15 R15 K17
0xB8420A00, // 0043 GETNGBL R16 K5
0x88402117, // 0044 GETMBR R16 R16 K23
0x7C340600, // 0045 CALL R13 3
0x04380A08, // 0046 SUB R14 R5 R8
0x0C3C0D03, // 0047 DIV R15 R6 K3
0x043C1E09, // 0048 SUB R15 R15 R9
0x60400007, // 0049 GETGBL R16 G7
0x54460059, // 004A LDINT R17 90
0x8C480719, // 004B GETMET R18 R3 K25
0x8C50071A, // 004C GETMET R20 R3 K26
0x60580011, // 004D GETGBL R22 G17
0x5C5C1E00, // 004E MOVE R23 R15
0x7C580200, // 004F CALL R22 1
0x605C0011, // 0050 GETGBL R23 G17
0x5C601C00, // 0051 MOVE R24 R14
0x7C5C0200, // 0052 CALL R23 1
0x0C582C17, // 0053 DIV R22 R22 R23
0x7C500400, // 0054 CALL R20 2
0x7C480400, // 0055 CALL R18 2
0x04442212, // 0056 SUB R17 R17 R18
0x7C400200, // 0057 CALL R16 1
0x5446002C, // 0058 LDINT R17 45
0x24442011, // 0059 GT R17 R16 R17
0x78460000, // 005A JMPF R17 #005C
0x5442002C, // 005B LDINT R16 45
0x8844011B, // 005C GETMBR R17 R0 K27
0x0C480D03, // 005D DIV R18 R6 K3
0x00481412, // 005E ADD R18 R10 R18
0x90463812, // 005F SETMBR R17 K28 R18
0x8844011B, // 0060 GETMBR R17 R0 K27
0x00481605, // 0061 ADD R18 R11 R5
0x04482513, // 0062 SUB R18 R18 K19
0x04482409, // 0063 SUB R18 R18 R9
0x90463A12, // 0064 SETMBR R17 K29 R18
0x8844010F, // 0065 GETMBR R17 R0 K15
0x8848011F, // 0066 GETMBR R18 R0 K31
0x544E0018, // 0067 LDINT R19 25
0x28482413, // 0068 GE R18 R18 R19
0x784A0001, // 0069 JMPF R18 #006C
0x5C481800, // 006A MOVE R18 R12
0x70020000, // 006B JMP #006D
0x5C481A00, // 006C MOVE R18 R13
0x90463C12, // 006D SETMBR R17 K30 R18
0xB8460A00, // 006E GETNGBL R17 K5
0x8C442320, // 006F GETMET R17 R17 K32
0x884C011B, // 0070 GETMBR R19 R0 K27
0x884C271C, // 0071 GETMBR R19 R19 K28
0x8850011B, // 0072 GETMBR R20 R0 K27
0x8850291D, // 0073 GETMBR R20 R20 K29
0x00541007, // 0074 ADD R21 R8 R7
0x08564215, // 0075 MUL R21 K33 R21
0x00542A09, // 0076 ADD R21 R21 R9
0x58580021, // 0077 LDCONST R22 K33
0x545E0167, // 0078 LDINT R23 360
0x5C600200, // 0079 MOVE R24 R1
0x8864010F, // 007A GETMBR R25 R0 K15
0x7C441000, // 007B CALL R17 8
0x8844010F, // 007C GETMBR R17 R0 K15
0x8848011F, // 007D GETMBR R18 R0 K31
0x544E0031, // 007E LDINT R19 50
0x28482413, // 007F GE R18 R18 R19
0x784A0001, // 0080 JMPF R18 #0083
0x5C481800, // 0081 MOVE R18 R12
0x70020000, // 0082 JMP #0084
0x5C481A00, // 0083 MOVE R18 R13
0x90463C12, // 0084 SETMBR R17 K30 R18
0xB8460A00, // 0085 GETNGBL R17 K5
0x8C442320, // 0086 GETMET R17 R17 K32
0x884C011B, // 0087 GETMBR R19 R0 K27
0x884C271C, // 0088 GETMBR R19 R19 K28
0x8850011B, // 0089 GETMBR R20 R0 K27
0x8850291D, // 008A GETMBR R20 R20 K29
0x00541007, // 008B ADD R21 R8 R7
0x08562615, // 008C MUL R21 K19 R21
0x00542A09, // 008D ADD R21 R21 R9
0x04542B13, // 008E SUB R21 R21 K19
0x545A010D, // 008F LDINT R22 270
0x04582C10, // 0090 SUB R22 R22 R16
0x545E010D, // 0091 LDINT R23 270
0x005C2E10, // 0092 ADD R23 R23 R16
0x5C600200, // 0093 MOVE R24 R1
0x8864010F, // 0094 GETMBR R25 R0 K15
0x7C441000, // 0095 CALL R17 8
0x8844010F, // 0096 GETMBR R17 R0 K15
0x8848011F, // 0097 GETMBR R18 R0 K31
0x544E004A, // 0098 LDINT R19 75
0x28482413, // 0099 GE R18 R18 R19
0x784A0001, // 009A JMPF R18 #009D
0x5C481800, // 009B MOVE R18 R12
0x70020000, // 009C JMP #009E
0x5C481A00, // 009D MOVE R18 R13
0x90463C12, // 009E SETMBR R17 K30 R18
0xB8460A00, // 009F GETNGBL R17 K5
0x8C442320, // 00A0 GETMET R17 R17 K32
0x884C011B, // 00A1 GETMBR R19 R0 K27
0x884C271C, // 00A2 GETMBR R19 R19 K28
0x8850011B, // 00A3 GETMBR R20 R0 K27
0x8850291D, // 00A4 GETMBR R20 R20 K29
0x00541007, // 00A5 ADD R21 R8 R7
0x08560615, // 00A6 MUL R21 K3 R21
0x00542A09, // 00A7 ADD R21 R21 R9
0x04542B03, // 00A8 SUB R21 R21 K3
0x545A010D, // 00A9 LDINT R22 270
0x04582C10, // 00AA SUB R22 R22 R16
0x545E010D, // 00AB LDINT R23 270
0x005C2E10, // 00AC ADD R23 R23 R16
0x5C600200, // 00AD MOVE R24 R1
0x8864010F, // 00AE GETMBR R25 R0 K15
0x7C441000, // 00AF CALL R17 8
0xB82A0A00, // 00B0 GETNGBL R10 K5
0x88281522, // 00B1 GETMBR R10 R10 K34
0x80041400, // 00B2 RET 1 R10
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: get_percentage
********************************************************************/
be_local_closure(get_percentage, /* name */
be_nested_proto(
2, /* 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_nested_string("percentage", -1756136011, 10),
}),
(be_nested_const_str("get_percentage", -1414483304, 14)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 2]) { /* code */
0x88040100, // 0000 GETMBR R1 R0 K0
0x80040200, // 0001 RET 1 R1
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
7, /* nstack */
3, /* 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("init", 380752755, 4),
/* K1 */ be_nested_string("ancestor_design", 421545719, 15),
/* K2 */ be_nested_string("get_design_cb", -825649242, 13),
/* K3 */ be_nested_string("set_design_cb", 1469311634, 13),
/* K4 */ be_nested_string("my_design_cb", -1173588798, 12),
/* K5 */ be_nested_string("percentage", -1756136011, 10),
/* K6 */ be_nested_string("p1", -1605446022, 2),
/* K7 */ be_nested_string("lv_point", -174745506, 8),
/* K8 */ be_nested_string("p2", -1622223641, 2),
/* K9 */ be_nested_string("area", -1693507260, 4),
/* K10 */ be_nested_string("lv_area", -1773816895, 7),
/* K11 */ be_nested_string("line_dsc", -200476318, 8),
/* K12 */ be_nested_string("lv_draw_line_dsc", -1872162060, 16),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[28]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
0x5C140200, // 0004 MOVE R5 R1
0x5C180400, // 0005 MOVE R6 R2
0x7C0C0600, // 0006 CALL R3 3
0x8C0C0102, // 0007 GETMET R3 R0 K2
0x7C0C0200, // 0008 CALL R3 1
0x90020203, // 0009 SETMBR R0 K1 R3
0x8C0C0103, // 000A GETMET R3 R0 K3
0x88140104, // 000B GETMBR R5 R0 K4
0x7C0C0400, // 000C CALL R3 2
0x540E0063, // 000D LDINT R3 100
0x90020A03, // 000E SETMBR R0 K5 R3
0xB80E0E00, // 000F GETNGBL R3 K7
0x7C0C0000, // 0010 CALL R3 0
0x90020C03, // 0011 SETMBR R0 K6 R3
0xB80E0E00, // 0012 GETNGBL R3 K7
0x7C0C0000, // 0013 CALL R3 0
0x90021003, // 0014 SETMBR R0 K8 R3
0xB80E1400, // 0015 GETNGBL R3 K10
0x7C0C0000, // 0016 CALL R3 0
0x90021203, // 0017 SETMBR R0 K9 R3
0xB80E1800, // 0018 GETNGBL R3 K12
0x7C0C0000, // 0019 CALL R3 0
0x90021603, // 001A SETMBR R0 K11 R3
0x80000000, // 001B RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: set_percentage
********************************************************************/
be_local_closure(set_percentage, /* name */
be_nested_proto(
5, /* nstack */
2, /* argc */
0, /* 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_string("percentage", -1756136011, 10),
/* K1 */ be_const_int(0),
/* K2 */ be_nested_string("invalidate", -1645232368, 10),
}),
(be_nested_const_str("set_percentage", -1342944572, 14)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[18]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x540E0003, // 0001 LDINT R3 4
0x0C080403, // 0002 DIV R2 R2 R3
0x540E0063, // 0003 LDINT R3 100
0x240C0203, // 0004 GT R3 R1 R3
0x780E0000, // 0005 JMPF R3 #0007
0x54060063, // 0006 LDINT R1 100
0x140C0301, // 0007 LT R3 R1 K1
0x780E0000, // 0008 JMPF R3 #000A
0x58040001, // 0009 LDCONST R1 K1
0x90020001, // 000A SETMBR R0 K0 R1
0x540E0003, // 000B LDINT R3 4
0x0C0C0203, // 000C DIV R3 R1 R3
0x200C0403, // 000D NE R3 R2 R3
0x780E0001, // 000E JMPF R3 #0011
0x8C0C0102, // 000F GETMET R3 R0 K2
0x7C0C0200, // 0010 CALL R3 1
0x80000000, // 0011 RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified class: lv_signal_arcs
********************************************************************/
extern const bclass be_class_lv_obj;
be_local_class(lv_signal_arcs,
6,
&be_class_lv_obj,
be_nested_map(10,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_nested_key("p1", -1605446022, 2, -1), be_const_var(2) },
{ be_nested_key("my_design_cb", -1173588798, 12, -1), be_const_closure(my_design_cb_closure) },
{ be_nested_key("get_percentage", -1414483304, 14, -1), be_const_closure(get_percentage_closure) },
{ be_nested_key("init", 380752755, 4, 7), be_const_closure(init_closure) },
{ be_nested_key("set_percentage", -1342944572, 14, 0), be_const_closure(set_percentage_closure) },
{ be_nested_key("percentage", -1756136011, 10, 3), be_const_var(1) },
{ be_nested_key("area", -1693507260, 4, -1), be_const_var(4) },
{ be_nested_key("p2", -1622223641, 2, -1), be_const_var(3) },
{ be_nested_key("line_dsc", -200476318, 8, 1), be_const_var(5) },
{ be_nested_key("ancestor_design", 421545719, 15, -1), be_const_var(0) },
})),
(be_nested_const_str("lv_signal_arcs", -1455810308, 14))
);
/*******************************************************************/
void be_load_lv_signal_arcs_class(bvm *vm) {
be_pushntvclass(vm, &be_class_lv_signal_arcs);
be_setglobal(vm, "lv_signal_arcs");
be_pop(vm, 1);
}
#endif // USE_LVGL

View File

@ -0,0 +1,123 @@
/********************************************************************
* Tasmota LVGL lv_signal_bars widget
*******************************************************************/
#include "be_constobj.h"
#ifdef USE_LVGL
#include "lvgl.h"
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
11, /* nstack */
3, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[16]) { /* constants */
/* K0 */ be_nested_string("init", 380752755, 4),
/* K1 */ be_nested_string("set_style_local_bg_color", -498263023, 24),
/* K2 */ be_nested_string("lv", 1529997255, 2),
/* K3 */ be_nested_string("OBJ_PART_MAIN", 658062838, 13),
/* K4 */ be_nested_string("STATE_DEFAULT", 712406428, 13),
/* K5 */ be_nested_string("lv_color", 1419148319, 8),
/* K6 */ be_nested_string("COLOR_BLACK", 264427940, 11),
/* K7 */ be_nested_string("get_height", -723211773, 10),
/* K8 */ be_nested_string("get_style_pad_right", -1144679830, 19),
/* K9 */ be_nested_string("set_height", 1080207399, 10),
/* K10 */ be_const_int(3),
/* K11 */ be_nested_string("set_width", 484671920, 9),
/* K12 */ be_nested_string("set_x", 1849400772, 5),
/* K13 */ be_nested_string("get_width", -1001549996, 9),
/* K14 */ be_nested_string("set_style_local_pad_right", 1126712366, 25),
/* K15 */ be_const_int(1),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[52]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
0x5C140200, // 0004 MOVE R5 R1
0x5C180400, // 0005 MOVE R6 R2
0x7C0C0600, // 0006 CALL R3 3
0x8C0C0101, // 0007 GETMET R3 R0 K1
0xB8160400, // 0008 GETNGBL R5 K2
0x88140B03, // 0009 GETMBR R5 R5 K3
0xB81A0400, // 000A GETNGBL R6 K2
0x88180D04, // 000B GETMBR R6 R6 K4
0xB81E0A00, // 000C GETNGBL R7 K5
0xB8220400, // 000D GETNGBL R8 K2
0x88201106, // 000E GETMBR R8 R8 K6
0x7C1C0200, // 000F CALL R7 1
0x7C0C0800, // 0010 CALL R3 4
0x4C0C0000, // 0011 LDNIL R3
0x200C0203, // 0012 NE R3 R1 R3
0x780E001E, // 0013 JMPF R3 #0033
0x8C0C0307, // 0014 GETMET R3 R1 K7
0x7C0C0200, // 0015 CALL R3 1
0x8C100308, // 0016 GETMET R4 R1 K8
0xB81A0400, // 0017 GETNGBL R6 K2
0x88180D03, // 0018 GETMBR R6 R6 K3
0xB81E0400, // 0019 GETNGBL R7 K2
0x881C0F04, // 001A GETMBR R7 R7 K4
0x7C100600, // 001B CALL R4 3
0x8C140109, // 001C GETMET R5 R0 K9
0x5C1C0600, // 001D MOVE R7 R3
0x7C140400, // 001E CALL R5 2
0x54160003, // 001F LDINT R5 4
0x08140605, // 0020 MUL R5 R3 R5
0x0C140B0A, // 0021 DIV R5 R5 K10
0x8C18010B, // 0022 GETMET R6 R0 K11
0x5C200A00, // 0023 MOVE R8 R5
0x7C180400, // 0024 CALL R6 2
0x8C18010C, // 0025 GETMET R6 R0 K12
0x8C20030D, // 0026 GETMET R8 R1 K13
0x7C200200, // 0027 CALL R8 1
0x04201005, // 0028 SUB R8 R8 R5
0x04201004, // 0029 SUB R8 R8 R4
0x7C180400, // 002A CALL R6 2
0x8C18030E, // 002B GETMET R6 R1 K14
0xB8220400, // 002C GETNGBL R8 K2
0x88201103, // 002D GETMBR R8 R8 K3
0xB8260400, // 002E GETNGBL R9 K2
0x88241304, // 002F GETMBR R9 R9 K4
0x00280805, // 0030 ADD R10 R4 R5
0x0028150F, // 0031 ADD R10 R10 K15
0x7C180800, // 0032 CALL R6 4
0x80000000, // 0033 RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified class: lv_wifi_arcs_icon
********************************************************************/
extern const bclass be_class_lv_wifi_arcs;
be_local_class(lv_wifi_arcs_icon,
0,
&be_class_lv_wifi_arcs,
be_nested_map(1,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_nested_key("init", 380752755, 4, -1), be_const_closure(init_closure) },
})),
(be_nested_const_str("lv_wifi_arcs_icon", 1507982909, 17))
);
/*******************************************************************/
void be_load_lv_wifi_arcs_icon_class(bvm *vm) {
be_pushntvclass(vm, &be_class_lv_wifi_arcs_icon);
be_setglobal(vm, "lv_wifi_arcs_icon");
be_pop(vm, 1);
}
#endif // USE_LVGL

View File

@ -0,0 +1,168 @@
/********************************************************************
* Tasmota LVGL lv_signal_bars widget
*******************************************************************/
#include "be_constobj.h"
#ifdef USE_LVGL
#include "lvgl.h"
/********************************************************************
** Solidified function: every_second
********************************************************************/
be_local_closure(every_second, /* name */
be_nested_proto(
7, /* nstack */
1, /* argc */
0, /* 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_string("tasmota", 424643812, 7),
/* K1 */ be_nested_string("wifi", 120087624, 4),
/* K2 */ be_nested_string("find", -1108310694, 4),
/* K3 */ be_nested_string("quality", -1697296346, 7),
/* K4 */ be_nested_string("ip", 1261996636, 2),
/* K5 */ be_nested_string("set_percentage", -1342944572, 14),
/* K6 */ be_const_int(0),
}),
(be_nested_const_str("every_second", 2075451465, 12)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[23]) { /* code */
0xB8060000, // 0000 GETNGBL R1 K0
0x8C040301, // 0001 GETMET R1 R1 K1
0x7C040200, // 0002 CALL R1 1
0x8C080302, // 0003 GETMET R2 R1 K2
0x58100003, // 0004 LDCONST R4 K3
0x7C080400, // 0005 CALL R2 2
0x8C0C0302, // 0006 GETMET R3 R1 K2
0x58140004, // 0007 LDCONST R5 K4
0x7C0C0400, // 0008 CALL R3 2
0x4C100000, // 0009 LDNIL R4
0x1C100604, // 000A EQ R4 R3 R4
0x78120003, // 000B JMPF R4 #0010
0x8C100105, // 000C GETMET R4 R0 K5
0x58180006, // 000D LDCONST R6 K6
0x7C100400, // 000E CALL R4 2
0x70020005, // 000F JMP #0016
0x4C100000, // 0010 LDNIL R4
0x20100404, // 0011 NE R4 R2 R4
0x78120002, // 0012 JMPF R4 #0016
0x8C100105, // 0013 GETMET R4 R0 K5
0x5C180400, // 0014 MOVE R6 R2
0x7C100400, // 0015 CALL R4 2
0x80000000, // 0016 RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
7, /* nstack */
3, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 5]) { /* constants */
/* K0 */ be_nested_string("init", 380752755, 4),
/* K1 */ be_nested_string("tasmota", 424643812, 7),
/* K2 */ be_nested_string("add_driver", 1654458371, 10),
/* K3 */ be_nested_string("set_percentage", -1342944572, 14),
/* K4 */ be_const_int(0),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[15]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
0x5C140200, // 0004 MOVE R5 R1
0x5C180400, // 0005 MOVE R6 R2
0x7C0C0600, // 0006 CALL R3 3
0xB80E0200, // 0007 GETNGBL R3 K1
0x8C0C0702, // 0008 GETMET R3 R3 K2
0x5C140000, // 0009 MOVE R5 R0
0x7C0C0400, // 000A CALL R3 2
0x8C0C0103, // 000B GETMET R3 R0 K3
0x58140004, // 000C LDCONST R5 K4
0x7C0C0400, // 000D CALL R3 2
0x80000000, // 000E RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: del
********************************************************************/
be_local_closure(del, /* 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[ 3]) { /* constants */
/* K0 */ be_nested_string("del", -816214454, 3),
/* K1 */ be_nested_string("tasmota", 424643812, 7),
/* K2 */ be_nested_string("remove_driver", 1030243768, 13),
}),
(be_nested_const_str("del", -816214454, 3)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[10]) { /* code */
0x60040014, // 0000 GETGBL R1 G20
0x5C080000, // 0001 MOVE R2 R0
0x7C040200, // 0002 CALL R1 1
0x8C040300, // 0003 GETMET R1 R1 K0
0x7C040200, // 0004 CALL R1 1
0xB8060200, // 0005 GETNGBL R1 K1
0x8C040302, // 0006 GETMET R1 R1 K2
0x5C0C0000, // 0007 MOVE R3 R0
0x7C040400, // 0008 CALL R1 2
0x80000000, // 0009 RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified class: lv_wifi_arcs
********************************************************************/
extern const bclass be_class_lv_signal_arcs;
be_local_class(lv_wifi_arcs,
0,
&be_class_lv_signal_arcs,
be_nested_map(3,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_nested_key("every_second", 2075451465, 12, 1), be_const_closure(every_second_closure) },
{ be_nested_key("init", 380752755, 4, -1), be_const_closure(init_closure) },
{ be_nested_key("del", -816214454, 3, -1), be_const_closure(del_closure) },
})),
(be_nested_const_str("lv_wifi_arcs", 2082091963, 12))
);
/*******************************************************************/
void be_load_lv_wifi_arcs_class(bvm *vm) {
be_pushntvclass(vm, &be_class_lv_wifi_arcs);
be_setglobal(vm, "lv_wifi_arcs");
be_pop(vm, 1);
}
#endif // USE_LVGL

View File

@ -0,0 +1,119 @@
/********************************************************************
* Tasmota LVGL lv_signal_bars widget
*******************************************************************/
#include "be_constobj.h"
#ifdef USE_LVGL
#include "lvgl.h"
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
10, /* nstack */
3, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[15]) { /* constants */
/* K0 */ be_nested_string("init", 380752755, 4),
/* K1 */ be_nested_string("set_style_local_bg_color", -498263023, 24),
/* K2 */ be_nested_string("lv", 1529997255, 2),
/* K3 */ be_nested_string("OBJ_PART_MAIN", 658062838, 13),
/* K4 */ be_nested_string("STATE_DEFAULT", 712406428, 13),
/* K5 */ be_nested_string("lv_color", 1419148319, 8),
/* K6 */ be_nested_string("COLOR_BLACK", 264427940, 11),
/* K7 */ be_nested_string("get_height", -723211773, 10),
/* K8 */ be_nested_string("get_style_pad_right", -1144679830, 19),
/* K9 */ be_nested_string("set_height", 1080207399, 10),
/* K10 */ be_nested_string("set_width", 484671920, 9),
/* K11 */ be_nested_string("set_x", 1849400772, 5),
/* K12 */ be_nested_string("get_width", -1001549996, 9),
/* K13 */ be_nested_string("set_style_local_pad_right", 1126712366, 25),
/* K14 */ be_const_int(1),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[49]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
0x5C140200, // 0004 MOVE R5 R1
0x5C180400, // 0005 MOVE R6 R2
0x7C0C0600, // 0006 CALL R3 3
0x8C0C0101, // 0007 GETMET R3 R0 K1
0xB8160400, // 0008 GETNGBL R5 K2
0x88140B03, // 0009 GETMBR R5 R5 K3
0xB81A0400, // 000A GETNGBL R6 K2
0x88180D04, // 000B GETMBR R6 R6 K4
0xB81E0A00, // 000C GETNGBL R7 K5
0xB8220400, // 000D GETNGBL R8 K2
0x88201106, // 000E GETMBR R8 R8 K6
0x7C1C0200, // 000F CALL R7 1
0x7C0C0800, // 0010 CALL R3 4
0x4C0C0000, // 0011 LDNIL R3
0x200C0203, // 0012 NE R3 R1 R3
0x780E001B, // 0013 JMPF R3 #0030
0x8C0C0307, // 0014 GETMET R3 R1 K7
0x7C0C0200, // 0015 CALL R3 1
0x8C100308, // 0016 GETMET R4 R1 K8
0xB81A0400, // 0017 GETNGBL R6 K2
0x88180D03, // 0018 GETMBR R6 R6 K3
0xB81E0400, // 0019 GETNGBL R7 K2
0x881C0F04, // 001A GETMBR R7 R7 K4
0x7C100600, // 001B CALL R4 3
0x8C140109, // 001C GETMET R5 R0 K9
0x5C1C0600, // 001D MOVE R7 R3
0x7C140400, // 001E CALL R5 2
0x8C14010A, // 001F GETMET R5 R0 K10
0x5C1C0600, // 0020 MOVE R7 R3
0x7C140400, // 0021 CALL R5 2
0x8C14010B, // 0022 GETMET R5 R0 K11
0x8C1C030C, // 0023 GETMET R7 R1 K12
0x7C1C0200, // 0024 CALL R7 1
0x041C0E03, // 0025 SUB R7 R7 R3
0x041C0E04, // 0026 SUB R7 R7 R4
0x7C140400, // 0027 CALL R5 2
0x8C14030D, // 0028 GETMET R5 R1 K13
0xB81E0400, // 0029 GETNGBL R7 K2
0x881C0F03, // 002A GETMBR R7 R7 K3
0xB8220400, // 002B GETNGBL R8 K2
0x88201104, // 002C GETMBR R8 R8 K4
0x00240803, // 002D ADD R9 R4 R3
0x0024130E, // 002E ADD R9 R9 K14
0x7C140800, // 002F CALL R5 4
0x80000000, // 0030 RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified class: lv_wifi_bars_icon
********************************************************************/
extern const bclass be_class_lv_wifi_bars;
be_local_class(lv_wifi_bars_icon,
0,
&be_class_lv_wifi_bars,
be_nested_map(1,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_nested_key("init", 380752755, 4, -1), be_const_closure(init_closure) },
})),
(be_nested_const_str("lv_wifi_bars_icon", -1489151756, 17))
);
/*******************************************************************/
void be_load_lv_wifi_bars_icon_class(bvm *vm) {
be_pushntvclass(vm, &be_class_lv_wifi_bars_icon);
be_setglobal(vm, "lv_wifi_bars_icon");
be_pop(vm, 1);
}
#endif // USE_LVGL

View File

@ -7,50 +7,6 @@
#include "lvgl.h" #include "lvgl.h"
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
7, /* nstack */
3, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 5]) { /* constants */
/* K0 */ be_nested_string("init", 380752755, 4),
/* K1 */ be_nested_string("tasmota", 424643812, 7),
/* K2 */ be_nested_string("add_driver", 1654458371, 10),
/* K3 */ be_nested_string("set_percentage", -1342944572, 14),
/* K4 */ be_const_int(0),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[15]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
0x5C140200, // 0004 MOVE R5 R1
0x5C180400, // 0005 MOVE R6 R2
0x7C0C0600, // 0006 CALL R3 3
0xB80E0200, // 0007 GETNGBL R3 K1
0x8C0C0702, // 0008 GETMET R3 R3 K2
0x5C140000, // 0009 MOVE R5 R0
0x7C0C0400, // 000A CALL R3 2
0x8C0C0103, // 000B GETMET R3 R0 K3
0x58140004, // 000C LDCONST R5 K4
0x7C0C0400, // 000D CALL R3 2
0x80000000, // 000E RET 0
})
)
);
/*******************************************************************/
/******************************************************************** /********************************************************************
** Solidified function: every_second ** Solidified function: every_second
********************************************************************/ ********************************************************************/
@ -105,6 +61,87 @@ be_local_closure(every_second, /* name */
/*******************************************************************/ /*******************************************************************/
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
7, /* nstack */
3, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 5]) { /* constants */
/* K0 */ be_nested_string("init", 380752755, 4),
/* K1 */ be_nested_string("tasmota", 424643812, 7),
/* K2 */ be_nested_string("add_driver", 1654458371, 10),
/* K3 */ be_nested_string("set_percentage", -1342944572, 14),
/* K4 */ be_const_int(0),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[15]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
0x5C140200, // 0004 MOVE R5 R1
0x5C180400, // 0005 MOVE R6 R2
0x7C0C0600, // 0006 CALL R3 3
0xB80E0200, // 0007 GETNGBL R3 K1
0x8C0C0702, // 0008 GETMET R3 R3 K2
0x5C140000, // 0009 MOVE R5 R0
0x7C0C0400, // 000A CALL R3 2
0x8C0C0103, // 000B GETMET R3 R0 K3
0x58140004, // 000C LDCONST R5 K4
0x7C0C0400, // 000D CALL R3 2
0x80000000, // 000E RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: del
********************************************************************/
be_local_closure(del, /* 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[ 3]) { /* constants */
/* K0 */ be_nested_string("del", -816214454, 3),
/* K1 */ be_nested_string("tasmota", 424643812, 7),
/* K2 */ be_nested_string("remove_driver", 1030243768, 13),
}),
(be_nested_const_str("del", -816214454, 3)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[10]) { /* code */
0x60040014, // 0000 GETGBL R1 G20
0x5C080000, // 0001 MOVE R2 R0
0x7C040200, // 0002 CALL R1 1
0x8C040300, // 0003 GETMET R1 R1 K0
0x7C040200, // 0004 CALL R1 1
0xB8060200, // 0005 GETNGBL R1 K1
0x8C040302, // 0006 GETMET R1 R1 K2
0x5C0C0000, // 0007 MOVE R3 R0
0x7C040400, // 0008 CALL R1 2
0x80000000, // 0009 RET 0
})
)
);
/*******************************************************************/
/******************************************************************** /********************************************************************
** Solidified class: lv_wifi_bars ** Solidified class: lv_wifi_bars
********************************************************************/ ********************************************************************/
@ -112,10 +149,11 @@ extern const bclass be_class_lv_signal_bars;
be_local_class(lv_wifi_bars, be_local_class(lv_wifi_bars,
0, 0,
&be_class_lv_signal_bars, &be_class_lv_signal_bars,
be_nested_map(2, be_nested_map(3,
( (struct bmapnode*) &(const bmapnode[]) { ( (struct bmapnode*) &(const bmapnode[]) {
{ be_nested_key("every_second", 2075451465, 12, 1), be_const_closure(every_second_closure) },
{ be_nested_key("init", 380752755, 4, -1), be_const_closure(init_closure) }, { be_nested_key("init", 380752755, 4, -1), be_const_closure(init_closure) },
{ be_nested_key("every_second", 2075451465, 12, 0), be_const_closure(every_second_closure) }, { be_nested_key("del", -816214454, 3, -1), be_const_closure(del_closure) },
})), })),
(be_nested_const_str("lv_wifi_bars", 2109539196, 12)) (be_nested_const_str("lv_wifi_bars", 2109539196, 12))
); );

View File

@ -127,6 +127,10 @@ extern void be_load_ctypes_definitions_lib(bvm *vm);
// custom widgets // custom widgets
extern void be_load_lv_signal_bars_class(bvm *vm); extern void be_load_lv_signal_bars_class(bvm *vm);
extern void be_load_lv_wifi_bars_class(bvm *vm); extern void be_load_lv_wifi_bars_class(bvm *vm);
extern void be_load_lv_wifi_bars_icon_class(bvm *vm);
extern void be_load_lv_signal_arcs_class(bvm *vm);
extern void be_load_lv_wifi_arcs_class(bvm *vm);
extern void be_load_lv_wifi_arcs_icon_class(bvm *vm);
#endif// USE_LVGL #endif// USE_LVGL
/* this code loads the native class definitions */ /* this code loads the native class definitions */
@ -171,6 +175,10 @@ BERRY_API void be_load_custom_libs(bvm *vm)
// custom widgets // custom widgets
be_load_lv_signal_bars_class(vm); be_load_lv_signal_bars_class(vm);
be_load_lv_wifi_bars_class(vm); be_load_lv_wifi_bars_class(vm);
be_load_lv_wifi_bars_icon_class(vm);
be_load_lv_signal_arcs_class(vm);
be_load_lv_wifi_arcs_class(vm);
be_load_lv_wifi_arcs_icon_class(vm);
#endif // USE_LVGL #endif // USE_LVGL
} }
#endif #endif

View File

@ -1462,6 +1462,46 @@ be_local_closure(add_driver, /* name */
); );
/*******************************************************************/ /*******************************************************************/
/********************************************************************
** Solidified function: remove_driver
********************************************************************/
be_local_closure(remove_driver, /* name */
be_nested_proto(
6, /* nstack */
2, /* argc */
0, /* 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_string("_drivers", -1034638311, 8),
/* K1 */ be_nested_string("find", -1108310694, 4),
/* K2 */ be_nested_string("pop", 1362321360, 3),
}),
(be_nested_const_str("remove_driver", 1030243768, 13)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[14]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x780A000A, // 0001 JMPF R2 #000D
0x88080100, // 0002 GETMBR R2 R0 K0
0x8C080501, // 0003 GETMET R2 R2 K1
0x5C100200, // 0004 MOVE R4 R1
0x7C080400, // 0005 CALL R2 2
0x4C0C0000, // 0006 LDNIL R3
0x200C0403, // 0007 NE R3 R2 R3
0x780E0003, // 0008 JMPF R3 #000D
0x880C0100, // 0009 GETMBR R3 R0 K0
0x8C0C0702, // 000A GETMET R3 R3 K2
0x5C140400, // 000B MOVE R5 R2
0x7C0C0400, // 000C CALL R3 2
0x80000000, // 000D RET 0
})
)
);
/*******************************************************************/
/******************************************************************** /********************************************************************
** Solidified function: load ** Solidified function: load
********************************************************************/ ********************************************************************/
@ -2105,96 +2145,15 @@ be_local_closure(gen_cb, /* name */
/*******************************************************************/ /*******************************************************************/
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_class_tasmota.h" #include "../generate/be_fixed_be_class_tasmota.h"
#endif
// Class definition // Class definition
void be_load_tasmota_ntvlib(bvm *vm) void be_load_tasmota_ntvlib(bvm *vm)
{ {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ "_rules", NULL },
{ "_timers", NULL },
{ "_ccmd", NULL },
{ "_drivers", NULL },
{ "_cb", NULL},
{ "wire1", NULL },
{ "wire2", NULL },
{ "get_free_heap", l_getFreeHeap },
{ "publish", l_publish },
{ "publish_result", l_publish_result },
{ "_cmd", l_cmd },
{ "_get_cb", l_get_cb },
{ "get_option", l_getoption },
{ "millis", l_millis },
{ "time_reached", l_timereached },
{ "rtc", l_rtc },
{ "time_dump", l_time_dump },
{ "memory", l_memory },
{ "wifi", l_wifi },
{ "eth", l_eth },
{ "yield", l_yield },
{ "delay", l_delay },
{ "scale_uint", l_scaleuint },
{ "log", l_logInfo },
{ "save", l_save },
{ "resp_cmnd", l_respCmnd },
{ "resp_cmnd_str", l_respCmndStr },
{ "resp_cmnd_done", l_respCmndDone },
{ "resp_cmnd_error", l_respCmndError },
{ "resp_cmnd_failed", l_respCmndFailed },
{ "resolvecmnd", l_resolveCmnd },
{ "response_append", l_respAppend },
{ "web_send", l_webSend },
{ "web_send_decimal", l_webSendDecimal },
{ "get_power", l_getpower },
{ "set_power", l_setpower },
{ "i2c_enabled", l_i2cenabled },
{ NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
{ "cmd", (bntvfunc) &cmd_closure },
{ "chars_in_string", (bntvfunc) &chars_in_string_closure },
{ "find_key_i", (bntvfunc) &find_key_i_closure },
{ "find_op", (bntvfunc) &find_op_closure },
{ "add_rule", (bntvfunc) &add_rule_closure },
{ "remove_rule", (bntvfunc) &remove_rule_closure },
{ "try_rule", (bntvfunc) &try_rule_closure },
{ "exec_rules", (bntvfunc) &exec_rules_closure },
{ "set_timer", (bntvfunc) &set_timer_closure },
{ "run_deferred", (bntvfunc) &run_deferred_closure },
{ "remove_timer", (bntvfunc) &remove_timer_closure },
{ "add_cmd", (bntvfunc) &add_cmd_closure },
{ "remove_cmd", (bntvfunc) &remove_cmd_closure },
{ "exec_cmd", (bntvfunc) &exec_cmd_closure },
{ "gc", (bntvfunc) &gc_closure },
{ "event", (bntvfunc) &event_closure },
{ "add_driver", (bntvfunc) &add_driver_closure },
{ "load", (bntvfunc) &load_closure },
{ "wire_scan", (bntvfunc) &wire_scan_closure },
{ "time_str", (bntvfunc) &time_str_closure },
// callbacks
{ "cb_dispatch", (bntvfunc) &cb_dispatch_closure },
{ "gen_cb", (bntvfunc) &gen_cb_closure },
// deprecated
{ "get_light", (bntvfunc) &get_light_closure },
{ "set_light", (bntvfunc) &set_light_closure },
{ NULL, NULL }
};
be_regclass(vm, "Tasmota", members);
#else
be_pushntvclass(vm, &be_class_tasmota); be_pushntvclass(vm, &be_class_tasmota);
be_setglobal(vm, "Tasmota"); be_setglobal(vm, "Tasmota");
be_pop(vm, 1); be_pop(vm, 1);
#endif
} }
/* @const_object_info_begin /* @const_object_info_begin
@ -2260,6 +2219,7 @@ class be_class_tasmota (scope: global, name: Tasmota) {
gc, closure(gc_closure) gc, closure(gc_closure)
event, closure(event_closure) event, closure(event_closure)
add_driver, closure(add_driver_closure) add_driver, closure(add_driver_closure)
remove_driver, closure(remove_driver_closure)
load, closure(load_closure) load, closure(load_closure)
wire_scan, closure(wire_scan_closure) wire_scan, closure(wire_scan_closure)
time_str, closure(time_str_closure) time_str, closure(time_str_closure)

View File

@ -302,6 +302,15 @@ class Tasmota
end end
end end
def remove_driver(d)
if self._drivers
var idx = self._drivers.find(d)
if idx != nil
self._drivers.pop(idx)
end
end
end
# cmd high-level function # cmd high-level function
def cmd(command) def cmd(command)
import json import json

View File

@ -0,0 +1,135 @@
#- LVGL lv_signal_bars and lv_wifi_bars
-
--#
class lv_signal_arcs : lv_obj
var ancestor_design # previous design_cb
var percentage # value to display, range 0..100
var p1, p2, area, line_dsc # instances of objects kept to avoid re-instanciating at each call
def init(parent, copy)
# init parent object
super(self).init(parent, copy)
# keep a copy of
self.ancestor_design = self.get_design_cb()
self.set_design_cb(self.my_design_cb)
# own values
self.percentage = 100
# pre-allocate buffers
self.p1 = lv_point()
self.p2 = lv_point()
self.area = lv_area()
self.line_dsc = lv_draw_line_dsc()
end
def my_design_cb(clip_area, mode)
import math
def atleast1(x) if x >= 1 return x else return 1 end end
# the model is that we have 4 bars and inter-bar (1/4 of width)
var height = self.get_height()
var width = self.get_width()
var inter_bar = atleast1(height / 8)
var bar = atleast1((height - inter_bar * 2) / 3)
var bar_offset = bar / 2
#print("inter_bar", inter_bar, "bar", bar, "bar_offset", bar_offset)
if mode == lv.DESIGN_COVER_CHK
#- Return false if the object is not covers the clip_area clip_area -#
return self.ancestor_design.call(self, clip_area, mode)
elif mode == lv.DESIGN_DRAW_MAIN
#self.ancestor_design.call(self, clip_area, mode) # commented since we don't draw a background
# get coordinates of object
self.get_coords(self.area)
var x_ofs = self.area.x1
var y_ofs = self.area.y1
lv.draw_line_dsc_init(self.line_dsc) # initialize lv_draw_line_dsc structure
self.init_draw_line_dsc(lv.OBJ_PART_MAIN, self.line_dsc) # copy the current values
self.line_dsc.round_start = 1
self.line_dsc.round_end = 1
self.line_dsc.width = (bar * 3 + 1) / 4
var on_color = self.get_style_line_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT)
var off_color = self.get_style_bg_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT)
# initial calculation, but does not take into account bounding box
# var angle = int(math.deg(math.atan2(width / 2, height)))
# better calculation
var hypotenuse = height - bar # center if at bar/2 from bottom and circle stops at bar/2 from top
var adjacent = width / 2 - bar_offset # stop at bar_offset from side
var angle = int(90 - math.deg(math.acos(real(adjacent) / real(hypotenuse))))
if (angle > 45) angle = 45 end
# print("hypotenuse",hypotenuse,"adjacent",adjacent,"angle",angle)
self.p1.x = x_ofs + width / 2
self.p1.y = y_ofs + height - 1 - bar_offset
self.line_dsc.color = self.percentage >= 25 ? on_color : off_color
lv.draw_arc(self.p1.x, self.p1.y, 0 * (bar + inter_bar) + bar_offset, 0, 360, clip_area, self.line_dsc)
self.line_dsc.color = self.percentage >= 50 ? on_color : off_color
lv.draw_arc(self.p1.x, self.p1.y, 1 * (bar + inter_bar) + bar_offset - 1, 270 - angle, 270 + angle, clip_area, self.line_dsc)
self.line_dsc.color = self.percentage >= 75 ? on_color : off_color
lv.draw_arc(self.p1.x, self.p1.y, 2 * (bar + inter_bar) + bar_offset - 2, 270 - angle, 270 + angle, clip_area, self.line_dsc)
#elif mode == lv.DESIGN_DRAW_POST # commented since we don't want a frame around this object
# self.ancestor_design.call(self, clip_area, mode)
end
return lv.DESIGN_RES_OK
end
def set_percentage(v)
var old_bars = self.percentage / 4
if v > 100 v = 100 end
if v < 0 v = 0 end
self.percentage = v
if old_bars != v / 4
self.invalidate() # be frugal and avoid updating the widget if it's not needed
end
end
def get_percentage()
return self.percentage
end
end
class lv_wifi_arcs: lv_signal_arcs
def init(parent, copy)
super(self).init(parent, copy)
tasmota.add_driver(self)
self.set_percentage(0) # we generally start with 0, meaning not connected
end
def every_second()
var wifi = tasmota.wifi()
var quality = wifi.find("quality")
var ip = wifi.find("ip")
if ip == nil
self.set_percentage(0)
elif quality != nil
self.set_percentage(quality)
end
end
def del()
super(self).del()
tasmota.remove_driver(self)
end
end
class lv_wifi_arcs_icon: lv_wifi_arcs
def init(parent, copy)
super(self).init(parent, copy)
self.set_style_local_bg_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv_color(lv.COLOR_BLACK))
if parent != nil
var parent_height = parent.get_height()
var pad_right = parent.get_style_pad_right(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT)
self.set_height(parent_height)
var w = (parent_height*4)/3
self.set_width(w) # 130%
self.set_x(parent.get_width() - w - pad_right)
parent.set_style_local_pad_right(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, pad_right + w + 1)
end
end
end

View File

@ -99,4 +99,24 @@ class lv_wifi_bars: lv_signal_bars
self.set_percentage(quality) self.set_percentage(quality)
end end
end end
def del()
super(self).del()
tasmota.remove_driver(self)
end
end
class lv_wifi_bars_icon: lv_wifi_bars
def init(parent, copy)
super(self).init(parent, copy)
self.set_style_local_bg_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv_color(lv.COLOR_BLACK))
if parent != nil
var parent_height = parent.get_height()
var pad_right = parent.get_style_pad_right(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT)
self.set_height(parent_height)
self.set_width(parent_height)
self.set_x(parent.get_width() - parent_height - pad_right)
parent.set_style_local_pad_right(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, pad_right + parent_height + 1)
end
end
end end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,73 +1,74 @@
#include "be_constobj.h" #include "be_constobj.h"
static be_define_const_map_slots(be_class_tasmota_map) { static be_define_const_map_slots(be_class_tasmota_map) {
{ be_const_key(remove_rule, -1), be_const_closure(remove_rule_closure) },
{ be_const_key(cb_dispatch, -1), be_const_closure(cb_dispatch_closure) },
{ be_const_key(wire2, -1), be_const_var(0) },
{ be_const_key(_cb, -1), be_const_var(1) },
{ be_const_key(web_send, -1), be_const_func(l_webSend) },
{ be_const_key(wire_scan, 43), be_const_closure(wire_scan_closure) },
{ be_const_key(_get_cb, -1), be_const_func(l_get_cb) },
{ be_const_key(eth, 11), be_const_func(l_eth) },
{ be_const_key(resp_cmnd_done, -1), be_const_func(l_respCmndDone) },
{ be_const_key(response_append, -1), be_const_func(l_respAppend) },
{ be_const_key(wifi, 2), be_const_func(l_wifi) },
{ be_const_key(get_light, -1), be_const_closure(get_light_closure) },
{ be_const_key(rtc, -1), be_const_func(l_rtc) },
{ be_const_key(cmd, 32), be_const_closure(cmd_closure) },
{ be_const_key(resp_cmnd_failed, 6), be_const_func(l_respCmndFailed) },
{ be_const_key(get_power, -1), be_const_func(l_getpower) },
{ be_const_key(event, -1), be_const_closure(event_closure) },
{ be_const_key(get_free_heap, -1), be_const_func(l_getFreeHeap) },
{ be_const_key(publish, 41), be_const_func(l_publish) },
{ be_const_key(_rules, -1), be_const_var(2) },
{ be_const_key(resp_cmnd_str, -1), be_const_func(l_respCmndStr) },
{ be_const_key(resp_cmnd, -1), be_const_func(l_respCmnd) },
{ be_const_key(remove_timer, -1), be_const_closure(remove_timer_closure) },
{ be_const_key(time_dump, 50), be_const_func(l_time_dump) },
{ be_const_key(_timers, -1), be_const_var(3) },
{ be_const_key(wire1, -1), be_const_var(4) },
{ be_const_key(add_cmd, 35), be_const_closure(add_cmd_closure) },
{ be_const_key(add_driver, 56), be_const_closure(add_driver_closure) },
{ be_const_key(delay, -1), be_const_func(l_delay) },
{ be_const_key(resp_cmnd_error, -1), be_const_func(l_respCmndError) },
{ be_const_key(memory, -1), be_const_func(l_memory) },
{ be_const_key(exec_cmd, 16), be_const_closure(exec_cmd_closure) },
{ be_const_key(get_option, -1), be_const_func(l_getoption) },
{ be_const_key(try_rule, -1), be_const_closure(try_rule_closure) },
{ be_const_key(find_op, 24), be_const_closure(find_op_closure) },
{ be_const_key(set_timer, -1), be_const_closure(set_timer_closure) },
{ be_const_key(remove_cmd, -1), be_const_closure(remove_cmd_closure) },
{ be_const_key(gc, -1), be_const_closure(gc_closure) },
{ be_const_key(exec_rules, -1), be_const_closure(exec_rules_closure) },
{ be_const_key(log, -1), be_const_func(l_logInfo) }, { be_const_key(log, -1), be_const_func(l_logInfo) },
{ be_const_key(_cmd, -1), be_const_func(l_cmd) }, { be_const_key(gc, -1), be_const_closure(gc_closure) },
{ be_const_key(save, 58), be_const_func(l_save) }, { be_const_key(_cmd, 45), be_const_func(l_cmd) },
{ be_const_key(find_key_i, -1), be_const_closure(find_key_i_closure) }, { be_const_key(millis, 53), be_const_func(l_millis) },
{ be_const_key(web_send, -1), be_const_func(l_webSend) },
{ be_const_key(wire1, -1), be_const_var(0) },
{ be_const_key(response_append, -1), be_const_func(l_respAppend) },
{ be_const_key(_get_cb, 30), be_const_func(l_get_cb) },
{ be_const_key(get_free_heap, 22), be_const_func(l_getFreeHeap) },
{ be_const_key(resp_cmnd_failed, 2), be_const_func(l_respCmndFailed) },
{ be_const_key(exec_cmd, -1), be_const_closure(exec_cmd_closure) },
{ be_const_key(set_light, 8), be_const_closure(set_light_closure) },
{ be_const_key(resp_cmnd, 16), be_const_func(l_respCmnd) },
{ be_const_key(find_op, 34), be_const_closure(find_op_closure) },
{ be_const_key(eth, -1), be_const_func(l_eth) },
{ be_const_key(cmd, -1), be_const_closure(cmd_closure) },
{ be_const_key(resp_cmnd_done, -1), be_const_func(l_respCmndDone) },
{ be_const_key(remove_rule, 1), be_const_closure(remove_rule_closure) },
{ be_const_key(get_power, -1), be_const_func(l_getpower) },
{ be_const_key(add_cmd, -1), be_const_closure(add_cmd_closure) },
{ be_const_key(get_light, -1), be_const_closure(get_light_closure) },
{ be_const_key(exec_rules, 37), be_const_closure(exec_rules_closure) },
{ be_const_key(time_str, -1), be_const_closure(time_str_closure) },
{ be_const_key(remove_driver, 29), be_const_closure(remove_driver_closure) },
{ be_const_key(publish_result, 38), be_const_func(l_publish_result) },
{ be_const_key(rtc, -1), be_const_func(l_rtc) },
{ be_const_key(try_rule, -1), be_const_closure(try_rule_closure) },
{ be_const_key(gen_cb, 42), be_const_closure(gen_cb_closure) },
{ be_const_key(wire_scan, -1), be_const_closure(wire_scan_closure) },
{ be_const_key(add_rule, -1), be_const_closure(add_rule_closure) },
{ be_const_key(_timers, -1), be_const_var(1) },
{ be_const_key(wire2, -1), be_const_var(2) },
{ be_const_key(run_deferred, 20), be_const_closure(run_deferred_closure) },
{ be_const_key(get_option, -1), be_const_func(l_getoption) },
{ be_const_key(remove_timer, -1), be_const_closure(remove_timer_closure) },
{ be_const_key(scale_uint, -1), be_const_func(l_scaleuint) }, { be_const_key(scale_uint, -1), be_const_func(l_scaleuint) },
{ be_const_key(set_light, -1), be_const_closure(set_light_closure) }, { be_const_key(resp_cmnd_str, 51), be_const_func(l_respCmndStr) },
{ be_const_key(i2c_enabled, -1), be_const_func(l_i2cenabled) }, { be_const_key(memory, -1), be_const_func(l_memory) },
{ be_const_key(yield, -1), be_const_func(l_yield) }, { be_const_key(chars_in_string, -1), be_const_closure(chars_in_string_closure) },
{ be_const_key(_ccmd, -1), be_const_var(5) },
{ be_const_key(web_send_decimal, -1), be_const_func(l_webSendDecimal) },
{ be_const_key(millis, 8), be_const_func(l_millis) },
{ be_const_key(_drivers, -1), be_const_var(6) },
{ be_const_key(load, 29), be_const_closure(load_closure) },
{ be_const_key(run_deferred, 5), be_const_closure(run_deferred_closure) },
{ be_const_key(gen_cb, -1), be_const_closure(gen_cb_closure) },
{ be_const_key(time_str, 21), be_const_closure(time_str_closure) },
{ be_const_key(add_rule, 26), be_const_closure(add_rule_closure) },
{ be_const_key(resolvecmnd, -1), be_const_func(l_resolveCmnd) }, { be_const_key(resolvecmnd, -1), be_const_func(l_resolveCmnd) },
{ be_const_key(set_power, -1), be_const_func(l_setpower) }, { be_const_key(load, -1), be_const_closure(load_closure) },
{ be_const_key(publish_result, -1), be_const_func(l_publish_result) }, { be_const_key(publish, 55), be_const_func(l_publish) },
{ be_const_key(time_reached, 22), be_const_func(l_timereached) }, { be_const_key(_ccmd, -1), be_const_var(3) },
{ be_const_key(chars_in_string, 7), be_const_closure(chars_in_string_closure) }, { be_const_key(resp_cmnd_error, 23), be_const_func(l_respCmndError) },
{ be_const_key(cb_dispatch, -1), be_const_closure(cb_dispatch_closure) },
{ be_const_key(save, -1), be_const_func(l_save) },
{ be_const_key(_drivers, -1), be_const_var(4) },
{ be_const_key(find_key_i, -1), be_const_closure(find_key_i_closure) },
{ be_const_key(wifi, 36), be_const_func(l_wifi) },
{ be_const_key(set_timer, 40), be_const_closure(set_timer_closure) },
{ be_const_key(i2c_enabled, 44), be_const_func(l_i2cenabled) },
{ be_const_key(set_power, 54), be_const_func(l_setpower) },
{ be_const_key(_rules, 14), be_const_var(5) },
{ be_const_key(delay, -1), be_const_func(l_delay) },
{ be_const_key(strftime, -1), be_const_func(l_strftime) }, { be_const_key(strftime, -1), be_const_func(l_strftime) },
{ be_const_key(time_dump, -1), be_const_func(l_time_dump) },
{ be_const_key(time_reached, 26), be_const_func(l_timereached) },
{ be_const_key(web_send_decimal, 58), be_const_func(l_webSendDecimal) },
{ be_const_key(_cb, -1), be_const_var(6) },
{ be_const_key(yield, 56), be_const_func(l_yield) },
{ be_const_key(event, -1), be_const_closure(event_closure) },
{ be_const_key(remove_cmd, -1), be_const_closure(remove_cmd_closure) },
{ be_const_key(add_driver, -1), be_const_closure(add_driver_closure) },
}; };
static be_define_const_map( static be_define_const_map(
be_class_tasmota_map, be_class_tasmota_map,
62 63
); );
BE_EXPORT_VARIABLE be_define_const_class( BE_EXPORT_VARIABLE be_define_const_class(

View File

@ -21,16 +21,11 @@ stat_line.set_align(lv.LABEL_ALIGN_LEFT)
stat_line.set_style_local_bg_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv_color(0xD00000)) # background #000088 stat_line.set_style_local_bg_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv_color(0xD00000)) # background #000088
stat_line.set_style_local_bg_opa(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv.OPA_COVER) # 100% background opacity stat_line.set_style_local_bg_opa(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv.OPA_COVER) # 100% background opacity
stat_line.set_style_local_text_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv_color(0xFFFFFF)) # text color #FFFFFF stat_line.set_style_local_text_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv_color(0xFFFFFF)) # text color #FFFFFF
stat_line.set_text("Welcome to Tasmota") stat_line.set_text("Tasmota")
stat_line_height = stat_line.get_height() stat_line_height = stat_line.get_height()
#- display wifi strength indicator icon (for professionals ;) -# #- display wifi strength indicator icon (for professionals ;) -#
stat_line.set_style_local_pad_right(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, stat_line_height + 1) wifi_icon = lv_wifi_arcs_icon(stat_line) # the widget takes care of positioning and driver stuff
wifi_bars = lv_wifi_bars(stat_line)
wifi_bars.set_style_local_bg_color(lv.OBJ_PART_MAIN, lv.STATE_DEFAULT, lv_color(lv.COLOR_BLACK))
wifi_bars.set_height(stat_line_height)
wifi_bars.set_width(stat_line_height)
wifi_bars.set_x(stat_line.get_width() - stat_line_height)
#- create a style for the buttons -# #- create a style for the buttons -#
btn_style = lv_style() btn_style = lv_style()