Browse Source

Fixed multiple toggles due to repeated code

some remotes repeat the code within 200ms thus toggling the relay twice , this fixes the toggle function.
rfm69
Darsh Patel 6 years ago
committed by GitHub
parent
commit
5ce9025401
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      code/espurna/ir.ino

+ 6
- 1
code/espurna/ir.ino View File

@ -14,7 +14,7 @@ Copyright (C) 2017-2018 by François Déchery
IRrecv * _ir_recv;
decode_results _ir_results;
unsigned long last = millis();
// -----------------------------------------------------------------------------
// PRIVATE
// -----------------------------------------------------------------------------
@ -43,7 +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);
}
else{
DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n"));
}
}
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE


Loading…
Cancel
Save