diff --git a/code/espurna/ir.ino b/code/espurna/ir.ino index 5cadae7e..5a197417 100644 --- a/code/espurna/ir.ino +++ b/code/espurna/ir.ino @@ -14,7 +14,7 @@ Copyright (C) 2017-2018 by François Déchery IRrecv * _ir_recv; decode_results _ir_results; -unsigned long last = millis(); +unsigned long _ir_last = millis(); // ----------------------------------------------------------------------------- // PRIVATE // ----------------------------------------------------------------------------- @@ -43,11 +43,12 @@ void _irProcessCode(unsigned long code) { relayStatus(0, button_value); } if (button_mode == IR_BUTTON_MODE_TOGGLE) { - if (millis() - last > 250){ - relayToggle(button_value); + if (millis() - _ir_last > 250){ + relayToggle(button_value); + _ir_last = millis(); } else{ - DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n")); + DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n")); } } #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE