This commit is contained in:
Blaz Kristan 2023-02-05 17:57:22 +01:00
parent c041d39cab
commit 48c267c5c1

View File

@ -114,6 +114,7 @@ private:
if (m_offOnly && bri && (switchOn || (!PIRtriggered && !switchOn))) return; //if lights on and off only, do nothing if (m_offOnly && bri && (switchOn || (!PIRtriggered && !switchOn))) return; //if lights on and off only, do nothing
if (PIRtriggered && switchOn) return; //if already on and triggered before, do nothing if (PIRtriggered && switchOn) return; //if already on and triggered before, do nothing
PIRtriggered = switchOn; PIRtriggered = switchOn;
DEBUG_PRINT(F("PIR: strip=")); DEBUG_PRINTLN(switchOn?"on":"off");
if (switchOn) { if (switchOn) {
if (m_onPreset) { if (m_onPreset) {
if (currentPlaylist>0 && !offMode) { if (currentPlaylist>0 && !offMode) {
@ -374,8 +375,10 @@ public:
* onStateChanged() is used to detect WLED state change * onStateChanged() is used to detect WLED state change
*/ */
void onStateChange(uint8_t mode) { void onStateChange(uint8_t mode) {
if (PIRtriggered) { DEBUG_PRINT(F("PIR: offTimerStart=")); DEBUG_PRINTLN(offTimerStart);
DEBUG_PRINTLN(F("PIR canceled.")); if (PIRtriggered && offTimerStart) {
// checking PIRtriggered and offTimerStart will prevent cancellation upon On trigger
DEBUG_PRINTLN(F("PIR: Canceled."));
offTimerStart = 0; offTimerStart = 0;
PIRtriggered = false; PIRtriggered = false;
} }