Fix for missing off-only MQTT messages.

This commit is contained in:
Blaz Kristan 2021-07-28 22:50:29 +02:00
parent 2e9bd477d9
commit 07d11c845c

View File

@ -122,6 +122,7 @@ private:
*/ */
void switchStrip(bool switchOn) void switchStrip(bool switchOn)
{ {
if (m_offOnly && bri && (switchOn || (!PIRtriggered && !switchOn))) return;
PIRtriggered = switchOn; PIRtriggered = switchOn;
if (switchOn && m_onPreset) { if (switchOn && m_onPreset) {
applyPreset(m_onPreset); applyPreset(m_onPreset);
@ -227,7 +228,7 @@ public:
void loop() void loop()
{ {
// only check sensors 4x/s // only check sensors 4x/s
if (!enabled || millis() - lastLoop < 250 || strip.isUpdating() || (m_offOnly && bri && !PIRtriggered)) return; if (!enabled || millis() - lastLoop < 250 || strip.isUpdating()) return;
lastLoop = millis(); lastLoop = millis();
if (!updatePIRsensorState()) { if (!updatePIRsensorState()) {