From 1bc9b46b5f151f663c978d501e3d38d8ab6a06b5 Mon Sep 17 00:00:00 2001 From: robsonek <13383294+robsonek@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:57:16 +0100 Subject: [PATCH 1/2] Implement toggle modes for userVar0 in stairway wipe Added toggle modes for userVar0 to control light states based on movement detection. --- .../stairway_wipe_basic/stairway_wipe_basic.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp b/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp index cddd655d6d..9e0f341de2 100644 --- a/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp +++ b/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp @@ -30,6 +30,19 @@ void setup() { //has to be set to 1 if movement is detected on the PIR that is the same side of the staircase as the ESP8266 //has to be set to 2 if movement is detected on the PIR that is the opposite side //can be set to 0 if no movement is detected. Otherwise LEDs will turn off after a configurable timeout (userVar1 seconds) + //U0 = 3: Toggle mode for direction 1 (if off, turn on with U0=1; if on, turn off with U0=0) + //U0 = 4: Toggle mode for direction 2 (if off, turn on with U0=2; if on, turn off with U0=0) + + // Handle toggle modes U0=3 and U0=4 + if (userVar0 == 3 || userVar0 == 4) { + if (wipeState == 0 || wipeState == 3 || wipeState == 4) { + // Lights are off or turning off, so turn them on + userVar0 = (userVar0 == 3) ? 1 : 2; + } else { + // Lights are on or turning on, so turn them off + userVar0 = 0; + } + } if (userVar0 > 0) { @@ -129,4 +142,4 @@ void setup() { static StairwayWipeUsermod stairway_wipe_basic; -REGISTER_USERMOD(stairway_wipe_basic); \ No newline at end of file +REGISTER_USERMOD(stairway_wipe_basic); From 2cd55243ca65b5ca56866de7086d784af0033c51 Mon Sep 17 00:00:00 2001 From: robsonek <13383294+robsonek@users.noreply.github.com> Date: Tue, 25 Nov 2025 21:38:47 +0100 Subject: [PATCH 2/2] Reset wipeState on toggle modes U0=3 and U0=4 Reset wipeState to 0 for fresh state machine start. --- usermods/stairway_wipe_basic/stairway_wipe_basic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp b/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp index 9e0f341de2..101a477b0f 100644 --- a/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp +++ b/usermods/stairway_wipe_basic/stairway_wipe_basic.cpp @@ -37,6 +37,7 @@ void setup() { if (userVar0 == 3 || userVar0 == 4) { if (wipeState == 0 || wipeState == 3 || wipeState == 4) { // Lights are off or turning off, so turn them on + wipeState = 0; // Reset state so the state machine starts fresh userVar0 = (userVar0 == 3) ? 1 : 2; } else { // Lights are on or turning on, so turn them off