From 8bb562e880f4e4e1eb4ff0ec74f501034f045ba1 Mon Sep 17 00:00:00 2001 From: marsman7 Date: Mon, 14 Aug 2023 20:41:24 +0200 Subject: [PATCH 1/3] Creates a place to put the customer boards --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3a575e21aca8..82c56687b3bc 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ .cache data unpacked_fs +unpacked_boards tasmota/user_config_override.h build build_output/* From 24cecdf48437ede9330438eb25830062b01c0b90 Mon Sep 17 00:00:00 2001 From: marsman7 Date: Wed, 16 Aug 2023 20:32:21 +0200 Subject: [PATCH 2/3] Adds rule variable power and switch The variables can be used to query or logic operation of the current status of the inputs and outputs. For example, in a 3-sockets with USB output, the USB output can be switched on when one of the sockets is switched on: rule1 on power1#state do event usbpower endon on power2#state do event usbpower endon on power3#state do event usbpower endon rule2 on event#usbpower do if ( %power1%==1 or %power2%==1 or %power3%==1 ) power4 1 else power4 0 endif endon or if you want to send a message when the inputs have a defined status: rule3 on event#test do if ( %switch1%==1 and %switch2%==0 and %switch3%==1 ) publish stat/foo/bar hello endif endon To use the examples the feature #define USE_EXPRESSION and #define SUPPORT_IF_STATEMENT must compiled in. --- tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino index 8fe9f2d50a33..2fa3435898b0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino @@ -823,6 +823,15 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved) RulesVarReplace(commands, F("%ZBENDPOINT%"), String(Z_GetLastEndpoint())); #endif + for (uint32_t i = 0; i < MAX_RELAYS; i++) { + snprintf_P(stemp, sizeof(stemp), PSTR("%%POWER%d%%"), i +1); + RulesVarReplace(commands, stemp, String(bitRead(TasmotaGlobal.power, i))); + } + for (uint32_t i = 0; i < MAX_SWITCHES_SET; i++) { + snprintf_P(stemp, sizeof(stemp), PSTR("%%SWITCH%d%%"), i +1); + RulesVarReplace(commands, stemp, String(SwitchState(i))); + } + char command[commands.length() +1]; strlcpy(command, commands.c_str(), sizeof(command)); From 3fd10328f96ff1ec36ce46941fecb23e5f2362ed Mon Sep 17 00:00:00 2001 From: marsman7 Date: Thu, 17 Aug 2023 21:07:09 +0200 Subject: [PATCH 3/3] Display invert setting after tasmota start in uDisplay driver In uDisplay Driver "Display invert" is fix set to false in "DisplayInit()"-function. After tasmota is started display invert is every time off. The display command shows '... "Invert":1 ...' but it is off. In display discriptor file initial register (:I) is register for invert set on but invert on display is off. The "DisplayInit()"-function overwrite this. With this fix the user can define the display invert status after start in two ways. - Console command "displayinvert 1", the value is store persistent or - With the discriptor element in "display.ini" discriptor file :n,X Defines optional display invert X=0 or 1 The discriptor element is optional and if exist overwrites the persistent "displayinvert" value. I tested it with an ST7789, ILI9341 and GC9A01 display. --- tasmota/tasmota_xdsp_display/xdsp_17_universal.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino b/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino index 5482183eb87d..5fadb30646e6 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino @@ -454,6 +454,16 @@ int8_t cs; Settings->display_width = renderer->width(); Settings->display_height = renderer->height(); + bool iniinv = Settings->display_options.invert; + + cp = strstr(ddesc, ":n,"); + if (cp) { + cp+=3; + iniinv = strtol(cp, &cp, 10); + Settings->display_options.invert = iniinv; + } + renderer->invertDisplay(iniinv); + ApplyDisplayDimmer(); #ifdef SHOW_SPLASH