Browse Source

Merge pull request #823 from darshkpatel/dev

Fixed multiple toggles due to repeated code
rfm69
Xose Pérez 6 years ago
committed by GitHub
parent
commit
3da35fa647
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      code/espurna/ir.ino

+ 8
- 2
code/espurna/ir.ino View File

@ -14,7 +14,7 @@ Copyright (C) 2017-2018 by François Déchery
IRrecv * _ir_recv; IRrecv * _ir_recv;
decode_results _ir_results; decode_results _ir_results;
unsigned long _ir_last = millis();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// PRIVATE // PRIVATE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -43,7 +43,13 @@ void _irProcessCode(unsigned long code) {
relayStatus(0, button_value); relayStatus(0, button_value);
} }
if (button_mode == IR_BUTTON_MODE_TOGGLE) { if (button_mode == IR_BUTTON_MODE_TOGGLE) {
relayToggle(button_value);
if (millis() - _ir_last > 250){
relayToggle(button_value);
_ir_last = millis();
}
else{
DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n"));
}
} }
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE


Loading…
Cancel
Save