Fix merge conflict

This commit is contained in:
Stephan Hadinger 2021-10-12 11:00:56 +02:00
commit a5897faa1b
36 changed files with 2014 additions and 1821 deletions

View File

@ -12,7 +12,6 @@ All notable changes to this project will be documented in this file.
- Berry add module ``import persist``
- Support for BL0942 energy monitor (#13259)
- Support for HM330X SeedStudio Grove Particule sensor (#13250)
- ESP32 restore GPIO16/17 if no PSRAM was found
### Breaking Changed
- ESP32 LVGL updated to v8.0.2

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 */
(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
0x60140006, // 0004 GETGBL R5 G6
0x6014000F, // 0004 GETGBL R5 G15
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
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,29 +1019,60 @@ 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 */
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[ 8]) { /* 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[ 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 */
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[36]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x780A0023, // 0001 JMPF R2 #0026
0x780A001E, // 0001 JMPF R2 #0021
0xA40A0200, // 0002 IMPORT R2 K1
0x8C0C0502, // 0003 GETMET R3 R2 K2
0x5C140200, // 0004 MOVE R5 R1
@ -1055,32 +1085,28 @@ be_local_closure(exec_rules, /* name */
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
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
})
)
);

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

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

@ -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

@ -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 11.10.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)
@ -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

@ -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,6 +1466,7 @@ void NeoPoolShow(bool json)
);
#ifndef NEOPOOL_OPTIMIZE_READINGS
{
// Time
char dt[20];
TIME_T tmpTime;
@ -1426,6 +1474,7 @@ void NeoPoolShow(bool json)
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) {