Skip to content

Commit

Permalink
Added compiler option for doubleclick window
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbode authored Aug 31, 2023
1 parent 2872e1b commit 61867c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tasmota/tasmota_support/support_button_v4.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

#define MAX_RELAY_BUTTON1 5 // Max number of relay controlled by BUTTON1

#ifndef DOUBLE_CLICK_WINDOW
#define DOUBLE_CLICK_WINDOW 500 // Define Window size to recognize double clicks
#endif

const uint8_t BUTTON_PROBE_INTERVAL = 10; // Time in milliseconds between button input probe
const uint8_t BUTTON_FAST_PROBE_INTERVAL = 2; // Time in milliseconds between button input probe for AC detection
const uint8_t BUTTON_AC_PERIOD = (20 + BUTTON_FAST_PROBE_INTERVAL - 1) / BUTTON_FAST_PROBE_INTERVAL; // Duration of an AC wave in probe intervals
Expand Down Expand Up @@ -457,7 +461,7 @@ void ButtonHandler(void) {
} else {
Button.press_counter[button_index] = (Button.window_timer[button_index]) ? Button.press_counter[button_index] +1 : 1;
AddLog(LOG_LEVEL_DEBUG, PSTR("BTN: Button%d multi-press %d"), button_index +1, Button.press_counter[button_index]);
Button.window_timer[button_index] = loops_per_second / 2; // 0.5 second multi press window
Button.window_timer[button_index] = uint32_t(DOUBLE_CLICK_WINDOW * loops_per_second) / 100;
}
TasmotaGlobal.blinks = 201;
}
Expand Down

0 comments on commit 61867c6

Please sign in to comment.