Merge branch 'development' into pre-release-10.0.0

This commit is contained in:
Theo Arends 2021-10-18 17:01:46 +02:00
commit 8d61740a9f
12 changed files with 1720 additions and 1676 deletions

View File

@ -27,6 +27,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- ESP32 restore GPIO16/17 if no PSRAM was found regression from v9.5.0.3
- Restore functionality as documented when both GPIO_LED1 and GPIO_LED2 are used regression from v8.5.0 (#13368)
## [9.5.0.8] 20210927
### Added

View File

@ -200,6 +200,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Hass and Tasmota discovery prefix topic notifications [#12972](https://github.com/arendst/Tasmota/issues/12972)
- OpenTherm invalid JSON [#13028](https://github.com/arendst/Tasmota/issues/13028)
- MQTT TLS related connection timing errors [#13033](https://github.com/arendst/Tasmota/issues/13033)
- Restore functionality as documented when both GPIO_LED1 and GPIO_LED2 are used regression from v8.5.0 [#13368](https://github.com/arendst/Tasmota/issues/13368)
- ESP32 core v2.0.0 setting hostname
- ESP32-C3 settings layout for configuration backup and restore
- ESP32-Solo OTA upgrade

View File

@ -625,7 +625,7 @@ be_local_closure(run_deferred, /* name */
********************************************************************/
be_local_closure(cmd, /* name */
be_nested_proto(
7, /* nstack */
5, /* nstack */
2, /* argc */
0, /* varg */
0, /* has upvals */
@ -633,35 +633,27 @@ be_local_closure(cmd, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 5]) { /* constants */
/* K0 */ be_nested_string("json", 916562499, 4),
( &(const bvalue[ 2]) { /* constants */
/* K0 */ be_nested_string("cmd_res", 921166762, 7),
/* K1 */ be_nested_string("_cmd", -875145154, 4),
/* K2 */ be_nested_string("load", -435725847, 4),
/* K3 */ be_nested_string("instance", 193386898, 8),
/* K4 */ be_nested_string("response", 1499316702, 8),
}),
(be_nested_const_str("cmd", -158181397, 3)),
(be_nested_const_str("Tasmota.be", 825809411, 10)),
( &(const binstruction[19]) { /* code */
0xA40A0000, // 0000 IMPORT R2 K0
0x8C0C0101, // 0001 GETMET R3 R0 K1
0x5C140200, // 0002 MOVE R5 R1
0x7C0C0400, // 0003 CALL R3 2
0x8C100502, // 0004 GETMET R4 R2 K2
0x5C180600, // 0005 MOVE R6 R3
0x7C100400, // 0006 CALL R4 2
0x60140004, // 0007 GETGBL R5 G4
0x5C180800, // 0008 MOVE R6 R4
0x7C140200, // 0009 CALL R5 1
0x1C140B03, // 000A EQ R5 R5 K3
0x78160001, // 000B JMPF R5 #000E
0x80040800, // 000C RET 1 R4
0x70020003, // 000D JMP #0012
0x60140013, // 000E GETGBL R5 G19
0x7C140000, // 000F CALL R5 0
0x98160804, // 0010 SETIDX R5 K4 R4
0x80040A00, // 0011 RET 1 R5
0x80000000, // 0012 RET 0
(be_nested_const_str("tasmota.be", 1128870755, 10)),
( &(const binstruction[14]) { /* code */
0x50080200, // 0000 LDBOOL R2 1 0
0x90020002, // 0001 SETMBR R0 K0 R2
0x8C080101, // 0002 GETMET R2 R0 K1
0x5C100200, // 0003 MOVE R4 R1
0x7C080400, // 0004 CALL R2 2
0x4C080000, // 0005 LDNIL R2
0x880C0100, // 0006 GETMBR R3 R0 K0
0x50100200, // 0007 LDBOOL R4 1 0
0x200C0604, // 0008 NE R3 R3 R4
0x780E0000, // 0009 JMPF R3 #000B
0x88080100, // 000A GETMBR R2 R0 K0
0x4C0C0000, // 000B LDNIL R3
0x90020003, // 000C SETMBR R0 K0 R3
0x80040400, // 000D RET 1 R2
})
)
);
@ -1042,7 +1034,7 @@ be_local_closure(exec_rules, /* name */
/* K0 */ be_nested_string("try_rule", 1986449405, 8),
}),
(be_nested_const_str("<lambda>", 607256038, 8)),
(be_nested_const_str("input", -103256197, 5)),
(be_nested_const_str("tasmota.be", 1128870755, 10)),
( &(const binstruction[11]) { /* code */
0x680C0000, // 0000 GETUPV R3 U0
0x8C0C0700, // 0001 GETMET R3 R3 K0
@ -1059,20 +1051,22 @@ be_local_closure(exec_rules, /* name */
),
}),
1, /* has constants */
( &(const bvalue[ 7]) { /* constants */
( &(const bvalue[ 9]) { /* 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("reduce", 2002030311, 6),
/* K6 */ be_nested_string("stop_iteration", -121173395, 14),
/* K3 */ be_nested_string("log", 1062293841, 3),
/* K4 */ be_nested_string("BRY: ERROR, bad json: ", -1579831487, 22),
/* K5 */ be_const_int(3),
/* K6 */ be_nested_string("cmd_res", 921166762, 7),
/* K7 */ be_nested_string("reduce", 2002030311, 6),
/* K8 */ be_nested_string("stop_iteration", -121173395, 14),
}),
(be_nested_const_str("exec_rules", 1445221092, 10)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[36]) { /* code */
(be_nested_const_str("tasmota.be", 1128870755, 10)),
( &(const binstruction[41]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x780A001E, // 0001 JMPF R2 #0021
0x780A0023, // 0001 JMPF R2 #0026
0xA40A0200, // 0002 IMPORT R2 K1
0x8C0C0502, // 0003 GETMET R3 R2 K2
0x5C140200, // 0004 MOVE R5 R1
@ -1081,32 +1075,37 @@ be_local_closure(exec_rules, /* name */
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
0x8C140103, // 000A GETMET R5 R0 K3
0x001E0801, // 000B ADD R7 K4 R1
0x58200005, // 000C LDCONST R8 K5
0x7C140600, // 000D CALL R5 3
0x5C0C0200, // 000E MOVE R3 R1
0x88140106, // 000F GETMBR R5 R0 K6
0x4C180000, // 0010 LDNIL R6
0x20140A06, // 0011 NE R5 R5 R6
0x78160000, // 0012 JMPF R5 #0014
0x90020C03, // 0013 SETMBR R0 K6 R3
0xA8020008, // 0014 EXBLK 0 #001E
0x88140100, // 0015 GETMBR R5 R0 K0
0x8C140B07, // 0016 GETMET R5 R5 K7
0x841C0000, // 0017 CLOSURE R7 P0
0x4C200000, // 0018 LDNIL R8
0x50240000, // 0019 LDBOOL R9 0 0
0x7C140800, // 001A CALL R5 4
0x5C100A00, // 001B MOVE R4 R5
0xA8040001, // 001C EXBLK 1 1
0x70020004, // 001D JMP #0023
0x58140008, // 001E LDCONST R5 K8
0xAC140200, // 001F CATCH R5 1 0
0x70020000, // 0020 JMP #0022
0x70020000, // 0021 JMP #0023
0xB0080000, // 0022 RAISE 2 R0 R0
0xA0000000, // 0023 CLOSE R0
0x80040800, // 0024 RET 1 R4
0xA0080000, // 0025 CLOSE R2
0x50080000, // 0026 LDBOOL R2 0 0
0xA0000000, // 0027 CLOSE R0
0x80040400, // 0028 RET 1 R2
})
)
);
@ -1654,6 +1653,7 @@ class be_class_tasmota (scope: global, name: Tasmota) {
wire1, var
wire2, var
global, var
cmd_res, var
_global_def, comptr(&be_tasmota_global_struct)
_global_addr, comptr(&TasmotaGlobal)

View File

@ -17,6 +17,14 @@ end
tasmota = nil
class Tasmota
var _rules
var _timers
var _ccmd
var _drivers
var _cb
var wire1
var wire2
var cmd_res # store the command result, nil if disables, true if capture enabled, contains return value
var global # mapping to TasmotaGlobal
def init()
@ -144,19 +152,21 @@ class Tasmota
def exec_rules(ev_json)
if self._rules
import json
var ev = json.load(ev_json)
var ev = json.load(ev_json) # returns nil if invalid JSON
var ret = false
if ev == nil
print('BRY: ERROR, bad json: '+ev_json, 3)
else
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
self.log('BRY: ERROR, bad json: '+ev_json, 3)
ev = ev_json # revert to string
end
# record the rule payload for tasmota.cmd()
if self.cmd_res != nil
self.cmd_res = ev
end
# try all rule handlers
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
return ret
end
@ -360,14 +370,17 @@ class Tasmota
# cmd high-level function
def cmd(command)
import json
var ret = self._cmd(command)
var j = json.load(ret)
if type(j) == 'instance'
return j
else
return {'response':j}
self.cmd_res = true # signal buffer capture
self._cmd(command)
var ret = nil
if self.cmd_res != true # unchanged
ret = self.cmd_res
end
self.cmd_res = nil # clear buffer
return ret
end
# set_light and get_light deprecetaion

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,84 +1,85 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_tasmota_map) {
{ be_const_key(cb_dispatch, -1), be_const_closure(cb_dispatch_closure) },
{ be_const_key(get_option, -1), be_const_func(l_getoption) },
{ be_const_key(publish_result, 63), be_const_func(l_publish_result) },
{ be_const_key(try_rule, 18), be_const_closure(try_rule_closure) },
{ be_const_key(eth, 26), be_const_func(l_eth) },
{ be_const_key(resp_cmnd, -1), be_const_func(l_respCmnd) },
{ be_const_key(_cmd, -1), be_const_func(l_cmd) },
{ be_const_key(exec_cmd, -1), be_const_closure(exec_cmd_closure) },
{ be_const_key(add_cmd, -1), be_const_closure(add_cmd_closure) },
{ be_const_key(resolvecmnd, -1), be_const_func(l_resolveCmnd) },
{ be_const_key(find_op, -1), be_const_closure(find_op_closure) },
{ be_const_key(add_driver, 40), be_const_closure(add_driver_closure) },
{ be_const_key(remove_rule, 4), be_const_closure(remove_rule_closure) },
{ be_const_key(load, -1), be_const_closure(load_closure) },
{ be_const_key(response_append, -1), be_const_func(l_respAppend) },
{ be_const_key(wire1, 20), be_const_var(0) },
{ be_const_key(set_light, -1), be_const_closure(set_light_closure) },
{ be_const_key(time_reached, 3), be_const_func(l_timereached) },
{ be_const_key(log, -1), be_const_func(l_logInfo) },
{ be_const_key(gc, -1), be_const_closure(gc_closure) },
{ be_const_key(init, 8), be_const_closure(init_closure) },
{ be_const_key(get_free_heap, -1), be_const_func(l_getFreeHeap) },
{ be_const_key(global, 36), be_const_var(1) },
{ be_const_key(event, -1), be_const_closure(event_closure) },
{ be_const_key(time_str, 45), be_const_closure(time_str_closure) },
{ be_const_key(response_append, 44), be_const_func(l_respAppend) },
{ be_const_key(add_rule, -1), be_const_closure(add_rule_closure) },
{ be_const_key(resp_cmnd_str, 10), be_const_func(l_respCmndStr) },
{ be_const_key(_cb, 33), be_const_var(0) },
{ be_const_key(set_timer, 66), be_const_closure(set_timer_closure) },
{ be_const_key(publish, -1), be_const_func(l_publish) },
{ be_const_key(set_power, -1), be_const_func(l_setpower) },
{ be_const_key(rtc, 42), be_const_func(l_rtc) },
{ be_const_key(millis, -1), be_const_func(l_millis) },
{ be_const_key(save, -1), be_const_func(l_save) },
{ be_const_key(add_cmd, 32), be_const_closure(add_cmd_closure) },
{ be_const_key(find_key_i, -1), be_const_closure(find_key_i_closure) },
{ be_const_key(chars_in_string, 35), be_const_closure(chars_in_string_closure) },
{ be_const_key(gen_cb, 48), be_const_closure(gen_cb_closure) },
{ be_const_key(set_light, -1), be_const_closure(set_light_closure) },
{ be_const_key(resp_cmnd_error, -1), be_const_func(l_respCmndError) },
{ be_const_key(resp_cmnd_str, -1), be_const_func(l_respCmndStr) },
{ be_const_key(strftime, -1), be_const_func(l_strftime) },
{ be_const_key(wifi, -1), be_const_func(l_wifi) },
{ be_const_key(_drivers, -1), be_const_var(2) },
{ be_const_key(chars_in_string, -1), be_const_closure(chars_in_string_closure) },
{ be_const_key(_cb, 0), be_const_var(3) },
{ be_const_key(resp_cmnd_failed, 59), be_const_func(l_respCmndFailed) },
{ be_const_key(get_power, -1), be_const_func(l_getpower) },
{ be_const_key(get_light, 2), be_const_closure(get_light_closure) },
{ be_const_key(gen_cb, -1), be_const_closure(gen_cb_closure) },
{ be_const_key(remove_timer, -1), be_const_closure(remove_timer_closure) },
{ be_const_key(_global_addr, -1), be_const_comptr(&TasmotaGlobal) },
{ be_const_key(web_send, 54), be_const_func(l_webSend) },
{ be_const_key(time_dump, -1), be_const_func(l_time_dump) },
{ be_const_key(get_switch, 38), be_const_func(l_getswitch) },
{ be_const_key(exec_rules, -1), be_const_closure(exec_rules_closure) },
{ be_const_key(find_key_i, 5), be_const_closure(find_key_i_closure) },
{ be_const_key(yield, -1), be_const_func(l_yield) },
{ be_const_key(web_send_decimal, 34), be_const_func(l_webSendDecimal) },
{ be_const_key(i2c_enabled, 13), be_const_func(l_i2cenabled) },
{ be_const_key(_get_cb, -1), be_const_func(l_get_cb) },
{ be_const_key(cmd, 14), be_const_closure(cmd_closure) },
{ be_const_key(publish, 10), be_const_func(l_publish) },
{ be_const_key(_ccmd, -1), be_const_var(4) },
{ be_const_key(_timers, -1), be_const_var(5) },
{ be_const_key(resp_cmnd_done, -1), be_const_func(l_respCmndDone) },
{ be_const_key(wire_scan, -1), be_const_closure(wire_scan_closure) },
{ be_const_key(_rules, -1), be_const_var(6) },
{ be_const_key(yield, -1), be_const_func(l_yield) },
{ 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(remove_rule, -1), be_const_closure(remove_rule_closure) },
{ be_const_key(resolvecmnd, -1), be_const_func(l_resolveCmnd) },
{ be_const_key(remove_cmd, -1), be_const_closure(remove_cmd_closure) },
{ be_const_key(scale_uint, -1), be_const_func(l_scaleuint) },
{ be_const_key(run_deferred, -1), be_const_closure(run_deferred_closure) },
{ be_const_key(set_timer, -1), be_const_closure(set_timer_closure) },
{ be_const_key(wire2, 47), be_const_var(7) },
{ be_const_key(remove_driver, -1), be_const_closure(remove_driver_closure) },
{ be_const_key(delay, -1), be_const_func(l_delay) },
{ be_const_key(get_light, -1), be_const_closure(get_light_closure) },
{ be_const_key(_global_def, -1), be_const_comptr(&be_tasmota_global_struct) },
{ be_const_key(eth, -1), be_const_func(l_eth) },
{ be_const_key(gc, -1), be_const_closure(gc_closure) },
{ be_const_key(resp_cmnd_failed, 2), be_const_func(l_respCmndFailed) },
{ be_const_key(_get_cb, -1), be_const_func(l_get_cb) },
{ be_const_key(run_deferred, -1), be_const_closure(run_deferred_closure) },
{ be_const_key(millis, 37), be_const_func(l_millis) },
{ be_const_key(_rules, -1), be_const_var(1) },
{ be_const_key(time_dump, -1), be_const_func(l_time_dump) },
{ be_const_key(cb_dispatch, -1), be_const_closure(cb_dispatch_closure) },
{ be_const_key(remove_timer, -1), be_const_closure(remove_timer_closure) },
{ be_const_key(remove_driver, -1), be_const_closure(remove_driver_closure) },
{ be_const_key(memory, -1), be_const_func(l_memory) },
{ be_const_key(add_rule, 29), be_const_closure(add_rule_closure) },
{ be_const_key(load, -1), be_const_closure(load_closure) },
{ be_const_key(get_option, -1), be_const_func(l_getoption) },
{ be_const_key(resp_cmnd_done, 53), be_const_func(l_respCmndDone) },
{ be_const_key(delay, 55), be_const_func(l_delay) },
{ be_const_key(add_driver, 62), be_const_closure(add_driver_closure) },
{ be_const_key(cmd_res, -1), be_const_var(2) },
{ be_const_key(_global_addr, 12), be_const_comptr(&TasmotaGlobal) },
{ be_const_key(time_str, 30), be_const_closure(time_str_closure) },
{ be_const_key(save, -1), be_const_func(l_save) },
{ be_const_key(cmd, -1), be_const_closure(cmd_closure) },
{ be_const_key(event, -1), be_const_closure(event_closure) },
{ be_const_key(publish_result, -1), be_const_func(l_publish_result) },
{ be_const_key(time_reached, 59), be_const_func(l_timereached) },
{ be_const_key(scale_uint, -1), be_const_func(l_scaleuint) },
{ be_const_key(wifi, -1), be_const_func(l_wifi) },
{ be_const_key(_drivers, 4), be_const_var(3) },
{ be_const_key(global, -1), be_const_var(4) },
{ be_const_key(_cmd, 6), be_const_func(l_cmd) },
{ be_const_key(web_send, -1), be_const_func(l_webSend) },
{ be_const_key(_ccmd, -1), be_const_var(5) },
{ be_const_key(web_send_decimal, -1), be_const_func(l_webSendDecimal) },
{ be_const_key(resp_cmnd, -1), be_const_func(l_respCmnd) },
{ be_const_key(try_rule, -1), be_const_closure(try_rule_closure) },
{ be_const_key(get_power, 43), be_const_func(l_getpower) },
{ be_const_key(rtc, -1), be_const_func(l_rtc) },
{ be_const_key(get_free_heap, -1), be_const_func(l_getFreeHeap) },
{ be_const_key(init, -1), be_const_closure(init_closure) },
{ be_const_key(wire2, -1), be_const_var(6) },
{ be_const_key(get_switch, -1), be_const_func(l_getswitch) },
{ be_const_key(strftime, 16), be_const_func(l_strftime) },
{ be_const_key(find_op, 39), be_const_closure(find_op_closure) },
{ be_const_key(i2c_enabled, -1), be_const_func(l_i2cenabled) },
{ be_const_key(exec_cmd, -1), be_const_closure(exec_cmd_closure) },
{ be_const_key(_timers, -1), be_const_var(7) },
{ be_const_key(wire1, 46), be_const_var(8) },
};
static be_define_const_map(
be_class_tasmota_map,
68
69
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_tasmota,
8,
9,
NULL,
Tasmota
);

View File

@ -883,6 +883,9 @@ static int m_item(bvm *vm)
buf_impl attr = bytes_check_data(vm, 0); /* we reserve 4 bytes anyways */
if (argc >=2 && be_isint(vm, 2)) { /* single byte */
int index = be_toint(vm,2);
if (index < 0) {
index += attr.len;
}
if (index >= 0 && index < attr.len) {
be_pushint(vm, buf_get1(&attr, index));
be_return(vm);
@ -900,6 +903,9 @@ static int m_item(bvm *vm)
be_getmember(vm, 2, "__upper__");
upper = be_toint(vm, -1);
be_pop(vm, 1);
/* handle negative limits */
if (upper < 0) { upper += attr.len; }
if (lower < 0) { lower += attr.len; }
/* protection scope */
upper = upper < size ? upper : size - 1;
lower = lower < 0 ? 0 : lower;
@ -1257,38 +1263,38 @@ be_local_closure(getbits, /* name */
(be_nested_const_str("getbits", -1200798317, 7)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[32]) { /* code */
0x180C0500, // 0000 LE R3 R2 K0
0x740E0002, // 0001 JMPT R3 #0005
0x540E001F, // 0002 LDINT R3 32
0x240C0403, // 0003 GT R3 R2 R3
0x780E0000, // 0004 JMPF R3 #0006
0xB0060302, // 0005 RAISE 1 K1 K2
0x580C0000, // 0006 LDCONST R3 K0
0x3C100303, // 0007 SHR R4 R1 K3
0x54160007, // 0008 LDINT R5 8
0x10040205, // 0009 MOD R1 R1 R5
0x58140000, // 000A LDCONST R5 K0
0x24180500, // 000B GT R6 R2 K0
0x781A0011, // 000C JMPF R6 #001F
0x541A0007, // 000D LDINT R6 8
0x04180C01, // 000E SUB R6 R6 R1
0x241C0C02, // 000F GT R7 R6 R2
0x781E0000, // 0010 JMPF R7 #0012
0x5C180400, // 0011 MOVE R6 R2
0x381E0806, // 0012 SHL R7 K4 R6
0x041C0F04, // 0013 SUB R7 R7 K4
0x381C0E01, // 0014 SHL R7 R7 R1
0x94200004, // 0015 GETIDX R8 R0 R4
0x2C201007, // 0016 AND R8 R8 R7
0x3C201001, // 0017 SHR R8 R8 R1
0x38201005, // 0018 SHL R8 R8 R5
0x300C0608, // 0019 OR R3 R3 R8
0x00140A06, // 001A ADD R5 R5 R6
0x04080406, // 001B SUB R2 R2 R6
0x58040000, // 001C LDCONST R1 K0
0x00100904, // 001D ADD R4 R4 K4
0x7001FFEB, // 001E JMP #000B
0x80040600, // 001F RET 1 R3
0x180C0500, // 0000 LE R3 R2 K0
0x740E0002, // 0001 JMPT R3 #0005
0x540E001F, // 0002 LDINT R3 32
0x240C0403, // 0003 GT R3 R2 R3
0x780E0000, // 0004 JMPF R3 #0006
0xB0060302, // 0005 RAISE 1 K1 K2
0x580C0000, // 0006 LDCONST R3 K0
0x3C100303, // 0007 SHR R4 R1 K3
0x54160007, // 0008 LDINT R5 8
0x10040205, // 0009 MOD R1 R1 R5
0x58140000, // 000A LDCONST R5 K0
0x24180500, // 000B GT R6 R2 K0
0x781A0011, // 000C JMPF R6 #001F
0x541A0007, // 000D LDINT R6 8
0x04180C01, // 000E SUB R6 R6 R1
0x241C0C02, // 000F GT R7 R6 R2
0x781E0000, // 0010 JMPF R7 #0012
0x5C180400, // 0011 MOVE R6 R2
0x381E0806, // 0012 SHL R7 K4 R6
0x041C0F04, // 0013 SUB R7 R7 K4
0x381C0E01, // 0014 SHL R7 R7 R1
0x94200004, // 0015 GETIDX R8 R0 R4
0x2C201007, // 0016 AND R8 R8 R7
0x3C201001, // 0017 SHR R8 R8 R1
0x38201005, // 0018 SHL R8 R8 R5
0x300C0608, // 0019 OR R3 R3 R8
0x00140A06, // 001A ADD R5 R5 R6
0x04080406, // 001B SUB R2 R2 R6
0x58040000, // 001C LDCONST R1 K0
0x00100904, // 001D ADD R4 R4 K4
0x7001FFEB, // 001E JMP #000B
0x80040600, // 001F RET 1 R3
})
)
);
@ -1317,43 +1323,43 @@ be_local_closure(setbits, /* name */
(be_nested_const_str("setbits", -1532559129, 7)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[37]) { /* code */
0x14100500, // 0000 LT R4 R2 K0
0x74120002, // 0001 JMPT R4 #0005
0x5412001F, // 0002 LDINT R4 32
0x24100404, // 0003 GT R4 R2 R4
0x78120000, // 0004 JMPF R4 #0006
0xB0060302, // 0005 RAISE 1 K1 K2
0x60100009, // 0006 GETGBL R4 G9
0x5C140600, // 0007 MOVE R5 R3
0x7C100200, // 0008 CALL R4 1
0x5C0C0800, // 0009 MOVE R3 R4
0x3C100303, // 000A SHR R4 R1 K3
0x54160007, // 000B LDINT R5 8
0x10040205, // 000C MOD R1 R1 R5
0x24140500, // 000D GT R5 R2 K0
0x78160014, // 000E JMPF R5 #0024
0x54160007, // 000F LDINT R5 8
0x04140A01, // 0010 SUB R5 R5 R1
0x24180A02, // 0011 GT R6 R5 R2
0x781A0000, // 0012 JMPF R6 #0014
0x5C140400, // 0013 MOVE R5 R2
0x381A0805, // 0014 SHL R6 K4 R5
0x04180D04, // 0015 SUB R6 R6 K4
0x541E00FE, // 0016 LDINT R7 255
0x38200C01, // 0017 SHL R8 R6 R1
0x041C0E08, // 0018 SUB R7 R7 R8
0x94200004, // 0019 GETIDX R8 R0 R4
0x2C201007, // 001A AND R8 R8 R7
0x2C240606, // 001B AND R9 R3 R6
0x38241201, // 001C SHL R9 R9 R1
0x30201009, // 001D OR R8 R8 R9
0x98000808, // 001E SETIDX R0 R4 R8
0x3C0C0605, // 001F SHR R3 R3 R5
0x04080405, // 0020 SUB R2 R2 R5
0x58040000, // 0021 LDCONST R1 K0
0x00100904, // 0022 ADD R4 R4 K4
0x7001FFE8, // 0023 JMP #000D
0x80040000, // 0024 RET 1 R0
0x14100500, // 0000 LT R4 R2 K0
0x74120002, // 0001 JMPT R4 #0005
0x5412001F, // 0002 LDINT R4 32
0x24100404, // 0003 GT R4 R2 R4
0x78120000, // 0004 JMPF R4 #0006
0xB0060302, // 0005 RAISE 1 K1 K2
0x60100009, // 0006 GETGBL R4 G9
0x5C140600, // 0007 MOVE R5 R3
0x7C100200, // 0008 CALL R4 1
0x5C0C0800, // 0009 MOVE R3 R4
0x3C100303, // 000A SHR R4 R1 K3
0x54160007, // 000B LDINT R5 8
0x10040205, // 000C MOD R1 R1 R5
0x24140500, // 000D GT R5 R2 K0
0x78160014, // 000E JMPF R5 #0024
0x54160007, // 000F LDINT R5 8
0x04140A01, // 0010 SUB R5 R5 R1
0x24180A02, // 0011 GT R6 R5 R2
0x781A0000, // 0012 JMPF R6 #0014
0x5C140400, // 0013 MOVE R5 R2
0x381A0805, // 0014 SHL R6 K4 R5
0x04180D04, // 0015 SUB R6 R6 K4
0x541E00FE, // 0016 LDINT R7 255
0x38200C01, // 0017 SHL R8 R6 R1
0x041C0E08, // 0018 SUB R7 R7 R8
0x94200004, // 0019 GETIDX R8 R0 R4
0x2C201007, // 001A AND R8 R8 R7
0x2C240606, // 001B AND R9 R3 R6
0x38241201, // 001C SHL R9 R9 R1
0x30201009, // 001D OR R8 R8 R9
0x98000808, // 001E SETIDX R0 R4 R8
0x3C0C0605, // 001F SHR R3 R3 R5
0x04080405, // 0020 SUB R2 R2 R5
0x58040000, // 0021 LDCONST R1 K0
0x00100904, // 0022 ADD R4 R4 K4
0x7001FFE8, // 0023 JMP #000D
0x80040000, // 0024 RET 1 R0
})
)
);

View File

@ -8,8 +8,8 @@ assert(str(b) == "bytes('')")
b=bytes(1)
assert(str(b) == "bytes('')")
b=bytes(-1)
assert(str(b) == "bytes('')")
assert(b.size() == 0)
assert(str(b) == "bytes(\'00\')")
assert(b.size() == 1)
b=bytes("a")
assert(str(b) == "bytes('')")
@ -120,7 +120,7 @@ assert(b[2] == 0x55)
#- item range -#
b = bytes("00112233445566778899AABBCCDDEEFF")
assert(str(b[1..1]) =="bytes('11')")
assert(str(b[-11..1]) =="bytes('0011')")
assert(str(b[-1..1]) =="bytes('')")
assert(str(b[0..40]) =="bytes('00112233445566778899AABBCCDDEEFF')")
assert(str(b[1..0]) =="bytes('')")
@ -168,3 +168,18 @@ assert(str(b) =="bytes('4C6F72656D20697073756D20646F6C6F722073697420616D65742C20
assert(b.tostring(0) =="bytes('4C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E73656374657475722061646970697363696E6720656C69742C2073656420646F20656975736D6F642074656D706F7220696E6369646964756E74207574206C61626F726520657420646F6C6F7265206D61676E6120616C697175612E')")
assert(size(bytes('4C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E73656374657475722061646970697363696E6720656C69742C2073656420646F20656975736D6F642074656D706F7220696E6369646964756E74207574206C61626F726520657420646F6C6F7265206D61676E6120616C697175612E')) == 123)
#- negative index -#
b=bytes("112233")
assert(b[0] == 0x11)
assert(b[-1] == 0x33) #- last element -#
assert(b[-3] == 0x11)
#- ranges with negative indices -#
b = bytes("00112233445566778899AABBCCDDEEFF")
assert(b[0..-1] == b)
assert(b[1..-2] == bytes("112233445566778899AABBCCDDEE"))
assert(b[5..10] == bytes("5566778899AA"))
assert(b[-10..-5] == bytes("66778899AABB"))
assert(b[5..-10] == bytes("5566"))
assert(b[7..-12] == bytes())

View File

@ -685,10 +685,15 @@ void SettingsLoad(void) {
}
}
#endif // ESP8266
#ifdef ESP32
uint32_t source = SettingsRead(Settings, sizeof(TSettings));
if (source) { settings_location = 1; }
AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from %s, " D_COUNT " %lu"), (source)?"File":"Nvm", Settings->save_flag);
if (source) {
settings_location = 1;
if (Settings->cfg_holder == (uint16_t)CFG_HOLDER) {
AddLog(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG "Loaded from %s, " D_COUNT " %lu"), (source)?"File":"Nvm", Settings->save_flag);
}
}
#endif // ESP32
#ifndef FIRMWARE_MINIMAL

View File

@ -573,7 +573,7 @@ void loop(void) {
SleepDelay((uint32_t)TasmotaGlobal.sleep - my_activity); // Provide time for background tasks like wifi
} else {
if (TasmotaGlobal.global_state.network_down) {
SleepDelay(my_activity /2); // If wifi down and my_activity > setoption36 then force loop delay to 1/3 of my_activity period
SleepDelay(my_activity /2); // If wifi down and my_activity > setoption36 then force loop delay to 1/2 of my_activity period
}
}
}

View File

@ -123,8 +123,7 @@ extern "C" {
const char * command = be_tostring(vm, 2);
be_pop(vm, 2); // clear the stack before calling, because of re-entrant call to Berry in a Rule
ExecuteCommand(command, SRC_BERRY);
be_pushstring(vm, ResponseData());
be_return(vm); // Return
be_return_nil(vm); // Return
}
be_raise(vm, kTypeError, nullptr);
}