mirror of
https://github.com/thelsing/knx.git
synced 2025-08-03 13:48:15 +02:00
improved/corrected prog button debouncing
This commit is contained in:
parent
b51c5950c5
commit
9ae4a47baf
@ -27,11 +27,16 @@
|
||||
ICACHE_RAM_ATTR void buttonEvent()
|
||||
{
|
||||
static uint32_t lastEvent=0;
|
||||
static uint32_t lastPressed=0;
|
||||
|
||||
uint32_t diff = millis() - lastEvent;
|
||||
if (diff >= PROG_BTN_PRESS_MIN_MILLIS && diff <= PROG_BTN_PRESS_MAX_MILLIS){
|
||||
knx.toggleProgMode();
|
||||
if (millis() - lastPressed > 200)
|
||||
{
|
||||
knx.toggleProgMode();
|
||||
lastPressed = millis();
|
||||
}
|
||||
}
|
||||
|
||||
lastEvent = millis();
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user