Merge branch 'development' into pre-release-9.6.0

This commit is contained in:
Theo Arends 2021-10-12 11:34:11 +02:00
commit c1d61c9eb0
42 changed files with 2154 additions and 1934 deletions

View File

@ -24,6 +24,9 @@ All notable changes to this project will be documented in this file.
- Files starting with underscore in file system are no more hidden
- ESP32 Memory display to exclude IRAM (i.e. less by 40-50KB) (#13294)
### Fixed
- ESP32 restore GPIO16/17 if no PSRAM was found regression from v9.5.0.3
## [9.5.0.8] 20210927
### Added
- Command ``WebGetConfig <url>`` if ``#define USE_WEBGETCONFIG`` is enabled to restore/init configuration from external webserver (#13034)

View File

@ -379,39 +379,38 @@ be_local_closure(find_key_i, /* name */
/* K4 */ be_nested_string("stop_iteration", -121173395, 14),
}),
(be_nested_const_str("find_key_i", 850136726, 10)),
(be_nested_const_str("Tasmota.be", 825809411, 10)),
( &(const binstruction[31]) { /* code */
0xA40E0000, // 0000 IMPORT R3 K0
0x8C100701, // 0001 GETMET R4 R3 K1
0x5C180400, // 0002 MOVE R6 R2
0x7C100400, // 0003 CALL R4 2
0x60140006, // 0004 GETGBL R5 G6
0x5C180200, // 0005 MOVE R6 R1
0x7C140200, // 0006 CALL R5 1
0x60180013, // 0007 GETGBL R6 G19
0x1C140A06, // 0008 EQ R5 R5 R6
0x78160013, // 0009 JMPF R5 #001E
0x60140010, // 000A GETGBL R5 G16
0x8C180302, // 000B GETMET R6 R1 K2
0x7C180200, // 000C CALL R6 1
0x7C140200, // 000D CALL R5 1
0xA802000B, // 000E EXBLK 0 #001B
0x5C180A00, // 000F MOVE R6 R5
0x7C180000, // 0010 CALL R6 0
0x8C1C0701, // 0011 GETMET R7 R3 K1
0x5C240C00, // 0012 MOVE R9 R6
0x7C1C0400, // 0013 CALL R7 2
0x1C1C0E04, // 0014 EQ R7 R7 R4
0x741E0001, // 0015 JMPT R7 #0018
0x1C1C0503, // 0016 EQ R7 R2 K3
0x781E0001, // 0017 JMPF R7 #001A
0xA8040001, // 0018 EXBLK 1 1
0x80040C00, // 0019 RET 1 R6
0x7001FFF3, // 001A JMP #000F
0x58140004, // 001B LDCONST R5 K4
0xAC140200, // 001C CATCH R5 1 0
0xB0080000, // 001D RAISE 2 R0 R0
0x80000000, // 001E RET 0
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[30]) { /* code */
0xA40E0000, // 0000 IMPORT R3 K0
0x8C100701, // 0001 GETMET R4 R3 K1
0x5C180400, // 0002 MOVE R6 R2
0x7C100400, // 0003 CALL R4 2
0x6014000F, // 0004 GETGBL R5 G15
0x5C180200, // 0005 MOVE R6 R1
0x601C0013, // 0006 GETGBL R7 G19
0x7C140400, // 0007 CALL R5 2
0x78160013, // 0008 JMPF R5 #001D
0x60140010, // 0009 GETGBL R5 G16
0x8C180302, // 000A GETMET R6 R1 K2
0x7C180200, // 000B CALL R6 1
0x7C140200, // 000C CALL R5 1
0xA802000B, // 000D EXBLK 0 #001A
0x5C180A00, // 000E MOVE R6 R5
0x7C180000, // 000F CALL R6 0
0x8C1C0701, // 0010 GETMET R7 R3 K1
0x5C240C00, // 0011 MOVE R9 R6
0x7C1C0400, // 0012 CALL R7 2
0x1C1C0E04, // 0013 EQ R7 R7 R4
0x741E0001, // 0014 JMPT R7 #0017
0x1C1C0503, // 0015 EQ R7 R2 K3
0x781E0001, // 0016 JMPF R7 #0019
0xA8040001, // 0017 EXBLK 1 1
0x80040C00, // 0018 RET 1 R6
0x7001FFF3, // 0019 JMP #000E
0x58140004, // 001A LDCONST R5 K4
0xAC140200, // 001B CATCH R5 1 0
0xB0080000, // 001C RAISE 2 R0 R0
0x80000000, // 001D RET 0
})
)
);
@ -1020,67 +1019,94 @@ be_local_closure(get_light, /* name */
********************************************************************/
be_local_closure(exec_rules, /* name */
be_nested_proto(
12, /* nstack */
10, /* nstack */
2, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has sup protos */
( &(const struct bproto*[ 1]) {
be_nested_proto(
8, /* nstack */
3, /* argc */
0, /* varg */
1, /* has upvals */
( &(const bupvaldesc[ 2]) { /* upvals */
be_local_const_upval(1, 0),
be_local_const_upval(1, 3),
}),
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 1]) { /* constants */
/* K0 */ be_nested_string("try_rule", 1986449405, 8),
}),
(be_nested_const_str("<lambda>", 607256038, 8)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[11]) { /* code */
0x680C0000, // 0000 GETUPV R3 U0
0x8C0C0700, // 0001 GETMET R3 R3 K0
0x68140001, // 0002 GETUPV R5 U1
0x5C180000, // 0003 MOVE R6 R0
0x5C1C0200, // 0004 MOVE R7 R1
0x7C0C0800, // 0005 CALL R3 4
0x740E0001, // 0006 JMPT R3 #0009
0x740A0000, // 0007 JMPT R2 #0009
0x50080001, // 0008 LDBOOL R2 0 1
0x50080200, // 0009 LDBOOL R2 1 0
0x80040400, // 000A RET 1 R2
})
),
}),
1, /* has constants */
( &(const bvalue[ 8]) { /* constants */
( &(const bvalue[ 7]) { /* constants */
/* K0 */ be_nested_string("_rules", -28750191, 6),
/* K1 */ be_nested_string("json", 916562499, 4),
/* K2 */ be_nested_string("load", -435725847, 4),
/* K3 */ be_nested_string("BRY: ERROR, bad json: ", -1579831487, 22),
/* K4 */ be_const_int(3),
/* K5 */ be_nested_string("keys", -112588595, 4),
/* K6 */ be_nested_string("try_rule", 1986449405, 8),
/* K7 */ be_nested_string("stop_iteration", -121173395, 14),
/* K5 */ be_nested_string("reduce", 2002030311, 6),
/* K6 */ be_nested_string("stop_iteration", -121173395, 14),
}),
(be_nested_const_str("exec_rules", 1445221092, 10)),
(be_nested_const_str("Tasmota.be", 825809411, 10)),
( &(const binstruction[40]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x780A0023, // 0001 JMPF R2 #0026
0xA40A0200, // 0002 IMPORT R2 K1
0x8C0C0502, // 0003 GETMET R3 R2 K2
0x5C140200, // 0004 MOVE R5 R1
0x7C0C0400, // 0005 CALL R3 2
0x50100000, // 0006 LDBOOL R4 0 0
0x4C140000, // 0007 LDNIL R5
0x1C140605, // 0008 EQ R5 R3 R5
0x78160004, // 0009 JMPF R5 #000F
0x60140001, // 000A GETGBL R5 G1
0x001A0601, // 000B ADD R6 K3 R1
0x581C0004, // 000C LDCONST R7 K4
0x7C140400, // 000D CALL R5 2
0x70020015, // 000E JMP #0025
0x60140010, // 000F GETGBL R5 G16
0x88180100, // 0010 GETMBR R6 R0 K0
0x8C180D05, // 0011 GETMET R6 R6 K5
0x7C180200, // 0012 CALL R6 1
0x7C140200, // 0013 CALL R5 1
0xA802000C, // 0014 EXBLK 0 #0022
0x5C180A00, // 0015 MOVE R6 R5
0x7C180000, // 0016 CALL R6 0
0x8C1C0106, // 0017 GETMET R7 R0 K6
0x5C240600, // 0018 MOVE R9 R3
0x5C280C00, // 0019 MOVE R10 R6
0x882C0100, // 001A GETMBR R11 R0 K0
0x942C1606, // 001B GETIDX R11 R11 R6
0x7C1C0800, // 001C CALL R7 4
0x741E0001, // 001D JMPT R7 #0020
0x74120000, // 001E JMPT R4 #0020
0x50100001, // 001F LDBOOL R4 0 1
0x50100200, // 0020 LDBOOL R4 1 0
0x7001FFF2, // 0021 JMP #0015
0x58140007, // 0022 LDCONST R5 K7
0xAC140200, // 0023 CATCH R5 1 0
0xB0080000, // 0024 RAISE 2 R0 R0
0x80040800, // 0025 RET 1 R4
0x50080000, // 0026 LDBOOL R2 0 0
0x80040400, // 0027 RET 1 R2
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[36]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x780A001E, // 0001 JMPF R2 #0021
0xA40A0200, // 0002 IMPORT R2 K1
0x8C0C0502, // 0003 GETMET R3 R2 K2
0x5C140200, // 0004 MOVE R5 R1
0x7C0C0400, // 0005 CALL R3 2
0x50100000, // 0006 LDBOOL R4 0 0
0x4C140000, // 0007 LDNIL R5
0x1C140605, // 0008 EQ R5 R3 R5
0x78160004, // 0009 JMPF R5 #000F
0x60140001, // 000A GETGBL R5 G1
0x001A0601, // 000B ADD R6 K3 R1
0x581C0004, // 000C LDCONST R7 K4
0x7C140400, // 000D CALL R5 2
0x7002000E, // 000E JMP #001E
0xA8020008, // 000F EXBLK 0 #0019
0x88140100, // 0010 GETMBR R5 R0 K0
0x8C140B05, // 0011 GETMET R5 R5 K5
0x841C0000, // 0012 CLOSURE R7 P0
0x4C200000, // 0013 LDNIL R8
0x50240000, // 0014 LDBOOL R9 0 0
0x7C140800, // 0015 CALL R5 4
0x5C100A00, // 0016 MOVE R4 R5
0xA8040001, // 0017 EXBLK 1 1
0x70020004, // 0018 JMP #001E
0x58140006, // 0019 LDCONST R5 K6
0xAC140200, // 001A CATCH R5 1 0
0x70020000, // 001B JMP #001D
0x70020000, // 001C JMP #001E
0xB0080000, // 001D RAISE 2 R0 R0
0xA0000000, // 001E CLOSE R0
0x80040800, // 001F RET 1 R4
0xA0080000, // 0020 CLOSE R2
0x50080000, // 0021 LDBOOL R2 0 0
0xA0000000, // 0022 CLOSE R0
0x80040400, // 0023 RET 1 R2
})
)
);
@ -1394,7 +1420,7 @@ be_local_closure(gc, /* name */
********************************************************************/
be_local_closure(event, /* name */
be_nested_proto(
20, /* nstack */
21, /* nstack */
6, /* argc */
0, /* varg */
0, /* has upvals */
@ -1402,111 +1428,116 @@ be_local_closure(event, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[19]) { /* constants */
( &(const bvalue[21]) { /* constants */
/* K0 */ be_nested_string("introspect", 164638290, 10),
/* K1 */ be_nested_string("every_50ms", -1911083288, 10),
/* K2 */ be_nested_string("run_deferred", 371594696, 12),
/* K3 */ be_nested_string("cmd", -158181397, 3),
/* K4 */ be_nested_string("exec_cmd", 493567399, 8),
/* K5 */ be_nested_string("rule", -64077613, 4),
/* K6 */ be_nested_string("exec_rules", 1445221092, 10),
/* K7 */ be_nested_string("gc", 1042313471, 2),
/* K8 */ be_nested_string("_drivers", -1034638311, 8),
/* K9 */ be_const_int(0),
/* K10 */ be_nested_string("get", 1410115415, 3),
/* K11 */ be_nested_string("function", -1630125495, 8),
/* K12 */ be_nested_string("string", 398550328, 6),
/* K13 */ be_nested_string("format", -1180859054, 6),
/* K14 */ be_nested_string("BRY: Exception> '%s' - %s", -2047976332, 25),
/* K15 */ be_const_int(1),
/* K16 */ be_nested_string("save_before_restart", 1253239338, 19),
/* K17 */ be_nested_string("persist", -377883517, 7),
/* K18 */ be_nested_string("save", -855671224, 4),
/* K1 */ be_nested_string("debug", 1483009432, 5),
/* K2 */ be_nested_string("string", 398550328, 6),
/* K3 */ be_nested_string("every_50ms", -1911083288, 10),
/* K4 */ be_nested_string("run_deferred", 371594696, 12),
/* K5 */ be_nested_string("cmd", -158181397, 3),
/* K6 */ be_nested_string("exec_cmd", 493567399, 8),
/* K7 */ be_nested_string("rule", -64077613, 4),
/* K8 */ be_nested_string("exec_rules", 1445221092, 10),
/* K9 */ be_nested_string("gc", 1042313471, 2),
/* K10 */ be_nested_string("_drivers", -1034638311, 8),
/* K11 */ be_const_int(0),
/* K12 */ be_nested_string("get", 1410115415, 3),
/* K13 */ be_nested_string("function", -1630125495, 8),
/* K14 */ be_nested_string("format", -1180859054, 6),
/* K15 */ be_nested_string("BRY: Exception> '%s' - %s", -2047976332, 25),
/* K16 */ be_nested_string("traceback", -909779187, 9),
/* K17 */ be_const_int(1),
/* K18 */ be_nested_string("save_before_restart", 1253239338, 19),
/* K19 */ be_nested_string("persist", -377883517, 7),
/* K20 */ be_nested_string("save", -855671224, 4),
}),
(be_nested_const_str("event", -30355297, 5)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[81]) { /* code */
( &(const binstruction[84]) { /* code */
0xA41A0000, // 0000 IMPORT R6 K0
0x1C1C0301, // 0001 EQ R7 R1 K1
0x781E0001, // 0002 JMPF R7 #0005
0x8C1C0102, // 0003 GETMET R7 R0 K2
0x7C1C0200, // 0004 CALL R7 1
0x501C0000, // 0005 LDBOOL R7 0 0
0x1C200303, // 0006 EQ R8 R1 K3
0x78220006, // 0007 JMPF R8 #000F
0x8C200104, // 0008 GETMET R8 R0 K4
0x5C280400, // 0009 MOVE R10 R2
0x5C2C0600, // 000A MOVE R11 R3
0x5C300800, // 000B MOVE R12 R4
0x7C200800, // 000C CALL R8 4
0x80041000, // 000D RET 1 R8
0x7002003B, // 000E JMP #004B
0x1C200305, // 000F EQ R8 R1 K5
0x78220004, // 0010 JMPF R8 #0016
0x8C200106, // 0011 GETMET R8 R0 K6
0x5C280800, // 0012 MOVE R10 R4
0x7C200400, // 0013 CALL R8 2
0x80041000, // 0014 RET 1 R8
0x70020034, // 0015 JMP #004B
0x1C200307, // 0016 EQ R8 R1 K7
0x78220003, // 0017 JMPF R8 #001C
0x8C200107, // 0018 GETMET R8 R0 K7
0x7C200200, // 0019 CALL R8 1
0x80041000, // 001A RET 1 R8
0x7002002E, // 001B JMP #004B
0x88200108, // 001C GETMBR R8 R0 K8
0x7822002C, // 001D JMPF R8 #004B
0x58200009, // 001E LDCONST R8 K9
0x6024000C, // 001F GETGBL R9 G12
0x88280108, // 0020 GETMBR R10 R0 K8
0x7C240200, // 0021 CALL R9 1
0x14241009, // 0022 LT R9 R8 R9
0x78260026, // 0023 JMPF R9 #004B
0x88240108, // 0024 GETMBR R9 R0 K8
0x94241208, // 0025 GETIDX R9 R9 R8
0x8C280D0A, // 0026 GETMET R10 R6 K10
0x5C301200, // 0027 MOVE R12 R9
0x5C340200, // 0028 MOVE R13 R1
0x7C280600, // 0029 CALL R10 3
0x602C0004, // 002A GETGBL R11 G4
0x5C301400, // 002B MOVE R12 R10
0x7C2C0200, // 002C CALL R11 1
0x1C2C170B, // 002D EQ R11 R11 K11
0x782E0019, // 002E JMPF R11 #0049
0xA802000C, // 002F EXBLK 0 #003D
0x5C2C1400, // 0030 MOVE R11 R10
0x5C301200, // 0031 MOVE R12 R9
0x5C340400, // 0032 MOVE R13 R2
0x5C380600, // 0033 MOVE R14 R3
0x5C3C0800, // 0034 MOVE R15 R4
0x5C400A00, // 0035 MOVE R16 R5
0x7C2C0A00, // 0036 CALL R11 5
0x5C1C1600, // 0037 MOVE R7 R11
0x781E0001, // 0038 JMPF R7 #003B
0xA8040001, // 0039 EXBLK 1 1
0x7002000F, // 003A JMP #004B
0xA41E0200, // 0001 IMPORT R7 K1
0xA4220400, // 0002 IMPORT R8 K2
0x1C240303, // 0003 EQ R9 R1 K3
0x78260001, // 0004 JMPF R9 #0007
0x8C240104, // 0005 GETMET R9 R0 K4
0x7C240200, // 0006 CALL R9 1
0x50240000, // 0007 LDBOOL R9 0 0
0x1C280305, // 0008 EQ R10 R1 K5
0x782A0006, // 0009 JMPF R10 #0011
0x8C280106, // 000A GETMET R10 R0 K6
0x5C300400, // 000B MOVE R12 R2
0x5C340600, // 000C MOVE R13 R3
0x5C380800, // 000D MOVE R14 R4
0x7C280800, // 000E CALL R10 4
0x80041400, // 000F RET 1 R10
0x7002003C, // 0010 JMP #004E
0x1C280307, // 0011 EQ R10 R1 K7
0x782A0004, // 0012 JMPF R10 #0018
0x8C280108, // 0013 GETMET R10 R0 K8
0x5C300800, // 0014 MOVE R12 R4
0x7C280400, // 0015 CALL R10 2
0x80041400, // 0016 RET 1 R10
0x70020035, // 0017 JMP #004E
0x1C280309, // 0018 EQ R10 R1 K9
0x782A0003, // 0019 JMPF R10 #001E
0x8C280109, // 001A GETMET R10 R0 K9
0x7C280200, // 001B CALL R10 1
0x80041400, // 001C RET 1 R10
0x7002002F, // 001D JMP #004E
0x8828010A, // 001E GETMBR R10 R0 K10
0x782A002D, // 001F JMPF R10 #004E
0x5828000B, // 0020 LDCONST R10 K11
0x602C000C, // 0021 GETGBL R11 G12
0x8830010A, // 0022 GETMBR R12 R0 K10
0x7C2C0200, // 0023 CALL R11 1
0x142C140B, // 0024 LT R11 R10 R11
0x782E0027, // 0025 JMPF R11 #004E
0x882C010A, // 0026 GETMBR R11 R0 K10
0x942C160A, // 0027 GETIDX R11 R11 R10
0x8C300D0C, // 0028 GETMET R12 R6 K12
0x5C381600, // 0029 MOVE R14 R11
0x5C3C0200, // 002A MOVE R15 R1
0x7C300600, // 002B CALL R12 3
0x60340004, // 002C GETGBL R13 G4
0x5C381800, // 002D MOVE R14 R12
0x7C340200, // 002E CALL R13 1
0x1C341B0D, // 002F EQ R13 R13 K13
0x7836001A, // 0030 JMPF R13 #004C
0xA802000C, // 0031 EXBLK 0 #003F
0x5C341800, // 0032 MOVE R13 R12
0x5C381600, // 0033 MOVE R14 R11
0x5C3C0400, // 0034 MOVE R15 R2
0x5C400600, // 0035 MOVE R16 R3
0x5C440800, // 0036 MOVE R17 R4
0x5C480A00, // 0037 MOVE R18 R5
0x7C340A00, // 0038 CALL R13 5
0x5C241A00, // 0039 MOVE R9 R13
0x78260001, // 003A JMPF R9 #003D
0xA8040001, // 003B EXBLK 1 1
0x7002000B, // 003C JMP #0049
0xAC2C0002, // 003D CATCH R11 0 2
0x70020008, // 003E JMP #0048
0xA4361800, // 003F IMPORT R13 K12
0x60380001, // 0040 GETGBL R14 G1
0x8C3C1B0D, // 0041 GETMET R15 R13 K13
0x5844000E, // 0042 LDCONST R17 K14
0x5C481600, // 0043 MOVE R18 R11
0x5C4C1800, // 0044 MOVE R19 R12
0x7C3C0800, // 0045 CALL R15 4
0x7C380200, // 0046 CALL R14 1
0x70020000, // 0047 JMP #0049
0xB0080000, // 0048 RAISE 2 R0 R0
0x0020110F, // 0049 ADD R8 R8 K15
0x7001FFD3, // 004A JMP #001F
0x1C200310, // 004B EQ R8 R1 K16
0x78220002, // 004C JMPF R8 #0050
0xA4222200, // 004D IMPORT R8 K17
0x8C241112, // 004E GETMET R9 R8 K18
0x7C240200, // 004F CALL R9 1
0x80040E00, // 0050 RET 1 R7
0x70020010, // 003C JMP #004E
0xA8040001, // 003D EXBLK 1 1
0x7002000C, // 003E JMP #004C
0xAC340002, // 003F CATCH R13 0 2
0x70020009, // 0040 JMP #004B
0x603C0001, // 0041 GETGBL R15 G1
0x8C40110E, // 0042 GETMET R16 R8 K14
0x5848000F, // 0043 LDCONST R18 K15
0x5C4C1A00, // 0044 MOVE R19 R13
0x5C501C00, // 0045 MOVE R20 R14
0x7C400800, // 0046 CALL R16 4
0x7C3C0200, // 0047 CALL R15 1
0x8C3C0F10, // 0048 GETMET R15 R7 K16
0x7C3C0200, // 0049 CALL R15 1
0x70020000, // 004A JMP #004C
0xB0080000, // 004B RAISE 2 R0 R0
0x00281511, // 004C ADD R10 R10 K17
0x7001FFD2, // 004D JMP #0021
0x1C280312, // 004E EQ R10 R1 K18
0x782A0002, // 004F JMPF R10 #0053
0xA42A2600, // 0050 IMPORT R10 K19
0x8C2C1514, // 0051 GETMET R11 R10 K20
0x7C2C0200, // 0052 CALL R11 1
0x80041200, // 0053 RET 1 R9
})
)
);

View File

@ -50,7 +50,7 @@ class Tasmota
def find_key_i(m,keyi)
import string
var keyu = string.toupper(keyi)
if classof(m) == map
if isinstance(m, map)
for k:m.keys()
if string.toupper(k)==keyu || keyi=='?'
return k
@ -149,9 +149,14 @@ class Tasmota
if ev == nil
print('BRY: ERROR, bad json: '+ev_json, 3)
else
for r: self._rules.keys()
ret = self.try_rule(ev,r,self._rules[r]) || ret
try
ret = self._rules.reduce( /k,v,r-> self.try_rule(ev,k,v) || r, nil, false)
except "stop_iteration"
# silence stop_iteration which means that the map was resized during iteration
end
# for r: self._rules.keys()
# ret = self.try_rule(ev,r,self._rules[r]) || ret
# end
end
return ret
end
@ -300,6 +305,8 @@ class Tasmota
def event(event_type, cmd, idx, payload, raw)
import introspect
import debug
import string
if event_type=='every_50ms' self.run_deferred() end #- first run deferred events -#
var done = false
@ -317,8 +324,8 @@ class Tasmota
done = f(d, cmd, idx, payload, raw)
if done break end
except .. as e,m
import string
print(string.format("BRY: Exception> '%s' - %s", e, m))
debug.traceback()
end
end
i += 1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,24 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_map_map) {
{ be_const_key(size, -1), be_const_func(m_size) },
{ be_const_key(tostring, -1), be_const_func(m_tostring) },
{ be_const_key(has, 11), be_const_func(m_has) },
{ be_const_key(init, -1), be_const_func(m_init) },
{ be_const_key(insert, -1), be_const_func(m_insert) },
{ be_const_key(size, -1), be_const_func(m_size) },
{ be_const_key(item, 4), be_const_func(m_item) },
{ be_const_key(setitem, 9), be_const_func(m_setitem) },
{ be_const_key(has, -1), be_const_func(m_has) },
{ be_const_key(keys, -1), be_const_func(m_keys) },
{ be_const_key(find, -1), be_const_func(m_find) },
{ be_const_key(dot_p, 2), be_const_var(0) },
{ be_const_key(setitem, 4), be_const_func(m_setitem) },
{ be_const_key(remove, -1), be_const_func(m_remove) },
{ be_const_key(item, 6), be_const_func(m_item) },
{ be_const_key(init, -1), be_const_func(m_init) },
{ be_const_key(remove, 5), be_const_func(m_remove) },
{ be_const_key(reduce, -1), be_const_func(m_reduce) },
{ be_const_key(iter, -1), be_const_func(m_iter) },
{ be_const_key(insert, -1), be_const_func(m_insert) },
{ be_const_key(dot_p, -1), be_const_var(0) },
{ be_const_key(find, 1), be_const_func(m_find) },
};
static be_define_const_map(
be_class_map_map,
12
13
);
BE_EXPORT_VARIABLE be_define_const_class(

View File

@ -178,11 +178,11 @@ static void sourceinfo(bproto *proto, binstruction *ip)
be_writestring(str(proto->source));
be_writestring(buf);
} else {
be_writestring("<unknow source>:");
be_writestring("<unknonw source>:");
}
#else
(void)proto; (void)ip;
be_writestring("<unknow source>:");
be_writestring("<unknonw source>:");
#endif
}

View File

@ -212,6 +212,62 @@ static int m_keys(bvm *vm)
be_return(vm);
}
/* apply a function/closure to each element of a map */
/* `map.reduce(f:function [, initializer:any]) -> any` */
/* Calls for each element `f(key, value, acc) -> any` */
/* `acc` is initialized with `initilizer` if present or `nil` */
/* the return value of the function becomes the next value passed in arg `acc` */
static int m_reduce(bvm *vm)
{
int argc = be_top(vm);
if (argc > 1 && be_isfunction(vm, 2)) {
bbool has_initializer = (argc > 2);
/* get map internal object */
be_getmember(vm, 1, ".p");
bvalue *v = be_indexof(vm, -1);
bmap *map = cast(bmap*, var_toobj(v));
/* get the number of slots if any */
int slots_initial = be_map_size(map);
/* place-holder for on-going value and return value */
if (has_initializer) {
be_pushvalue(vm, 3);
} else {
be_pushnil(vm); /* if no initializer use `nil` */
}
for (int i = 0; i < slots_initial; i++) {
bmapnode * node = map->slots + i;
if (!var_isnil(&node->key)) { /* is the key present in this slot? */
be_pushvalue(vm, 2); /* push function */
bvalue kv; /* push key on stack */
kv.type = node->key.type;
kv.v = node->key.v;
bvalue *reg = vm->top;
var_setval(reg, &kv);
be_incrtop(vm);
reg = vm->top; /* push value on stack */
var_setval(reg, &node->value);
be_incrtop(vm);
be_pushvalue(vm, -4);
be_call(vm, 3);
be_pop(vm, 3); /* pop args, keep return value */
be_remove(vm, -2); /* remove previous accumulator, keep return value from function */
}
/* check if the map has been resized during the call */
if (be_map_size(map) != slots_initial) {
be_raise(vm, "stop_iteration", "map resized within apply");
break; /* abort */
}
}
be_return(vm);
}
be_raise(vm, "value_error", "needs function as first argument");
be_return_nil(vm);
}
#if !BE_USE_PRECOMPILED_OBJECT
void be_load_maplib(bvm *vm)
{
@ -227,6 +283,7 @@ void be_load_maplib(bvm *vm)
{ "insert", m_insert },
{ "iter", m_iter },
{ "keys", m_keys },
{ "reduce", m_reduce },
{ NULL, NULL }
};
be_regclass(vm, "map", members);
@ -246,6 +303,7 @@ class be_class_map (scope: global, name: map) {
insert, func(m_insert)
iter, func(m_iter)
keys, func(m_keys)
reduce, func(m_reduce)
}
@const_object_info_end */
#include "../generate/be_fixed_be_class_map.h"

View File

@ -11,7 +11,7 @@
#include "berry.h"
/* basic types, do not change value */
#define BE_NONE (-1) /* unknow type */
#define BE_NONE (-1) /* unknown type */
#define BE_COMPTR (-2) /* common pointer */
#define BE_INDEX (-3) /* index for instance variable, previously BE_INT */
#define BE_NIL 0

View File

@ -101,7 +101,7 @@ static bstring* sim2str(bvm *vm, bvalue *v)
sprintf(sbuf, "<ptr: %p>", var_toobj(v));
break;
default:
strcpy(sbuf, "(unknow value)");
strcpy(sbuf, "(unknown value)");
break;
}
return be_newstr(vm, sbuf);
@ -221,7 +221,7 @@ const char* be_pushvfstr(bvm *vm, const char *format, va_list arg)
break;
}
default:
pushstr(vm, "(unknow)", 8);
pushstr(vm, "(unknown)", 8);
break;
}
concat2(vm);

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Pekelwaterpomp"
#define D_NEOPOOL_TIME "Tyd"
#define D_NEOPOOL_FILT_MODE "Filtrasie"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Oké"

View File

@ -1063,6 +1063,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Salzwasserpumpe"
#define D_NEOPOOL_TIME "Zeit"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Laufzeit Zelle"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrAus"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v9.5.0.3
* Updated until v9.5.0.9
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@ -947,11 +947,11 @@
#define D_MANAGE_FILE_SYSTEM "Explorar Archivos"
#define D_FS_SIZE "Tamaño"
#define D_FS_FREE "Libre"
#define D_NEW_FILE "nuevo.txt"
#define D_CREATE_NEW_FILE "Crear y editar un archivo nuevo"
#define D_NEW_FILE "Nuevo.txt"
#define D_CREATE_NEW_FILE "Crear un archivo nuevo"
#define D_EDIT_FILE "Editar Archivo"
#define D_CONFIRM_FILE_DEL "Confirmar la eliminación del archivo"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
#define D_CONFIRM_FILE_DEL "Confirmar eliminación del archivo"
#define D_SHOW_HIDDEN_FILES "Mostrar archivos ocultos"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "Ganancia:"
@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Bomba de Salmuera"
#define D_NEOPOOL_TIME "Tiempo"
#define D_NEOPOOL_FILT_MODE "Filtrado"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v9.3.1.1
* Updated until v9.5.0.9
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@ -1063,6 +1063,7 @@
#define D_NEOPOOL_RELAY_CD "Pompe Brome"
#define D_NEOPOOL_TIME "Durée"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "OK"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Idő"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v9.5.0.3 - Last update 31.08.2021
* Updated until v9.5.0.9 - Last update 11.10.2021
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@ -766,7 +766,7 @@
#define D_SENSOR_LE01MR_TX "LE-01MR - TX"
#define D_SENSOR_BL0940_RX "BL0940 - RX"
#define D_SENSOR_BL0939_RX "BL0939 - RX"
#define D_SENSOR_BL0942_RX "BL0942 Rx"
#define D_SENSOR_BL0942_RX "BL0942 - RX"
#define D_SENSOR_CC1101_GDO0 "CC1101 - GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 - GDO2"
#define D_SENSOR_HRXL_RX "HRXL - RX"
@ -951,7 +951,7 @@
#define D_CREATE_NEW_FILE "Crea e modifica nuovo file"
#define D_EDIT_FILE "Modifica file"
#define D_CONFIRM_FILE_DEL "Conferma eliminazione file"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
#define D_SHOW_HIDDEN_FILES "Visualizza file nascosti"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "guadagno:"
@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Pompa salamoia"
#define D_NEOPOOL_TIME "Orario"
#define D_NEOPOOL_FILT_MODE "Filtrazione"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "OK"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v9.5.0.3
* Updated until v9.5.0.9
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@ -944,14 +944,14 @@
#define D_SCRIPT_UPLOAD_FILES "Enviar arquivos"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_MANAGE_FILE_SYSTEM "Gerenciar sistema de arquivos"
#define D_FS_SIZE "Tamanho"
#define D_FS_FREE "Livre"
#define D_NEW_FILE "newfile.txt"
#define D_CREATE_NEW_FILE "Criar e editar um novo arquivo"
#define D_NEW_FILE "Newfile.txt"
#define D_CREATE_NEW_FILE "Criar um novo arquivo"
#define D_EDIT_FILE "Editar arquivo"
#define D_CONFIRM_FILE_DEL "Confirmar remoção do arquivo"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
#define D_SHOW_HIDDEN_FILES "Mostrar arquivos ocultos"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "ganho:"
@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Bomba de salmora"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtragem"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v9.5.0.3
* Updated until v9.5.0.9
\*********************************************************************/
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@ -944,14 +944,14 @@
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
#define D_NEW_FILE "newfile.txt"
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
#define D_MANAGE_FILE_SYSTEM "Gerenciar sistema de arquivos"
#define D_FS_SIZE "Tamanho"
#define D_FS_FREE "Livre"
#define D_NEW_FILE "Newfile.txt"
#define D_CREATE_NEW_FILE "Criar um novo arquivo"
#define D_EDIT_FILE "Editar arquivo"
#define D_CONFIRM_FILE_DEL "Confirmar remoção do arquivo"
#define D_SHOW_HIDDEN_FILES "Mostrar arquivos ocultos"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -1064,6 +1064,7 @@
#define D_NEOPOOL_RELAY_CD "Brine pump"
#define D_NEOPOOL_TIME "Time"
#define D_NEOPOOL_FILT_MODE "Filtration"
#define D_NEOPOOL_CELL_RUNTIME "Cell runtime"
#define D_NEOPOOL_POLARIZATION "Pol" // Sensor status
#define D_NEOPOOL_PR_OFF "PrOff"
#define D_NEOPOOL_SETPOINT_OK "Ok"

View File

@ -992,7 +992,7 @@
// #define USE_WEBCLIENT_HTTPS // Enable HTTPS outgoing requests based on BearSSL (much ligher then mbedTLS, 42KB vs 150KB) in insecure mode (no verification of server's certificate)
// Note that only one cipher is enabled: ECDHE_RSA_WITH_AES_128_GCM_SHA256 which is very commonly used and highly secure
#define USE_BERRY_WEBCLIENT_USERAGENT "TasmotaClient" // default user-agent used, can be changed with `wc.set_useragent()`
#define USE_BERRY_WEBCLIENT_TIMEOUT 5000 // Default timeout in milliseconds
#define USE_BERRY_WEBCLIENT_TIMEOUT 2000 // Default timeout in milliseconds
#define USE_CSE7761 // Add support for CSE7761 Energy monitor as used in Sonoff Dual R3
// -- LVGL Graphics Library ---------------------------------

View File

@ -111,18 +111,18 @@ void DeviceGroupsInit(void)
if (!device_group_count) {
// If relays in separate device groups is enabled, set the device group count to highest numbered
// relay.
// button.
if (Settings->flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups
for (uint32_t relay_index = 0; relay_index < MAX_RELAYS; relay_index++) {
if (PinUsed(GPIO_REL1, relay_index)) device_group_count = relay_index + 1;
}
if (device_group_count > MAX_DEV_GROUP_NAMES) device_group_count = MAX_DEV_GROUP_NAMES;
}
// Otherwise, set the device group count to 1.
else {
// Set up a minimum of one device group.
if (!device_group_count)
device_group_count = 1;
}
else if (device_group_count > MAX_DEV_GROUP_NAMES)
device_group_count = MAX_DEV_GROUP_NAMES;
}
// If there are more device group names set than the number of device groups needed by the

View File

@ -78,6 +78,10 @@
// Structs
#include "settings.h"
#ifdef CONFIG_IDF_TARGET_ESP32
#include "soc/efuse_reg.h"
#endif
/*********************************************************************************************\
* Global variables
\*********************************************************************************************/
@ -222,6 +226,18 @@ void setup(void) {
#endif
#endif
#ifdef CONFIG_IDF_TARGET_ESP32
// restore GPIO16/17 if no PSRAM is found
if (!FoundPSRAM()) {
// test if the CPU is not pico
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_version = chip_ver & 0x7;
if (pkg_version <= 3) { // D0WD, S0WD, D2WD
gpio_reset_pin(GPIO_NUM_16);
gpio_reset_pin(GPIO_NUM_17);
}
}
#endif
RtcPreInit();
SettingsInit();

View File

@ -2200,7 +2200,7 @@ void CmndEvent(void)
if (XdrvMailbox.data_len > 0) {
strlcpy(Rules.event_data, XdrvMailbox.data, sizeof(Rules.event_data));
#ifdef USE_DEVICE_GROUPS
SendDeviceGroupMessage(1, DGR_MSGTYP_UPDATE, DGR_ITEM_EVENT, XdrvMailbox.data);
if (!XdrvMailbox.grpflg) SendDeviceGroupMessage(1, DGR_MSGTYP_UPDATE, DGR_ITEM_EVENT, XdrvMailbox.data);
#endif // USE_DEVICE_GROUPS
}
if (XdrvMailbox.command) ResponseCmndDone();

View File

@ -235,18 +235,28 @@ extern "C" {
be_return(vm); /* return code */
}
void wc_errorCodeMessage(int32_t httpCode, uint32_t http_connect_time) {
if (httpCode < 0) {
if (httpCode <= -1000) {
AddLog(LOG_LEVEL_INFO, D_LOG_HTTP "TLS connection error %d after %d ms", -httpCode - 1000, millis() - http_connect_time);
} else if (httpCode == -1) {
AddLog(LOG_LEVEL_INFO, D_LOG_HTTP "Connection timeout after %d ms", httpCode, millis() - http_connect_time);
} else {
AddLog(LOG_LEVEL_INFO, D_LOG_HTTP "Connection error %d after %d ms", httpCode, millis() - http_connect_time);
}
} else {
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "Connected in %d ms, stack low mark %d"),
millis() - http_connect_time, uxTaskGetStackHighWaterMark(nullptr));
}
}
// cw.GET(void) -> httpCode:int
int32_t wc_GET(struct bvm *vm);
int32_t wc_GET(struct bvm *vm) {
HTTPClientLight * cl = wc_getclient(vm);
uint32_t http_connect_time = millis();
int32_t httpCode = cl->GET();
if (httpCode <= -1000) {
AddLog(LOG_LEVEL_INFO, D_LOG_HTTP "TLS connection error: %d", -httpCode - 1000);
} else {
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "TLS connected in %d ms, stack low mark %d"),
millis() - http_connect_time, uxTaskGetStackHighWaterMark(nullptr));
}
wc_errorCodeMessage(httpCode, http_connect_time);
be_pushint(vm, httpCode);
be_return(vm); /* return code */
}
@ -267,12 +277,7 @@ extern "C" {
}
uint32_t http_connect_time = millis();
int32_t httpCode = cl->POST((uint8_t*)buf, buf_len);
if (httpCode <= -1000) {
AddLog(LOG_LEVEL_INFO, D_LOG_HTTP "TLS connection error: %d", -httpCode - 1000);
} else {
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "TLS connected in %d ms, stack low mark %d"),
millis() - http_connect_time, uxTaskGetStackHighWaterMark(nullptr));
}
wc_errorCodeMessage(httpCode, http_connect_time);
be_pushint(vm, httpCode);
be_return(vm); /* return code */
}

View File

@ -105,6 +105,9 @@ enum NeoPoolRegister {
MBF_HIDRO_VOLTAGE, // 0x0111 Reports on the stress applied to the hydrolysis cell. This register, together with that of MBF_HIDRO_CURRENT allows extrapolating the salinity of the water.
// GLOBAL page (0x02xx)
MBF_CELL_RUNTIME_LOW = 0x0206, // 0x0206* undocumented - cell runtime (32 bit) - low word
MBF_CELL_RUNTIME_HIGH = 0x0207, // 0x0207* undocumented - cell runtime (32 bit) - high word
MBF_BOOST_CTRL = 0x020C, // 0x020C undocumented - 0x0000 = Boost Off, 0x05A0 = Boost with redox ctrl, 0x85A0 = Boost without redox ctrl
MBF_SET_MANUAL_CTRL = 0x0289, // 0x0289 undocumented - write a 1 before manual control MBF_RELAY_STATE, after done write 0 and do MBF_EXEC
MBF_ESCAPE = 0x0297, // 0x0297 undocumented - A write operation to this register is the same as using the ESC button on main screen - clears error
MBF_SAVE_TO_EEPROM = 0x02F0, // 0x02F0 A write operation to this register starts a EEPROM storage operation immediately. During the EEPROM storage procedure, the system may be unresponsive to MODBUS requests. The operation will last always less than 1 second.
@ -549,6 +552,9 @@ bool neopool_first_read = true;
#endif // NEOPOOL_OPTIMIZE_READINGS
bool neopool_error = true;
#define NEOPOOL_MAX_REPEAT_ON_ERROR 10
uint8_t neopool_repeat_on_error = 2;
uint16_t neopool_light_relay;
uint8_t neopool_light_prg_delay;
uint8_t neopoll_cmd_delay = 0;
@ -577,8 +583,9 @@ struct {
NeoPoolRegList list[];
};
} NeoPoolReg[] = {
// 4 entries so using 250ms poll interval we are through in a second for all register
// 6 entries so using 250ms poll interval we are through in 1,5 for all register
{NEOPOOL_REG_TYPE_BLOCK, {MBF_ION_CURRENT, MBF_NOTIFICATION - MBF_ION_CURRENT + 1, nullptr}},
{NEOPOOL_REG_TYPE_BLOCK, {MBF_CELL_RUNTIME_LOW, MBF_CELL_RUNTIME_HIGH - MBF_CELL_RUNTIME_LOW + 1, nullptr}},
{NEOPOOL_REG_TYPE_BLOCK, {MBF_PAR_VERSION, MBF_PAR_MODEL - MBF_PAR_VERSION + 1, nullptr}},
{NEOPOOL_REG_TYPE_BLOCK, {MBF_PAR_TIME_LOW, MBF_PAR_FILT_GPIO - MBF_PAR_TIME_LOW + 1, nullptr}},
{NEOPOOL_REG_TYPE_BLOCK, {MBF_PAR_ION, MBF_PAR_FILTRATION_TYPE - MBF_PAR_ION + 1, nullptr}},
@ -681,6 +688,7 @@ const char HTTP_SNS_NEOPOOL_CONDUCTIVITY[] PROGMEM = "{s}%s " D_NEOPOOL_COND
const char HTTP_SNS_NEOPOOL_IONIZATION[] PROGMEM = "{s}%s " D_NEOPOOL_IONIZATION "{m}" NEOPOOL_FMT_ION " " "%s%s" "{e}";
const char HTTP_SNS_NEOPOOL_FILT_MODE[] PROGMEM = "{s}%s " D_NEOPOOL_FILT_MODE "{m}%s" "{e}";
const char HTTP_SNS_NEOPOOL_RELAY[] PROGMEM = "{s}%s " "%s" "{m}%s" "{e}";
const char HTTP_SNS_NEOPOOL_CELL_RUNTIME[] PROGMEM = "{s}%s " D_NEOPOOL_CELL_RUNTIME "{m}%s" "{e}";
const char HTTP_SNS_NEOPOOL_STATUS[] PROGMEM = "<span style=\"background-color:%s;font-size:small;text-align:center;%s;\">&nbsp;%s&nbsp;</span>";
const char HTTP_SNS_NEOPOOL_STATUS_NORMAL[] PROGMEM = "filter:invert(0.1)";
@ -730,9 +738,15 @@ const char HTTP_SNS_NEOPOOL_STATUS_ACTIVE[] PROGMEM = "filter:invert(1)";
*
* NPResult {<format>}
* get/set addr/data result format read/write commands (format = 0|1):
* get output format if <format> is omitted, otherwise
* 0 - output as decimal numbers
* 1 - output as hexadecimal strings (default)
* get output format if <format> is omitted, otherwise
*
* NPOnError {<repeat>}
* get/set auto-repeat Modbus read/write commands on error (repeat = 0..10):
* get auto-repeat setting if <repeat> is omitted, otherwise
* 0 - disable auto-repeat on read/write error
* 1..10 - repeat commands n times until ok
*
* NPPHRes {<digits>}
* NPCLRes {<digits>}
@ -830,6 +844,7 @@ const char HTTP_SNS_NEOPOOL_STATUS_ACTIVE[] PROGMEM = "filter:invert(1)";
#define D_CMND_NP_SAVE "Save"
#define D_CMND_NP_EXEC "Exec"
#define D_CMND_NP_ESCAPE "Escape"
#define D_CMND_NP_ONERROR "OnError"
#define D_CMND_NP_PHRES "PHRes"
#define D_CMND_NP_CLRES "CLRes"
#define D_CMND_NP_IONRES "IONRes"
@ -849,6 +864,7 @@ const char kNPCommands[] PROGMEM = D_PRFX_NEOPOOL "|" // Prefix
D_CMND_NP_SAVE "|"
D_CMND_NP_EXEC "|"
D_CMND_NP_ESCAPE "|"
D_CMND_NP_ONERROR "|"
D_CMND_NP_PHRES "|"
D_CMND_NP_CLRES "|"
D_CMND_NP_IONRES
@ -869,6 +885,7 @@ void (* const NPCommand[])(void) PROGMEM = {
&CmndNeopoolSave,
&CmndNeopoolExec,
&CmndNeopoolEscape,
&CmndNeopoolOnError,
&CmndNeopoolPHRes,
&CmndNeopoolCLRes,
&CmndNeopoolIONRes
@ -1051,7 +1068,7 @@ void NeoPool250msSetStatus(bool status)
}
uint8_t NeoPoolReadRegister(uint16_t addr, uint16_t *data, uint16_t cnt)
uint8_t NeoPoolReadRegisterData(uint16_t addr, uint16_t *data, uint16_t cnt)
{
bool data_ready;
uint32_t timeoutMS;
@ -1099,7 +1116,7 @@ uint8_t NeoPoolReadRegister(uint16_t addr, uint16_t *data, uint16_t cnt)
}
uint8_t NeoPoolWriteRegister(uint16_t addr, uint16_t *data, uint16_t cnt)
uint8_t NeoPoolWriteRegisterData(uint16_t addr, uint16_t *data, uint16_t cnt)
{
uint8_t *frame;
uint32_t numbytes;
@ -1176,6 +1193,30 @@ uint8_t NeoPoolWriteRegister(uint16_t addr, uint16_t *data, uint16_t cnt)
}
uint8_t NeoPoolReadRegister(uint16_t addr, uint16_t *data, uint16_t cnt)
{
uint8_t repeat = neopool_repeat_on_error;
uint8_t result;
do {
result = NeoPoolReadRegisterData(addr, data, cnt);
SleepDelay(0);
} while(repeat-- > 0 || NEOPOOL_MODBUS_OK != result);
return result;
}
uint8_t NeoPoolWriteRegister(uint16_t addr, uint16_t *data, uint16_t cnt)
{
uint8_t repeat = neopool_repeat_on_error;
uint8_t result;
do {
result = NeoPoolWriteRegisterData(addr, data, cnt);
SleepDelay(0);
} while(repeat-- > 0 || NEOPOOL_MODBUS_OK != result);
return result;
}
uint8_t NeoPoolWriteRegisterWord(uint16_t addr, uint16_t data)
{
return NeoPoolWriteRegister(addr, &data, 1);
@ -1217,6 +1258,7 @@ uint32_t NeoPoolGetSpeedIndex(uint16_t speedvalue)
#define D_NEOPOOL_JSON_FILTRATION_MODE "Mode"
#define D_NEOPOOL_JSON_FILTRATION_SPEED "Speed"
#define D_NEOPOOL_JSON_HYDROLYSIS "Hydrolysis"
#define D_NEOPOOL_JSON_CELL_RUNTIME "Runtime"
#define D_NEOPOOL_JSON_IONIZATION "Ionization"
#define D_NEOPOOL_JSON_LIGHT "Light"
#define D_NEOPOOL_JSON_LIGHT_MODE "Mode"
@ -1345,6 +1387,11 @@ void NeoPoolShow(bool json)
ResponseAppend_P(PSTR(",\"" D_NEOPOOL_JSON_HYDROLYSIS "\":{\"" D_JSON_DATA "\":" NEOPOOL_FMT_HIDRO), dec, &fvalue);
ResponseAppend_P(PSTR(",\"" D_NEOPOOL_JSON_UNIT "\":\"%s\""), sunit);
#ifndef NEOPOOL_OPTIMIZE_READINGS
ResponseAppend_P(PSTR(",\"" D_NEOPOOL_JSON_CELL_RUNTIME "\":\"%s\""),
GetDuration((uint32_t)NeoPoolGetData(MBF_CELL_RUNTIME_LOW) + ((uint32_t)NeoPoolGetData(MBF_CELL_RUNTIME_HIGH) << 16)).c_str());
#endif // NEOPOOL_OPTIMIZE_READINGS
// S1
const char *state = PSTR("");
if (0 == (NeoPoolGetData(MBF_HIDRO_STATUS) & MBMSK_HIDRO_STATUS_MODULE_ACTIVE)) {
@ -1419,13 +1466,15 @@ void NeoPoolShow(bool json)
);
#ifndef NEOPOOL_OPTIMIZE_READINGS
// Time
char dt[20];
TIME_T tmpTime;
BreakTime((uint32_t)NeoPoolGetData(MBF_PAR_TIME_LOW) + ((uint32_t)NeoPoolGetData(MBF_PAR_TIME_HIGH) << 16), tmpTime);
snprintf_P(dt, sizeof(dt), PSTR("%04d-%02d-%02d %02d:%02d"),
tmpTime.year +1970, tmpTime.month, tmpTime.day_of_month, tmpTime.hour, tmpTime.minute);
WSContentSend_PD(HTTP_SNS_NEOPOOL_TIME, neopool_type, dt);
{
// Time
char dt[20];
TIME_T tmpTime;
BreakTime((uint32_t)NeoPoolGetData(MBF_PAR_TIME_LOW) + ((uint32_t)NeoPoolGetData(MBF_PAR_TIME_HIGH) << 16), tmpTime);
snprintf_P(dt, sizeof(dt), PSTR("%04d-%02d-%02d %02d:%02d"),
tmpTime.year +1970, tmpTime.month, tmpTime.day_of_month, tmpTime.hour, tmpTime.minute);
WSContentSend_PD(HTTP_SNS_NEOPOOL_TIME, neopool_type, dt);
}
#endif // NEOPOOL_OPTIMIZE_READINGS
// Temperature
@ -1598,6 +1647,18 @@ void NeoPoolShow(bool json)
WSContentSend_PD(HTTP_SNS_NEOPOOL_RELAY,neopool_type, sdesc,
'\0' == *stemp ? ((NeoPoolGetData(MBF_RELAY_STATE) & (1<<i))?PSTR(D_ON):PSTR(D_OFF)) : stemp);
}
#ifndef NEOPOOL_OPTIMIZE_READINGS
{
// Cell runtime
char dt[16];
TIME_T tmpTime;
BreakTime((uint32_t)NeoPoolGetData(MBF_CELL_RUNTIME_LOW) + ((uint32_t)NeoPoolGetData(MBF_CELL_RUNTIME_HIGH) << 16), tmpTime);
snprintf_P(dt, sizeof(dt), PSTR("%dT%02d:%02d"), tmpTime.days, tmpTime.hour, tmpTime.minute);
WSContentSend_PD(HTTP_SNS_NEOPOOL_CELL_RUNTIME, neopool_type, dt);
}
#endif // NEOPOOL_OPTIMIZE_READINGS
#endif // USE_WEBSERVER
}
}
@ -2011,6 +2072,15 @@ void CmndNeopoolEscape(void)
}
void CmndNeopoolOnError(void)
{
if (XdrvMailbox.data_len && XdrvMailbox.payload >= 0 && XdrvMailbox.payload <= NEOPOOL_MAX_REPEAT_ON_ERROR) {
neopool_repeat_on_error = XdrvMailbox.payload;
}
ResponseCmndNumber(neopool_repeat_on_error);
}
void CmndNeopoolPHRes(void)
{
if (XdrvMailbox.data_len && XdrvMailbox.payload >= 0 && XdrvMailbox.payload <= 3) {