From 9cc2394d672c34adda3f036168f55307b077e6eb Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 4 Dec 2021 12:02:26 +0100 Subject: [PATCH 01/11] Add shift 74xx595 persistence --- tasmota/settings.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasmota/settings.h b/tasmota/settings.h index 3686b1d42..b488df2e6 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -162,7 +162,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t show_heap_with_timestamp : 1; // bit 16 (v9.5.0.9) - SetOption130 - (Debug) Show heap with logging timestamp uint32_t tuya_allow_dimmer_0 : 1; // bit 17 (v10.0.0.3) - SetOption131 - (Tuya) Allow save dimmer = 0 receved by MCU uint32_t tls_use_fingerprint : 1; // bit 18 (v10.0.0.4) - SetOption132 - (TLS) use fingerprint validation instead of CA based - uint32_t spare19 : 1; // bit 19 + uint32_t shift595_option : 1; // bit 19 (v10.0.0.4) - SetOption133 - (595) uint32_t spare20 : 1; // bit 20 uint32_t spare21 : 1; // bit 21 uint32_t spare22 : 1; // bit 22 @@ -686,8 +686,9 @@ typedef struct { uint8_t weight_change; // E9F uint8_t web_color2[2][3]; // EA0 Needs to be on integer / 3 distance from web_color - uint8_t free_ea6[33]; // EA6 + uint8_t free_ea6[32]; // EA6 + uint8_t shift595; // EC6 uint8_t sta_config; // EC7 uint8_t sta_active; // EC8 uint8_t rule_stop; // EC9 From 3a92189c44eb61a9b8c1c3ced875451a221a5b0a Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 4 Dec 2021 12:26:19 +0100 Subject: [PATCH 02/11] Add command SspmDisplay Add command ``SspmDisplay 0/1`` to change GUI display to powered on relays only. --- tasmota/xdrv_86_esp32_sonoff_spm.ino | 106 +++++++++++++++++---------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/tasmota/xdrv_86_esp32_sonoff_spm.ino b/tasmota/xdrv_86_esp32_sonoff_spm.ino index 9f858691b..afe70b115 100644 --- a/tasmota/xdrv_86_esp32_sonoff_spm.ino +++ b/tasmota/xdrv_86_esp32_sonoff_spm.ino @@ -175,6 +175,7 @@ typedef struct { uint8_t command_sequence; uint8_t mstate; uint8_t last_button; + uint8_t gui_display; bool discovery_triggered; } TSspm; @@ -1082,29 +1083,30 @@ bool SSPMButton(void) { /*********************************************************************************************/ const uint16_t SSPM_SIZE = 128; -const char kSSPMEnergyPhases[] PROGMEM = "%*_f%*_f%*_f%*_f|[%*_f,%*_f,%*_f,%*_f]"; -char* SSPMEnergyFormat(char* result, float* input, uint32_t resolution, bool json) { - char layout[100]; - GetTextIndexed(layout, sizeof(layout), json, kSSPMEnergyPhases); - ext_snprintf_P(result, SSPM_SIZE, layout, resolution, &input[0], resolution, &input[1], resolution, &input[2], resolution, &input[3]); +char* SSPMEnergyFormat(char* result, float* input, uint32_t resolution, uint8_t* indirect, uint8_t offset, uint32_t count) { + result[0] = '\0'; + for (uint32_t i = 0; i < count; i++) { + ext_snprintf_P(result, SSPM_SIZE, PSTR("%s%*_f"), result, resolution, &input[indirect[offset +i]]); + } + ext_snprintf_P(result, SSPM_SIZE, PSTR("%s"), result); return result; } const char HTTP_SSPM_VOLTAGE[] PROGMEM = - "{s}" D_VOLTAGE "%s" D_UNIT_VOLT "{e}"; // {s} = , {m} = , {e} = + "{s}" D_VOLTAGE "%s" D_UNIT_VOLT "{e}"; // {s} = , {m} = , {e} = const char HTTP_SSPM_CURRENT[] PROGMEM = - "{s}" D_CURRENT "%s" D_UNIT_AMPERE "{e}"; + "{s}" D_CURRENT "%s" D_UNIT_AMPERE "{e}"; const char HTTP_SSPM_POWER[] PROGMEM = - "{s}" D_POWERUSAGE_ACTIVE "%s" D_UNIT_WATT "{e}"; + "{s}" D_POWERUSAGE_ACTIVE "%s" D_UNIT_WATT "{e}"; const char HTTP_SSPM_POWER2[] PROGMEM = - "{s}" D_POWERUSAGE_APPARENT "%s" D_UNIT_VA "{e}" - "{s}" D_POWERUSAGE_REACTIVE "%s" D_UNIT_VAR "{e}" - "{s}" D_POWER_FACTOR "%s{e}"; + "{s}" D_POWERUSAGE_APPARENT "%s" D_UNIT_VA "{e}" + "{s}" D_POWERUSAGE_REACTIVE "%s" D_UNIT_VAR "{e}" + "{s}" D_POWER_FACTOR "%s{e}"; const char HTTP_SSPM_ENERGY[] PROGMEM = - "{s}" D_ENERGY_TODAY "%s" D_UNIT_KILOWATTHOUR "{e}" - "{s}" D_ENERGY_YESTERDAY "%s" D_UNIT_KILOWATTHOUR "{e}" - "{s}" D_ENERGY_TOTAL "%s" D_UNIT_KILOWATTHOUR "{e}"; + "{s}" D_ENERGY_TODAY "%s" D_UNIT_KILOWATTHOUR "{e}" + "{s}" D_ENERGY_YESTERDAY "%s" D_UNIT_KILOWATTHOUR "{e}" + "{s}" D_ENERGY_TOTAL "%s" D_UNIT_KILOWATTHOUR "{e}"; void SSPMEnergyShow(bool json) { if (!TasmotaGlobal.devices_present) { return; } // Not ready yet @@ -1152,30 +1154,50 @@ void SSPMEnergyShow(bool json) { } ResponseAppend_P(PSTR("]}")); } else { - Sspm->rotate++; - if (Sspm->rotate >= TasmotaGlobal.devices_present) { - Sspm->rotate = 0; + uint8_t relay[SSPM_MAX_MODULES * 4]; + uint8_t indirect[SSPM_MAX_MODULES * 4]; + + uint32_t index = 0; + power_t power = TasmotaGlobal.power; + for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) { + if ((0 == Sspm->gui_display) || + ((1 == Sspm->gui_display) && (power >> i) &1)) { + relay[index] = i +1; + indirect[index] = i; + index++; + } } - uint32_t module = Sspm->rotate >> 2; - uint32_t relay_base = module * 4; - WSContentSend_P(PSTR("{t}{s}")); // First column is empty ({t} = , {s} =
) - for (uint32_t i = 1; i < 5; i++) { - WSContentSend_P(PSTR("L%d"), relay_base +i); + + if (index) { + uint32_t offset = 0; + if (index > 4) { + Sspm->rotate++; + if (Sspm->rotate >= ((index -1) >> 2) << 3) { + Sspm->rotate = 0; + } + offset = (Sspm->rotate >> 2) * 4; + } + uint32_t count = index - offset; + if (count > 4) { count = 4; } + WSContentSend_P(PSTR("
{t}{s}")); // First column is empty ({t} = , {s} = ) + char value_chr[SSPM_SIZE]; + WSContentSend_PD(HTTP_SSPM_VOLTAGE, SSPMEnergyFormat(value_chr, Sspm->voltage[0], Settings->flag2.voltage_resolution, indirect, offset, count)); + WSContentSend_PD(HTTP_SSPM_CURRENT, SSPMEnergyFormat(value_chr, Sspm->current[0], Settings->flag2.current_resolution, indirect, offset, count)); + WSContentSend_PD(HTTP_SSPM_POWER, SSPMEnergyFormat(value_chr, Sspm->active_power[0], Settings->flag2.wattage_resolution, indirect, offset, count)); + char valu2_chr[SSPM_SIZE]; + char valu3_chr[SSPM_SIZE]; + WSContentSend_PD(HTTP_SSPM_POWER2, SSPMEnergyFormat(value_chr, Sspm->apparent_power[0], Settings->flag2.wattage_resolution, indirect, offset, count), + SSPMEnergyFormat(valu2_chr, Sspm->reactive_power[0], Settings->flag2.wattage_resolution, indirect, offset, count), + SSPMEnergyFormat(valu3_chr, Sspm->power_factor[0], 2, indirect, offset, count)); + WSContentSend_PD(HTTP_SSPM_ENERGY, SSPMEnergyFormat(value_chr, Sspm->energy_today[0], Settings->flag2.energy_resolution, indirect, offset, count), + SSPMEnergyFormat(valu2_chr, Sspm->energy_yesterday[0], Settings->flag2.energy_resolution, indirect, offset, count), + SSPMEnergyFormat(valu3_chr, Sspm->energy_total[0], Settings->flag2.energy_resolution, indirect, offset, count)); + WSContentSend_P(PSTR("
) + for (uint32_t i = 0; i < count; i++) { + WSContentSend_P(PSTR("L%d"), relay[offset +i]); + } + WSContentSend_P(PSTR("{e}")); // Last column is units ({e} =
{t}")); // {t} = - Define for next FUNC_WEB_SENSOR } - WSContentSend_P(PSTR(") - char value_chr[SSPM_SIZE]; - WSContentSend_PD(HTTP_SSPM_VOLTAGE, SSPMEnergyFormat(value_chr, Sspm->voltage[module], Settings->flag2.voltage_resolution, json)); - WSContentSend_PD(HTTP_SSPM_CURRENT, SSPMEnergyFormat(value_chr, Sspm->current[module], Settings->flag2.current_resolution, json)); - WSContentSend_PD(HTTP_SSPM_POWER, SSPMEnergyFormat(value_chr, Sspm->active_power[module], Settings->flag2.wattage_resolution, json)); - char valu2_chr[SSPM_SIZE]; - char valu3_chr[SSPM_SIZE]; - WSContentSend_PD(HTTP_SSPM_POWER2, SSPMEnergyFormat(value_chr, Sspm->apparent_power[module], Settings->flag2.wattage_resolution, json), - SSPMEnergyFormat(valu2_chr, Sspm->reactive_power[module], Settings->flag2.wattage_resolution, json), - SSPMEnergyFormat(valu3_chr, Sspm->power_factor[module], 2, json)); - WSContentSend_PD(HTTP_SSPM_ENERGY, SSPMEnergyFormat(value_chr, Sspm->energy_today[module], Settings->flag2.energy_resolution, json), - SSPMEnergyFormat(valu2_chr, Sspm->energy_yesterday[module], Settings->flag2.energy_resolution, json), - SSPMEnergyFormat(valu3_chr, Sspm->energy_total[module], Settings->flag2.energy_resolution, json)); - WSContentSend_P(PSTR("
{e}")); // Last column is units ({e} =
{t}")); // {t} = - Define for next FUNC_WEB_SENSOR } } @@ -1184,10 +1206,10 @@ void SSPMEnergyShow(bool json) { \*********************************************************************************************/ const char kSSPMCommands[] PROGMEM = "SSPM|" // Prefix - "Log|Energy|History|Scan|IamHere" ; + "Log|Energy|History|Scan|IamHere|Display" ; void (* const SSPMCommand[])(void) PROGMEM = { - &CmndSSPMLog, &CmndSSPMEnergy, &CmndSSPMEnergyHistory, &CmndSSPMScan, &CmndSSPMIamHere }; + &CmndSSPMLog, &CmndSSPMEnergy, &CmndSSPMEnergyHistory, &CmndSSPMScan, &CmndSSPMIamHere, &CmndSSPMDisplay }; void CmndSSPMLog(void) { // Report 29 log entries @@ -1222,6 +1244,14 @@ void CmndSSPMIamHere(void) { ResponseCmndDone(); } +void CmndSSPMDisplay(void) { + // Select either all relays or only powered on relays + if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) { + Sspm->gui_display = XdrvMailbox.payload; + } + ResponseCmndNumber(Sspm->gui_display); +} + /*********************************************************************************************\ * Interface \*********************************************************************************************/ From bcbef695ce0a40fff12b1960552d1367f2164d2a Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sat, 4 Dec 2021 13:46:43 +0100 Subject: [PATCH 03/11] Berry sync with upstream --- lib/libesp32/Berry/src/be_class.c | 2 +- lib/libesp32/Berry/src/be_class.h | 2 +- lib/libesp32/Berry/src/be_jsonlib.c | 2 +- lib/libesp32/Berry/src/be_strlib.c | 1 - lib/libesp32/Berry/src/be_vm.c | 14 +++++++------- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/libesp32/Berry/src/be_class.c b/lib/libesp32/Berry/src/be_class.c index a960d4b24..c2042fd39 100644 --- a/lib/libesp32/Berry/src/be_class.c +++ b/lib/libesp32/Berry/src/be_class.c @@ -220,7 +220,7 @@ static binstance* newobject(bvm *vm, bclass *c) /* Instanciate new instance from stack with argc parameters */ /* Pushes the constructor on the stack to be executed if a construtor is found */ /* Returns true if a constructor is found */ -bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode) +bbool be_class_newobj(bvm *vm, bclass *c, int pos, int argc, int mode) { bvalue init; binstance *obj = newobject(vm, c); /* create empty object hierarchy from class hierarchy */ diff --git a/lib/libesp32/Berry/src/be_class.h b/lib/libesp32/Berry/src/be_class.h index 59abbab30..405ea6d38 100644 --- a/lib/libesp32/Berry/src/be_class.h +++ b/lib/libesp32/Berry/src/be_class.h @@ -58,7 +58,7 @@ void be_prim_method_bind(bvm *vm, bclass *c, bstring *name, bntvfunc f); void be_closure_method_bind(bvm *vm, bclass *c, bstring *name, bclosure *cl); int be_class_closure_count(bclass *c); void be_class_upvalue_init(bvm *vm, bclass *c); -bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode); +bbool be_class_newobj(bvm *vm, bclass *c, int pos, int argc, int mode); int be_instance_member_simple(bvm *vm, binstance *obj, bstring *name, bvalue *dst); int be_instance_member(bvm *vm, binstance *obj, bstring *name, bvalue *dst); int be_class_member(bvm *vm, bclass *obj, bstring *name, bvalue *dst); diff --git a/lib/libesp32/Berry/src/be_jsonlib.c b/lib/libesp32/Berry/src/be_jsonlib.c index 2ee2a4daa..1d7049ea1 100644 --- a/lib/libesp32/Berry/src/be_jsonlib.c +++ b/lib/libesp32/Berry/src/be_jsonlib.c @@ -54,7 +54,7 @@ static int is_object(bvm *vm, const char *class, int idx) } be_remove(vm, -2); } - const char *name = be_classname(vm, idx); + const char *name = be_classname(vm, -1); bbool ret = !strcmp(name, class); be_pop(vm, 1); return ret; diff --git a/lib/libesp32/Berry/src/be_strlib.c b/lib/libesp32/Berry/src/be_strlib.c index e82ec3cf2..53f35607b 100644 --- a/lib/libesp32/Berry/src/be_strlib.c +++ b/lib/libesp32/Berry/src/be_strlib.c @@ -330,7 +330,6 @@ static bstring* string_range(bvm *vm, bstring *str, binstance *range) { bint lower, upper; bint size = str_len(str); /* size of source string */ - // bint size = be_data_size(vm, -1); /* get source list size */ /* get index range */ bvalue temp; be_instance_member(vm, range, be_newstr(vm, "__lower__"), &temp); diff --git a/lib/libesp32/Berry/src/be_vm.c b/lib/libesp32/Berry/src/be_vm.c index dd60e34b7..67519ee39 100644 --- a/lib/libesp32/Berry/src/be_vm.c +++ b/lib/libesp32/Berry/src/be_vm.c @@ -142,7 +142,7 @@ _vm->cf->status = PRIM_FUNC; \ } -static void prep_closure(bvm *vm, int32_t pos, int argc, int mode); +static void prep_closure(bvm *vm, int pos, int argc, int mode); static void attribute_error(bvm *vm, const char *t, bvalue *b, bvalue *c) { @@ -1186,7 +1186,7 @@ newframe: /* a new call frame */ } } -static void prep_closure(bvm *vm, int32_t pos, int argc, int mode) +static void prep_closure(bvm *vm, int pos, int argc, int mode) { bvalue *v, *end; bproto *proto = var2cl(vm->reg + pos)->proto; @@ -1211,7 +1211,7 @@ static void prep_closure(bvm *vm, int32_t pos, int argc, int mode) } } -static void do_closure(bvm *vm, int32_t pos, int argc) +static void do_closure(bvm *vm, int pos, int argc) { // bvalue *v, *end; // bproto *proto = var2cl(reg)->proto; @@ -1225,7 +1225,7 @@ static void do_closure(bvm *vm, int32_t pos, int argc) vm_exec(vm); } -static void do_ntvclos(bvm *vm, int32_t pos, int argc) +static void do_ntvclos(bvm *vm, int pos, int argc) { bntvclos *f = var_toobj(vm->reg + pos); push_native(vm, vm->reg + pos, argc, 0); @@ -1233,7 +1233,7 @@ static void do_ntvclos(bvm *vm, int32_t pos, int argc) ret_native(vm); } -static void do_ntvfunc(bvm *vm, int32_t pos, int argc) +static void do_ntvfunc(bvm *vm, int pos, int argc) { bntvfunc f = var_tontvfunc(vm->reg + pos); push_native(vm, vm->reg + pos, argc, 0); @@ -1241,7 +1241,7 @@ static void do_ntvfunc(bvm *vm, int32_t pos, int argc) ret_native(vm); } -static void do_class(bvm *vm, int32_t pos, int argc) +static void do_class(bvm *vm, int pos, int argc) { if (be_class_newobj(vm, var_toobj(vm->reg + pos), pos, ++argc, 0)) { be_incrtop(vm); @@ -1254,7 +1254,7 @@ void be_dofunc(bvm *vm, bvalue *v, int argc) { be_assert(vm->reg <= v && v < vm->stacktop); be_assert(vm->stack <= vm->reg && vm->reg < vm->stacktop); - int32_t pos = v - vm->reg; + int pos = v - vm->reg; switch (var_type(v)) { case BE_CLASS: do_class(vm, pos, argc); break; case BE_CLOSURE: do_closure(vm, pos, argc); break; From 888cbb999d50fba71d3f81d058cd6cc83c1caba8 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sat, 4 Dec 2021 13:49:06 +0100 Subject: [PATCH 04/11] Rename be_map_release to be_map_compact --- lib/libesp32/Berry/src/be_api.c | 2 +- lib/libesp32/Berry/src/be_class.c | 2 +- lib/libesp32/Berry/src/be_map.c | 2 +- lib/libesp32/Berry/src/be_map.h | 2 +- lib/libesp32/Berry/src/be_module.c | 2 +- lib/libesp32/Berry/src/be_solidifylib.c | 2 +- lib/libesp32/Berry/src/be_var.c | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libesp32/Berry/src/be_api.c b/lib/libesp32/Berry/src/be_api.c index d883c08d7..79d5c48ff 100644 --- a/lib/libesp32/Berry/src/be_api.c +++ b/lib/libesp32/Berry/src/be_api.c @@ -51,7 +51,7 @@ static void class_init(bvm *vm, bclass *c, const bnfuncinfo *lib) ++slib; } } - be_map_release(vm, c->members); /* clear space */ + be_map_compact(vm, c->members); /* clear space */ } } diff --git a/lib/libesp32/Berry/src/be_class.c b/lib/libesp32/Berry/src/be_class.c index c2042fd39..0f4efb3d5 100644 --- a/lib/libesp32/Berry/src/be_class.c +++ b/lib/libesp32/Berry/src/be_class.c @@ -40,7 +40,7 @@ bclass* be_newclass(bvm *vm, bstring *name, bclass *super) void be_class_compress(bvm *vm, bclass *c) { if (!gc_isconst(c) && c->members) { - be_map_release(vm, c->members); /* clear space */ + be_map_compact(vm, c->members); /* clear space */ } } diff --git a/lib/libesp32/Berry/src/be_map.c b/lib/libesp32/Berry/src/be_map.c index 004406f46..37f9efc62 100644 --- a/lib/libesp32/Berry/src/be_map.c +++ b/lib/libesp32/Berry/src/be_map.c @@ -343,7 +343,7 @@ bmapnode* be_map_val2node(bvalue *value) return (bmapnode *)((size_t)value - sizeof(bmapkey)); } -void be_map_release(bvm *vm, bmap *map) +void be_map_compact(bvm *vm, bmap *map) { (void)vm; if (!gc_isconst(map)) { diff --git a/lib/libesp32/Berry/src/be_map.h b/lib/libesp32/Berry/src/be_map.h index d632f0d0b..7ae76962c 100644 --- a/lib/libesp32/Berry/src/be_map.h +++ b/lib/libesp32/Berry/src/be_map.h @@ -56,6 +56,6 @@ bvalue* be_map_insertstr(bvm *vm, bmap *map, bstring *key, bvalue *value); void be_map_removestr(bvm *vm, bmap *map, bstring *key); bmapnode* be_map_next(bmap *map, bmapiter *iter); bmapnode* be_map_val2node(bvalue *value); -void be_map_release(bvm *vm, bmap *map); +void be_map_compact(bvm *vm, bmap *map); #endif diff --git a/lib/libesp32/Berry/src/be_module.c b/lib/libesp32/Berry/src/be_module.c index c661528a1..0256809af 100644 --- a/lib/libesp32/Berry/src/be_module.c +++ b/lib/libesp32/Berry/src/be_module.c @@ -99,7 +99,7 @@ static bmodule* new_module(bvm *vm, const bntvmodule *nm) obj->table = NULL; /* gc protection */ obj->table = be_map_new(vm); insert_attrs(vm, obj->table, nm); - be_map_release(vm, obj->table); /* clear space */ + be_map_compact(vm, obj->table); /* clear space */ be_stackpop(vm, 1); } return obj; diff --git a/lib/libesp32/Berry/src/be_solidifylib.c b/lib/libesp32/Berry/src/be_solidifylib.c index d8291b365..2b82b44fd 100644 --- a/lib/libesp32/Berry/src/be_solidifylib.c +++ b/lib/libesp32/Berry/src/be_solidifylib.c @@ -42,7 +42,7 @@ static void m_solidify_bvalue(bvm *vm, bvalue * value, const char *classname, co static void m_solidify_map(bvm *vm, bmap * map, const char *class_name) { // compact first - be_map_release(vm, map); + be_map_compact(vm, map); logfmt(" be_nested_map(%i,\n", map->count); diff --git a/lib/libesp32/Berry/src/be_var.c b/lib/libesp32/Berry/src/be_var.c index ebc70ecea..4fee144cd 100644 --- a/lib/libesp32/Berry/src/be_var.c +++ b/lib/libesp32/Berry/src/be_var.c @@ -87,7 +87,7 @@ bvalue* be_global_var(bvm *vm, int index) void be_global_release_space(bvm *vm) { - be_map_release(vm, global(vm).vtab); + be_map_compact(vm, global(vm).vtab); be_vector_release(vm, &global(vm).vlist); } @@ -130,7 +130,7 @@ int be_builtin_new(bvm *vm, bstring *name) void be_bulitin_release_space(bvm *vm) { - be_map_release(vm, builtin(vm).vtab); + be_map_compact(vm, builtin(vm).vtab); be_vector_release(vm, &builtin(vm).vlist); } #else From 2f9172a59f0dac19e09e805b033377378bb67797 Mon Sep 17 00:00:00 2001 From: Barbudor Date: Sat, 4 Dec 2021 15:03:15 +0100 Subject: [PATCH 05/11] fix pulsetime for more than 8 relays/power devices --- tasmota/support_tasmota.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index f3e4fe977..3129c2831 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -1043,7 +1043,7 @@ void Every100mSeconds(void) if (TasmotaGlobal.pulse_timer[i] != 0L) { // Timer active? if (TimeReached(TasmotaGlobal.pulse_timer[i])) { // Timer finished? TasmotaGlobal.pulse_timer[i] = 0L; // Turn off this timer - for (uint32_t j = 0; j < TasmotaGlobal.devices_present; j = j +MAX_PULSETIMERS) { + for (uint32_t j = 0; (i + j) < TasmotaGlobal.devices_present; j = j +MAX_PULSETIMERS) { ExecuteCommandPower(i + j +1, (POWER_ALL_OFF_PULSETIME_ON == Settings->poweronstate) ? POWER_ON : POWER_OFF, SRC_PULSETIMER); } } From 8c12424d78d747f208bdc9ee878898e91b37192f Mon Sep 17 00:00:00 2001 From: jziolkowski Date: Sat, 4 Dec 2021 15:39:00 +0100 Subject: [PATCH 06/11] WIP --- tasmota/i18n.h | 5 ++ tasmota/language/en_GB.h | 6 ++ tasmota/my_user_config.h | 2 + tasmota/settings.h | 5 +- tasmota/settings.ino | 3 + tasmota/tasmota_template.h | 14 ++++- tasmota/xdrv_60_shift595.ino | 114 +++++++++++++++++++++++++++++++++++ 7 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 tasmota/xdrv_60_shift595.ino diff --git a/tasmota/i18n.h b/tasmota/i18n.h index 462774a53..db93df902 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -716,6 +716,11 @@ #define D_CMND_BR_RUN "" #define D_BR_NOT_STARTED "Berry not started" +// Commands xdrv_60_shift595.ino - 74x595 family shift register driver +#ifdef USE_SHIFT595 +#define D_CMND_SHIFT595_DEVICE_COUNT "Shift595DeviceCount" +#endif + // Commands xsns_02_analog.ino #define D_CMND_ADCPARAM "AdcParam" diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index 79eb011f1..0fed4b222 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -1083,4 +1083,10 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" +// xdrv_60_shift595.ino +#define D_GPIO_SHIFT595_SRCLK "74HC595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74HC595 RCLK" +#define D_GPIO_SHIFT595_OE "74HC595 OE" +#define D_GPIO_SHIFT595_SER "74HC595 SER" + #endif // _LANGUAGE_EN_GB_H_ diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index f04b79d93..d34174a56 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -350,6 +350,8 @@ #define ZIGBEE_DISTINCT_TOPICS false // [SetOption89] Enable unique device topic based on Zigbee device ShortAddr #define ZIGBEE_RMV_ZBRECEIVED false // [SetOption100] Remove ZbReceived form JSON message #define ZIGBEE_INDEX_EP false // [SetOption101] Add the source endpoint as suffix to attributes, ex `Power3` instead of `Power` if sent from endpoint 3 +#define SHIFT595_INVERT_OUTPUTS false // [SetOption133] Don't invert outputs of 74x595 shift register +#define SHIFT595_DEVICE_COUNT 1 // [Shift595Devices] Set the number of connected 74x595 shift registers /*********************************************************************************************\ * END OF SECTION 1 diff --git a/tasmota/settings.h b/tasmota/settings.h index 3686b1d42..02571350a 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -162,7 +162,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t show_heap_with_timestamp : 1; // bit 16 (v9.5.0.9) - SetOption130 - (Debug) Show heap with logging timestamp uint32_t tuya_allow_dimmer_0 : 1; // bit 17 (v10.0.0.3) - SetOption131 - (Tuya) Allow save dimmer = 0 receved by MCU uint32_t tls_use_fingerprint : 1; // bit 18 (v10.0.0.4) - SetOption132 - (TLS) use fingerprint validation instead of CA based - uint32_t spare19 : 1; // bit 19 + uint32_t shift595_invert_outputs : 1; // bit 19 (v10.0.0.5) - SetOption133 - (Shift595) invert outputs of 74x595 shift registers uint32_t spare20 : 1; // bit 20 uint32_t spare21 : 1; // bit 21 uint32_t spare22 : 1; // bit 22 @@ -487,7 +487,8 @@ typedef struct { int32_t energy_kWhyesterday_ph[3]; // 320 int32_t energy_kWhtotal_ph[3]; // 32C - uint8_t free_338[7]; // 338 + uint8_t shift595_device_count; // 338 + uint8_t free_339[6]; // 339 uint8_t tuyamcu_topic; // 33F Manage tuyaSend topic. ex_energy_power_delta on 6.6.0.20, replaced on 8.5.0.1 uint16_t domoticz_update_timer; // 340 diff --git a/tasmota/settings.ino b/tasmota/settings.ino index faee15800..b2a58e2ae 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -1196,6 +1196,9 @@ void SettingsDefaultSet2(void) { flag4.mqtt_tls |= MQTT_TLS_ENABLED; flag4.mqtt_no_retain |= MQTT_NO_RETAIN; + flag5.shift595_invert_outputs |= SHIFT595_INVERT_OUTPUTS; + Settings->shift595_device_count = SHIFT595_DEVICE_COUNT; + Settings->flag = flag; Settings->flag2 = flag2; Settings->flag3 = flag3; diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index bbbce4d01..9e08aedb1 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -176,6 +176,7 @@ enum UserSelectablePins { GPIO_BL0942_RX, // BL0942 Serial interface GPIO_HM330X_SET, // HM330X SET pin (sleep when low) GPIO_HEARTBEAT, GPIO_HEARTBEAT_INV, + GPIO_SHIFT595_SRCLK, GPIO_SHIFT595_RCLK, GPIO_SHIFT595_OE, GPIO_SHIFT595_SER, // 74HC595 Shift register GPIO_SENSOR_END }; enum ProgramSelectablePins { @@ -372,7 +373,11 @@ const char kSensorNames[] PROGMEM = D_SENSOR_BL0942_RX "|" D_SENSOR_HM330X_SET "|" D_SENSOR_HEARTBEAT "|" D_SENSOR_HEARTBEAT "_i|" - ; + +#ifdef USE_SHIFT595 + D_GPIO_SHIFT595_SRCLK "|" D_GPIO_SHIFT595_RCLK "|" D_GPIO_SHIFT595_OE "|" D_GPIO_SHIFT595_SER "|" +#endif +; const char kSensorNamesFixed[] PROGMEM = D_SENSOR_USER; @@ -930,6 +935,13 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_ADC_JOY) + MAX_ADCS, // Joystick AGPIO(GPIO_ADC_PH) + MAX_ADCS, // Analog PH Sensor #endif // ESP32 + +#ifdef USE_SHIFT595 + AGPIO(GPIO_SHIFT595_SRCLK), // 74HC595 shift register + AGPIO(GPIO_SHIFT595_RCLK), + AGPIO(GPIO_SHIFT595_OE), + AGPIO(GPIO_SHIFT595_SER), +#endif }; /*-------------------------------------------------------------------------------------------*\ diff --git a/tasmota/xdrv_60_shift595.ino b/tasmota/xdrv_60_shift595.ino new file mode 100644 index 000000000..6e45194fa --- /dev/null +++ b/tasmota/xdrv_60_shift595.ino @@ -0,0 +1,114 @@ +/* + xdrv_60_shift595.ino - 74x595 shift register family support for Tasmota + + Copyright (C) 2021 Jacek Ziółkowski + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifdef USE_SHIFT595 + +#define XDRV_60 60 + +const char kShift595Commands[] PROGMEM = "|" D_CMND_SHIFT595_DEVICE_COUNT ; +void (* const Shit595Command[])(void) PROGMEM = { &CmndShift595Devices }; + +struct Shift595 { + int8_t pinSRCLK; + int8_t pinRCLK; + int8_t pinSER; + int8_t pinOE; + bool connected = false; + int8_t outputs; + int8_t first = TasmotaGlobal.devices_present; +} Shift595; + +void Shift595Init(void) +{ + if (PinUsed(GPIO_SHIFT595_SRCLK) && PinUsed(GPIO_SHIFT595_RCLK) && PinUsed(GPIO_SHIFT595_SER)) { + Shift595.pinSRCLK = Pin(GPIO_SHIFT595_SRCLK); + pinMode(Shift595.pinSRCLK, OUTPUT); + digitalWrite(Shift595.pinSRCLK, 0); + + Shift595.pinRCLK = Pin(GPIO_SHIFT595_RCLK); + pinMode(Shift595.pinRCLK, OUTPUT); + digitalWrite(Shift595.pinRCLK, 0); + + Shift595.pinSER = Pin(GPIO_SHIFT595_SER); + pinMode(Shift595.pinSER, OUTPUT); + digitalWrite(Shift595.pinSER, 0); + + if (PinUsed(GPIO_SHIFT595_OE)) { + Shift595.pinOE = Pin(GPIO_SHIFT595_OE); + pinMode(Shift595.pinOE, OUTPUT); + digitalWrite(Shift595.pinOE, 1); + } + Shift595.outputs = Settings->shift595_device_count * 8; + TasmotaGlobal.devices_present += Shift595.outputs; + Shift595.connected = true; + AddLog(LOG_LEVEL_DEBUG, PSTR("595: Controlling relays POWER%d to POWER%d"), Shift595.first + 1, Shift595.outputs); + } +} + +void Shift595LatchPin(uint8 pin) { + digitalWrite(pin, 1); + digitalWrite(pin, 0); +} + +void Shift595SwitchRelay(void) +{ + if (Shift595.connected == true) { + for (uint32_t i = 0; i < Shift595.outputs; i++) { + uint8_t relay_state = bitRead(XdrvMailbox.index, Shift595.first + Shift595.outputs -1 -i); + // digitalWrite(Shift595.pinSER, Settings->flag5.shift595_invert_outputs ? !relay_state : relay_state); + digitalWrite(Shift595.pinSER, relay_state); + Shift595LatchPin(Shift595.pinSRCLK); + } + + Shift595LatchPin(Shift595.pinRCLK); + + if (PinUsed(GPIO_SHIFT595_OE)) { + digitalWrite(Shift595.pinOE, 0); + } + } +} + +void CmndShift595Devices(void) { + if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 4)) { + Settings->shift595_device_count = (1 == XdrvMailbox.payload) ? SHIFT595_DEVICE_COUNT : XdrvMailbox.payload; + TasmotaGlobal.restart_flag = 2; + } + ResponseCmndNumber(Settings->shift595_device_count); +} + +/*********************************************************************************************\ + * Interface +\*********************************************************************************************/ + +bool Xdrv60(uint8_t function) +{ + bool result = false; + switch (function) { + case FUNC_PRE_INIT: + Shift595Init(); + break; + case FUNC_SET_POWER: + Shift595SwitchRelay(); + break; + case FUNC_COMMAND: + result = DecodeCommand(kShift595Commands, Shift595Command); + break; + return result; +} + +#endif // USE_SHIFT595 From 1d3a3ee4151c4044e1888fcb2281e2b246d8537e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 4 Dec 2021 16:14:08 +0100 Subject: [PATCH 07/11] Make SspmDisplay persistent --- tasmota/settings.h | 2 +- tasmota/xdrv_86_esp32_sonoff_spm.ino | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tasmota/settings.h b/tasmota/settings.h index b488df2e6..eb8ca22bc 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -250,7 +250,7 @@ typedef union { uint32_t sonoff_l1_music_sync : 1; // bit 5 (v9.5.0.5) - CMND_L1MUSICSYNC - Enable sync to music uint32_t influxdb_default : 1; // bit 6 (v9.5.0.5) - Set influxdb initial defaults if 0 uint32_t influxdb_state : 1; // bit 7 (v9.5.0.5) - CMND_IFX - Enable influxdb support - uint32_t spare08 : 1; // bit 8 + uint32_t sspm_display : 1; // bit 8 (v10.0.0.4) - CMND_SSPMDISPLAY - Enable gui display of powered on relays only uint32_t spare09 : 1; // bit 9 uint32_t spare10 : 1; // bit 10 uint32_t spare11 : 1; // bit 11 diff --git a/tasmota/xdrv_86_esp32_sonoff_spm.ino b/tasmota/xdrv_86_esp32_sonoff_spm.ino index afe70b115..eaeb2d758 100644 --- a/tasmota/xdrv_86_esp32_sonoff_spm.ino +++ b/tasmota/xdrv_86_esp32_sonoff_spm.ino @@ -175,7 +175,6 @@ typedef struct { uint8_t command_sequence; uint8_t mstate; uint8_t last_button; - uint8_t gui_display; bool discovery_triggered; } TSspm; @@ -1160,8 +1159,8 @@ void SSPMEnergyShow(bool json) { uint32_t index = 0; power_t power = TasmotaGlobal.power; for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) { - if ((0 == Sspm->gui_display) || - ((1 == Sspm->gui_display) && (power >> i) &1)) { + if ((0 == Settings->sbflag1.sspm_display) || + ((1 == Settings->sbflag1.sspm_display) && (power >> i) &1)) { relay[index] = i +1; indirect[index] = i; index++; @@ -1247,9 +1246,9 @@ void CmndSSPMIamHere(void) { void CmndSSPMDisplay(void) { // Select either all relays or only powered on relays if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) { - Sspm->gui_display = XdrvMailbox.payload; + Settings->sbflag1.sspm_display = XdrvMailbox.payload; } - ResponseCmndNumber(Sspm->gui_display); + ResponseCmndNumber(Settings->sbflag1.sspm_display); } /*********************************************************************************************\ From 4d05fb153c1e67cbdc83dac18c002f4b0c57e7f6 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 4 Dec 2021 17:39:04 +0100 Subject: [PATCH 08/11] Remove BlockedLoop detection from ESP32 --- tasmota/support.ino | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/tasmota/support.ino b/tasmota/support.ino index 76ca608e9..303a66e87 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -21,10 +21,15 @@ extern "C" { extern struct rst_info resetInfo; } +#ifdef USE_KNX +bool knx_started = false; +#endif // USE_KNX + /*********************************************************************************************\ * Watchdog extension (https://github.com/esp8266/Arduino/issues/1532) \*********************************************************************************************/ +#ifdef ESP8266 #include Ticker tickerOSWatch; @@ -38,12 +43,7 @@ uint8_t oswatch_blocked_loop = 0; //void OsWatchTicker() IRAM_ATTR; #endif // USE_WS2812_DMA -#ifdef USE_KNX -bool knx_started = false; -#endif // USE_KNX - -void OsWatchTicker(void) -{ +void OsWatchTicker(void) { uint32_t t = millis(); uint32_t last_run = t - oswatch_last_loop_time; @@ -66,27 +66,33 @@ void OsWatchTicker(void) } } -void OsWatchInit(void) -{ +void OsWatchInit(void) { oswatch_blocked_loop = RtcSettings.oswatch_blocked_loop; RtcSettings.oswatch_blocked_loop = 0; oswatch_last_loop_time = millis(); tickerOSWatch.attach_ms(((OSWATCH_RESET_TIME / 3) * 1000), OsWatchTicker); } -void OsWatchLoop(void) -{ +void OsWatchLoop(void) { oswatch_last_loop_time = millis(); // while(1) delay(1000); // this will trigger the os watch } -bool OsWatchBlockedLoop(void) -{ +bool OsWatchBlockedLoop(void) { return oswatch_blocked_loop; } -uint32_t ResetReason(void) -{ +#else // Anything except ESP8266 + +void OsWatchInit(void) {} +void OsWatchLoop(void) {} +bool OsWatchBlockedLoop(void) { + return false; +} + +#endif // ESP8266 + +uint32_t ResetReason(void) { /* user_interface.h REASON_DEFAULT_RST = 0, // "Power on" normal startup by power on @@ -100,9 +106,8 @@ uint32_t ResetReason(void) return ESP_ResetInfoReason(); } -String GetResetReason(void) -{ - if (oswatch_blocked_loop) { +String GetResetReason(void) { + if (OsWatchBlockedLoop()) { char buff[32]; strncpy_P(buff, PSTR(D_JSON_BLOCKED_LOOP), sizeof(buff)); return String(buff); From 8288d74bb2f654f01e27c86c8ef8bd62a8275973 Mon Sep 17 00:00:00 2001 From: jziolkowski Date: Sat, 4 Dec 2021 18:12:41 +0100 Subject: [PATCH 09/11] Reduce the max count of devices to never exceed MAX_RELAYS --- tasmota/xdrv_60_shift595.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xdrv_60_shift595.ino b/tasmota/xdrv_60_shift595.ino index 9bae92196..27200d52f 100644 --- a/tasmota/xdrv_60_shift595.ino +++ b/tasmota/xdrv_60_shift595.ino @@ -83,7 +83,7 @@ void Shift595SwitchRelay(void) } void CmndShift595Devices(void) { - if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 4)) { + if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 3)) { Settings->shift595_device_count = (1 == XdrvMailbox.payload) ? SHIFT595_DEVICE_COUNT : XdrvMailbox.payload; TasmotaGlobal.restart_flag = 2; } From 63ff462f53b026ba552fe55a82d9508166e67180 Mon Sep 17 00:00:00 2001 From: jziolkowski Date: Sun, 5 Dec 2021 13:40:01 +0100 Subject: [PATCH 10/11] using pointer for Shift595, refactored pin init --- tasmota/i18n.h | 2 - tasmota/my_user_config.h | 6 ++- tasmota/tasmota_template.h | 2 - tasmota/xdrv_60_shift595.ino | 92 +++++++++++++++++++----------------- 4 files changed, 53 insertions(+), 49 deletions(-) diff --git a/tasmota/i18n.h b/tasmota/i18n.h index db93df902..387ba8f33 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -717,9 +717,7 @@ #define D_BR_NOT_STARTED "Berry not started" // Commands xdrv_60_shift595.ino - 74x595 family shift register driver -#ifdef USE_SHIFT595 #define D_CMND_SHIFT595_DEVICE_COUNT "Shift595DeviceCount" -#endif // Commands xsns_02_analog.ino #define D_CMND_ADCPARAM "AdcParam" diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index dcdb5acc9..9eb87e186 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -350,8 +350,6 @@ #define ZIGBEE_DISTINCT_TOPICS false // [SetOption89] Enable unique device topic based on Zigbee device ShortAddr #define ZIGBEE_RMV_ZBRECEIVED false // [SetOption100] Remove ZbReceived form JSON message #define ZIGBEE_INDEX_EP false // [SetOption101] Add the source endpoint as suffix to attributes, ex `Power3` instead of `Power` if sent from endpoint 3 -#define SHIFT595_INVERT_OUTPUTS false // [SetOption133] Don't invert outputs of 74x595 shift register -#define SHIFT595_DEVICE_COUNT 1 // [Shift595DeviceCount] Set the number of connected 74x595 shift registers /*********************************************************************************************\ * END OF SECTION 1 @@ -895,6 +893,10 @@ // -- Other sensors/drivers ----------------------- +// #define USE_SHIFT595 + #define SHIFT595_INVERT_OUTPUTS false // [SetOption133] Don't invert outputs of 74x595 shift register + #define SHIFT595_DEVICE_COUNT 1 // [Shift595DeviceCount] Set the number of connected 74x595 shift registers + //#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code) //#define USE_HX711 // Add support for HX711 load cell (+1k5 code) // #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code) diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index 311ac9388..d8aa87742 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -374,9 +374,7 @@ const char kSensorNames[] PROGMEM = D_SENSOR_HM330X_SET "|" D_SENSOR_HEARTBEAT "|" D_SENSOR_HEARTBEAT "_i|" -#ifdef USE_SHIFT595 D_GPIO_SHIFT595_SRCLK "|" D_GPIO_SHIFT595_RCLK "|" D_GPIO_SHIFT595_OE "|" D_GPIO_SHIFT595_SER "|" -#endif ; const char kSensorNamesFixed[] PROGMEM = diff --git a/tasmota/xdrv_60_shift595.ino b/tasmota/xdrv_60_shift595.ino index 27200d52f..cf9a3868c 100644 --- a/tasmota/xdrv_60_shift595.ino +++ b/tasmota/xdrv_60_shift595.ino @@ -24,60 +24,64 @@ const char kShift595Commands[] PROGMEM = "|" D_CMND_SHIFT595_DEVICE_COUNT ; void (* const Shift595Command[])(void) PROGMEM = { &CmndShift595Devices }; struct Shift595 { - int8_t pinSRCLK; - int8_t pinRCLK; - int8_t pinSER; - int8_t pinOE; - int8_t outputs; - int8_t first = TasmotaGlobal.devices_present; + uint8_t pinSRCLK; + uint8_t pinRCLK; + uint8_t pinSER; + uint8_t pinOE; + uint8_t outputs; + uint8_t first; bool connected = false; -} Shift595; +} *Shift595 = nullptr; + +void Shift595ConfigurePin(uint8_t pin, uint8_t value = 0){ + pinMode(pin, OUTPUT); + digitalWrite(pin, value); +} void Shift595Init(void) { if (PinUsed(GPIO_SHIFT595_SRCLK) && PinUsed(GPIO_SHIFT595_RCLK) && PinUsed(GPIO_SHIFT595_SER)) { - Shift595.pinSRCLK = Pin(GPIO_SHIFT595_SRCLK); - pinMode(Shift595.pinSRCLK, OUTPUT); - digitalWrite(Shift595.pinSRCLK, 0); - - Shift595.pinRCLK = Pin(GPIO_SHIFT595_RCLK); - pinMode(Shift595.pinRCLK, OUTPUT); - digitalWrite(Shift595.pinRCLK, 0); + Shift595 = (struct Shift595*)calloc(1, sizeof(struct Shift595)); - Shift595.pinSER = Pin(GPIO_SHIFT595_SER); - pinMode(Shift595.pinSER, OUTPUT); - digitalWrite(Shift595.pinSER, 0); + Shift595->pinSRCLK = Pin(GPIO_SHIFT595_SRCLK); + Shift595->pinRCLK = Pin(GPIO_SHIFT595_RCLK); + Shift595->pinSER = Pin(GPIO_SHIFT595_SER); + + Shift595ConfigurePin(Shift595->pinSRCLK); + Shift595ConfigurePin(Shift595->pinRCLK); + Shift595ConfigurePin(Shift595->pinSER); if (PinUsed(GPIO_SHIFT595_OE)) { - Shift595.pinOE = Pin(GPIO_SHIFT595_OE); - pinMode(Shift595.pinOE, OUTPUT); - digitalWrite(Shift595.pinOE, 1); + Shift595->pinOE = Pin(GPIO_SHIFT595_OE); + Shift595ConfigurePin(Shift595->pinOE, 1); } - Shift595.outputs = Settings->shift595_device_count * 8; - TasmotaGlobal.devices_present += Shift595.outputs; - Shift595.connected = true; - AddLog(LOG_LEVEL_DEBUG, PSTR("595: Controlling relays POWER%d to POWER%d"), Shift595.first + 1, Shift595.first + Shift595.outputs); + + Shift595->first = TasmotaGlobal.devices_present; + Shift595->outputs = Settings->shift595_device_count * 8; + TasmotaGlobal.devices_present += Shift595->outputs; + Shift595->connected = true; + AddLog(LOG_LEVEL_DEBUG, PSTR("595: Controlling relays POWER%d to POWER%d"), Shift595->first + 1, Shift595->first + Shift595->outputs); } } -void Shift595LatchPin(uint8 pin) { +void Shift595LatchPin(uint8_t pin) { digitalWrite(pin, 1); digitalWrite(pin, 0); } void Shift595SwitchRelay(void) { - if (Shift595.connected == true) { - for (uint32_t i = 0; i < Shift595.outputs; i++) { - uint8_t relay_state = bitRead(XdrvMailbox.index, Shift595.first + Shift595.outputs -1 -i); - digitalWrite(Shift595.pinSER, Settings->flag5.shift595_invert_outputs ? !relay_state : relay_state); - Shift595LatchPin(Shift595.pinSRCLK); + if (Shift595 && Shift595->connected == true) { + for (uint32_t i = 0; i < Shift595->outputs; i++) { + uint8_t relay_state = bitRead(XdrvMailbox.index, Shift595->first + Shift595->outputs -1 -i); + digitalWrite(Shift595->pinSER, Settings->flag5.shift595_invert_outputs ? !relay_state : relay_state); + Shift595LatchPin(Shift595->pinSRCLK); } - Shift595LatchPin(Shift595.pinRCLK); + Shift595LatchPin(Shift595->pinRCLK); if (PinUsed(GPIO_SHIFT595_OE)) { - digitalWrite(Shift595.pinOE, 0); + digitalWrite(Shift595->pinOE, 0); } } } @@ -97,17 +101,19 @@ void CmndShift595Devices(void) { bool Xdrv60(uint8_t function) { bool result = false; - switch (function) { - case FUNC_PRE_INIT: - Shift595Init(); - break; - case FUNC_SET_POWER: - Shift595SwitchRelay(); - break; - case FUNC_COMMAND: - result = DecodeCommand(kShift595Commands, Shift595Command); - break; - } + + if (FUNC_PRE_INIT == function) { + Shift595Init(); + } else if (Shift595) { + switch (function) { + case FUNC_SET_POWER: + Shift595SwitchRelay(); + break; + case FUNC_COMMAND: + result = DecodeCommand(kShift595Commands, Shift595Command); + break; + } + } return result; } From 0cdf6c9653679faae45e754fb47e53df4459de7b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 5 Dec 2021 14:49:49 +0100 Subject: [PATCH 11/11] Refactor Shift595 --- tasmota/language/af_AF.h | 10 +++---- tasmota/language/bg_BG.h | 10 +++---- tasmota/language/cs_CZ.h | 10 +++---- tasmota/language/de_DE.h | 10 +++---- tasmota/language/el_GR.h | 10 +++---- tasmota/language/en_GB.h | 10 +++---- tasmota/language/es_ES.h | 10 +++---- tasmota/language/fr_FR.h | 10 +++---- tasmota/language/fy_NL.h | 10 +++---- tasmota/language/he_HE.h | 10 +++---- tasmota/language/hu_HU.h | 10 +++---- tasmota/language/it_IT.h | 10 +++---- tasmota/language/ko_KO.h | 10 +++---- tasmota/language/nl_NL.h | 10 +++---- tasmota/language/pl_PL.h | 10 +++---- tasmota/language/pt_BR.h | 10 +++---- tasmota/language/pt_PT.h | 10 +++---- tasmota/language/ro_RO.h | 10 +++---- tasmota/language/ru_RU.h | 10 +++---- tasmota/language/sk_SK.h | 10 +++---- tasmota/language/sv_SE.h | 10 +++---- tasmota/language/tr_TR.h | 10 +++---- tasmota/language/uk_UA.h | 10 +++---- tasmota/language/vi_VN.h | 10 +++---- tasmota/language/zh_CN.h | 10 +++---- tasmota/language/zh_TW.h | 10 +++---- tasmota/my_user_config.h | 2 +- tasmota/settings.h | 4 +-- tasmota/support_features.ino | 4 ++- tasmota/xdrv_60_shift595.ino | 51 ++++++++++++++++++------------------ tools/decode-status.py | 7 ++--- 31 files changed, 139 insertions(+), 189 deletions(-) diff --git a/tasmota/language/af_AF.h b/tasmota/language/af_AF.h index a97df50be..b9e290410 100644 --- a/tasmota/language/af_AF.h +++ b/tasmota/language/af_AF.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "te laag" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pomptyd oorskry" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_AF_AF_H_ diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h index 249100589..fac7105f1 100644 --- a/tasmota/language/bg_BG.h +++ b/tasmota/language/bg_BG.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "твърде ниско" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "превишено време за помпане" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_BG_BG_H_ diff --git a/tasmota/language/cs_CZ.h b/tasmota/language/cs_CZ.h index 0d193693e..a297d5f0f 100644 --- a/tasmota/language/cs_CZ.h +++ b/tasmota/language/cs_CZ.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_CS_CZ_H_ diff --git a/tasmota/language/de_DE.h b/tasmota/language/de_DE.h index 9ecbc9a03..e801818df 100644 --- a/tasmota/language/de_DE.h +++ b/tasmota/language/de_DE.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Herzschlag" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "zu niedrig" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "Pumpzeit überschritten" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_DE_DE_H_ diff --git a/tasmota/language/el_GR.h b/tasmota/language/el_GR.h index 630f19471..b777c0965 100644 --- a/tasmota/language/el_GR.h +++ b/tasmota/language/el_GR.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_EL_GR_H_ diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index 9ea7bb50b..128e1c3bf 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_EN_GB_H_ diff --git a/tasmota/language/es_ES.h b/tasmota/language/es_ES.h index 88b371826..f88f62cdb 100644 --- a/tasmota/language/es_ES.h +++ b/tasmota/language/es_ES.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "muy bajo" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "tiempo de bomba excedido" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_ES_ES_H_ diff --git a/tasmota/language/fr_FR.h b/tasmota/language/fr_FR.h index f0c3031ed..01ae71a67 100644 --- a/tasmota/language/fr_FR.h +++ b/tasmota/language/fr_FR.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1082,10 +1086,4 @@ #define D_NEOPOOL_PH_LOW "Trop bas" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "durée pompage expirée" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_FR_FR_H_ diff --git a/tasmota/language/fy_NL.h b/tasmota/language/fy_NL.h index 486a540a1..0adcef573 100644 --- a/tasmota/language/fy_NL.h +++ b/tasmota/language/fy_NL.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_FY_NL_H_ diff --git a/tasmota/language/he_HE.h b/tasmota/language/he_HE.h index 44853211d..d00bac271 100644 --- a/tasmota/language/he_HE.h +++ b/tasmota/language/he_HE.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_HE_HE_H_ diff --git a/tasmota/language/hu_HU.h b/tasmota/language/hu_HU.h index 710d3ba3c..85db8bbce 100644 --- a/tasmota/language/hu_HU.h +++ b/tasmota/language/hu_HU.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_HU_HU_H_ diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h index 881f735e0..9fcb4b292 100644 --- a/tasmota/language/it_IT.h +++ b/tasmota/language/it_IT.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 - TX" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Battito cardiaco" +#define D_GPIO_SHIFT595_SRCLK "74x595 - SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 - RCLK" +#define D_GPIO_SHIFT595_OE "74x595 - OE" +#define D_GPIO_SHIFT595_SER "74x595 - SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "troppo basso" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "tempo pompa superato" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_IT_IT_H_ diff --git a/tasmota/language/ko_KO.h b/tasmota/language/ko_KO.h index 90c0f5138..365480ef5 100644 --- a/tasmota/language/ko_KO.h +++ b/tasmota/language/ko_KO.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_KO_KO_H_ diff --git a/tasmota/language/nl_NL.h b/tasmota/language/nl_NL.h index dcc075d19..991187eb4 100644 --- a/tasmota/language/nl_NL.h +++ b/tasmota/language/nl_NL.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "te laag" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pomptijd bereikt" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_NL_NL_H_ diff --git a/tasmota/language/pl_PL.h b/tasmota/language/pl_PL.h index dfd2c155b..770606fd8 100644 --- a/tasmota/language/pl_PL.h +++ b/tasmota/language/pl_PL.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "czas pompowania przekroczony" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_PL_PL_D_H_ diff --git a/tasmota/language/pt_BR.h b/tasmota/language/pt_BR.h index bcc837cd0..bb039ff4d 100644 --- a/tasmota/language/pt_BR.h +++ b/tasmota/language/pt_BR.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "Muito baixo" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "tempo da bomba excedido" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_PT_BR_H_ diff --git a/tasmota/language/pt_PT.h b/tasmota/language/pt_PT.h index 07804c950..89da9f494 100644 --- a/tasmota/language/pt_PT.h +++ b/tasmota/language/pt_PT.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "Muito baixo" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "tempo da bomba excedido" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_PT_PT_H_ diff --git a/tasmota/language/ro_RO.h b/tasmota/language/ro_RO.h index a87dda8bc..16e8f042b 100644 --- a/tasmota/language/ro_RO.h +++ b/tasmota/language/ro_RO.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_RO_RO_H_ diff --git a/tasmota/language/ru_RU.h b/tasmota/language/ru_RU.h index 7808dba8b..56233f278 100644 --- a/tasmota/language/ru_RU.h +++ b/tasmota/language/ru_RU.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "А" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_RU_RU_H_ diff --git a/tasmota/language/sk_SK.h b/tasmota/language/sk_SK.h index 0afdc669d..b3a1098e5 100644 --- a/tasmota/language/sk_SK.h +++ b/tasmota/language/sk_SK.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_SK_SK_H_ diff --git a/tasmota/language/sv_SE.h b/tasmota/language/sv_SE.h index e86ddd99a..aaf32fbde 100644 --- a/tasmota/language/sv_SE.h +++ b/tasmota/language/sv_SE.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_SV_SE_H_ diff --git a/tasmota/language/tr_TR.h b/tasmota/language/tr_TR.h index 13487d3b3..b9b2b7256 100644 --- a/tasmota/language/tr_TR.h +++ b/tasmota/language/tr_TR.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_TR_TR_H_ diff --git a/tasmota/language/uk_UA.h b/tasmota/language/uk_UA.h index da89a72a7..a9b1f98f6 100644 --- a/tasmota/language/uk_UA.h +++ b/tasmota/language/uk_UA.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "А" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_UK_UA_H_ diff --git a/tasmota/language/vi_VN.h b/tasmota/language/vi_VN.h index d5e4c5543..3bc724566 100644 --- a/tasmota/language/vi_VN.h +++ b/tasmota/language/vi_VN.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_VI_VN_H_ diff --git a/tasmota/language/zh_CN.h b/tasmota/language/zh_CN.h index 1ec0c7eac..d2d9f0d97 100644 --- a/tasmota/language/zh_CN.h +++ b/tasmota/language/zh_CN.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "A" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_ZH_CN_H_ diff --git a/tasmota/language/zh_TW.h b/tasmota/language/zh_TW.h index 5d3c7ced5..39f468e0b 100644 --- a/tasmota/language/zh_TW.h +++ b/tasmota/language/zh_TW.h @@ -843,6 +843,10 @@ #define D_SENSOR_HRG15_TX "HRG15 Tx" #define D_SENSOR_VINDRIKTNING_RX "VINDRIKTNING" #define D_SENSOR_HEARTBEAT "Heartbeat" +#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" +#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" +#define D_GPIO_SHIFT595_OE "74x595 OE" +#define D_GPIO_SHIFT595_SER "74x595 SER" // Units #define D_UNIT_AMPERE "安培" @@ -1083,10 +1087,4 @@ #define D_NEOPOOL_PH_LOW "too low" #define D_NEOPOOL_PUMP_TIME_EXCEEDED "pump time exceeded" -// xdrv_60_shift595.ino -#define D_GPIO_SHIFT595_SRCLK "74x595 SRCLK" -#define D_GPIO_SHIFT595_RCLK "74x595 RCLK" -#define D_GPIO_SHIFT595_OE "74x595 OE" -#define D_GPIO_SHIFT595_SER "74x595 SER" - #endif // _LANGUAGE_ZH_TW_H_ diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 9eb87e186..b77efe515 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -893,7 +893,7 @@ // -- Other sensors/drivers ----------------------- -// #define USE_SHIFT595 +//#define USE_SHIFT595 // Add support for 74xx595 8-bit shift registers (+0k7 code) #define SHIFT595_INVERT_OUTPUTS false // [SetOption133] Don't invert outputs of 74x595 shift register #define SHIFT595_DEVICE_COUNT 1 // [Shift595DeviceCount] Set the number of connected 74x595 shift registers diff --git a/tasmota/settings.h b/tasmota/settings.h index d8e8e23a2..8b7d1a956 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -161,8 +161,8 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t energy_phase : 1; // bit 15 (v9.5.0.9) - SetOption129 - (Energy) Show phase information uint32_t show_heap_with_timestamp : 1; // bit 16 (v9.5.0.9) - SetOption130 - (Debug) Show heap with logging timestamp uint32_t tuya_allow_dimmer_0 : 1; // bit 17 (v10.0.0.3) - SetOption131 - (Tuya) Allow save dimmer = 0 receved by MCU - uint32_t tls_use_fingerprint : 1; // bit 18 (v10.0.0.4) - SetOption132 - (TLS) use fingerprint validation instead of CA based - uint32_t shift595_invert_outputs : 1; // bit 19 (v10.0.0.4) - SetOption133 - (Shift595) invert outputs of 74x595 shift registers + uint32_t tls_use_fingerprint : 1; // bit 18 (v10.0.0.4) - SetOption132 - (TLS) Use fingerprint validation instead of CA based + uint32_t shift595_invert_outputs : 1; // bit 19 (v10.0.0.4) - SetOption133 - (Shift595) Invert outputs of 74x595 shift registers uint32_t spare20 : 1; // bit 20 uint32_t spare21 : 1; // bit 21 uint32_t spare22 : 1; // bit 22 diff --git a/tasmota/support_features.ino b/tasmota/support_features.ino index 0372c80c8..206735a15 100644 --- a/tasmota/support_features.ino +++ b/tasmota/support_features.ino @@ -784,7 +784,9 @@ void ResponseAppendFeatures(void) #ifdef USE_SONOFF_SPM feature8 |= 0x00040000; #endif -// feature8 |= 0x00080000; +#ifdef USE_SHIFT595 + feature8 |= 0x00080000; // xdrv_60_shift595.ino +#endif // feature8 |= 0x00100000; // feature8 |= 0x00200000; diff --git a/tasmota/xdrv_60_shift595.ino b/tasmota/xdrv_60_shift595.ino index cf9a3868c..4e816fc7e 100644 --- a/tasmota/xdrv_60_shift595.ino +++ b/tasmota/xdrv_60_shift595.ino @@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + #ifdef USE_SHIFT595 #define XDRV_60 60 @@ -33,34 +34,34 @@ struct Shift595 { bool connected = false; } *Shift595 = nullptr; -void Shift595ConfigurePin(uint8_t pin, uint8_t value = 0){ +void Shift595ConfigurePin(uint8_t pin, uint8_t value = 0) { pinMode(pin, OUTPUT); digitalWrite(pin, value); } -void Shift595Init(void) -{ +void Shift595Init(void) { if (PinUsed(GPIO_SHIFT595_SRCLK) && PinUsed(GPIO_SHIFT595_RCLK) && PinUsed(GPIO_SHIFT595_SER)) { Shift595 = (struct Shift595*)calloc(1, sizeof(struct Shift595)); - - Shift595->pinSRCLK = Pin(GPIO_SHIFT595_SRCLK); - Shift595->pinRCLK = Pin(GPIO_SHIFT595_RCLK); - Shift595->pinSER = Pin(GPIO_SHIFT595_SER); + if (Shift595) { + Shift595->pinSRCLK = Pin(GPIO_SHIFT595_SRCLK); + Shift595->pinRCLK = Pin(GPIO_SHIFT595_RCLK); + Shift595->pinSER = Pin(GPIO_SHIFT595_SER); - Shift595ConfigurePin(Shift595->pinSRCLK); - Shift595ConfigurePin(Shift595->pinRCLK); - Shift595ConfigurePin(Shift595->pinSER); - - if (PinUsed(GPIO_SHIFT595_OE)) { - Shift595->pinOE = Pin(GPIO_SHIFT595_OE); - Shift595ConfigurePin(Shift595->pinOE, 1); + Shift595ConfigurePin(Shift595->pinSRCLK); + Shift595ConfigurePin(Shift595->pinRCLK); + Shift595ConfigurePin(Shift595->pinSER); + + if (PinUsed(GPIO_SHIFT595_OE)) { + Shift595->pinOE = Pin(GPIO_SHIFT595_OE); + Shift595ConfigurePin(Shift595->pinOE, 1); + } + + Shift595->first = TasmotaGlobal.devices_present; + Shift595->outputs = Settings->shift595_device_count * 8; + TasmotaGlobal.devices_present += Shift595->outputs; + Shift595->connected = true; + AddLog(LOG_LEVEL_DEBUG, PSTR("595: Controlling relays POWER%d to POWER%d"), Shift595->first + 1, Shift595->first + Shift595->outputs); } - - Shift595->first = TasmotaGlobal.devices_present; - Shift595->outputs = Settings->shift595_device_count * 8; - TasmotaGlobal.devices_present += Shift595->outputs; - Shift595->connected = true; - AddLog(LOG_LEVEL_DEBUG, PSTR("595: Controlling relays POWER%d to POWER%d"), Shift595->first + 1, Shift595->first + Shift595->outputs); } } @@ -69,8 +70,7 @@ void Shift595LatchPin(uint8_t pin) { digitalWrite(pin, 0); } -void Shift595SwitchRelay(void) -{ +void Shift595SwitchRelay(void) { if (Shift595 && Shift595->connected == true) { for (uint32_t i = 0; i < Shift595->outputs; i++) { uint8_t relay_state = bitRead(XdrvMailbox.index, Shift595->first + Shift595->outputs -1 -i); @@ -81,9 +81,9 @@ void Shift595SwitchRelay(void) Shift595LatchPin(Shift595->pinRCLK); if (PinUsed(GPIO_SHIFT595_OE)) { - digitalWrite(Shift595->pinOE, 0); - } + digitalWrite(Shift595->pinOE, 0); } + } } void CmndShift595Devices(void) { @@ -98,8 +98,7 @@ void CmndShift595Devices(void) { * Interface \*********************************************************************************************/ -bool Xdrv60(uint8_t function) -{ +bool Xdrv60(uint8_t function) { bool result = false; if (FUNC_PRE_INIT == function) { diff --git a/tools/decode-status.py b/tools/decode-status.py index 6e70d8912..c234f8911 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -186,7 +186,8 @@ a_setoption = [[ "(Energy) Show phase information", "(Debug) Show heap with logging timestamp", "(Tuya) Allow save dimmer = 0 receved by MCU", - "","", + "(TLS) Use fingerprint validation instead of CA based", + "(Shift595) Invert outputs of 74x595 shift registers", "","","","", "","","","", "","","","" @@ -260,7 +261,7 @@ a_features = [[ "USE_BM8563","USE_ENERGY_DUMMY","USE_AM2320","USE_T67XX", "USE_MCP2515","USE_TASMESH","USE_WIFI_RANGE_EXTENDER","USE_INFLUXDB", "USE_HRG15","USE_VINDRIKTNING","USE_SCD40","USE_HM330X", - "USE_HDC2010","USE_LSC_MCSL","USE_SONOFF_SPM","", + "USE_HDC2010","USE_LSC_MCSL","USE_SONOFF_SPM","USE_SHIFT595", "","","","", "","","","", "","","","" @@ -291,7 +292,7 @@ else: obj = json.load(fp) def StartDecode(): - print ("\n*** decode-status.py v20211201 by Theo Arends and Jacek Ziolkowski ***") + print ("\n*** decode-status.py v20211205 by Theo Arends and Jacek Ziolkowski ***") # print("Decoding\n{}".format(obj))