|
|
@ -68,8 +68,8 @@ uint8_t mapEvent(uint8_t event, uint8_t count, uint16_t length) { |
|
|
|
if (event == EVENT_CHANGED) return BUTTON_EVENT_CLICK; |
|
|
|
if (event == EVENT_RELEASED) { |
|
|
|
if (count == 1) { |
|
|
|
if (length > BUTTON_LNGLNGCLICK_LENGTH) return BUTTON_EVENT_LNGLNGCLICK; |
|
|
|
if (length > BUTTON_LNGCLICK_LENGTH) return BUTTON_EVENT_LNGCLICK; |
|
|
|
if (length > BUTTON_LNGLNGCLICK_DELAY) return BUTTON_EVENT_LNGLNGCLICK; |
|
|
|
if (length > BUTTON_LNGCLICK_DELAY) return BUTTON_EVENT_LNGCLICK; |
|
|
|
return BUTTON_EVENT_CLICK; |
|
|
|
} |
|
|
|
if (count == 2) return BUTTON_EVENT_DBLCLICK; |
|
|
@ -121,25 +121,25 @@ void buttonSetup() { |
|
|
|
#ifdef BUTTON1_PIN
|
|
|
|
{ |
|
|
|
unsigned int actions = buttonStore(BUTTON1_PRESS, BUTTON1_CLICK, BUTTON1_DBLCLICK, BUTTON1_LNGCLICK, BUTTON1_LNGLNGCLICK); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON1_PIN, BUTTON1_MODE), actions, BUTTON1_RELAY}); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON1_PIN, BUTTON1_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON1_RELAY}); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
#ifdef BUTTON2_PIN
|
|
|
|
{ |
|
|
|
unsigned int actions = buttonStore(BUTTON2_PRESS, BUTTON2_CLICK, BUTTON2_DBLCLICK, BUTTON2_LNGCLICK, BUTTON2_LNGLNGCLICK); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON2_PIN, BUTTON2_MODE), actions, BUTTON2_RELAY}); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON2_PIN, BUTTON2_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON2_RELAY}); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
#ifdef BUTTON3_PIN
|
|
|
|
{ |
|
|
|
unsigned int actions = buttonStore(BUTTON3_PRESS, BUTTON3_CLICK, BUTTON3_DBLCLICK, BUTTON3_LNGCLICK, BUTTON3_LNGLNGCLICK); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON3_PIN, BUTTON3_MODE), actions, BUTTON3_RELAY}); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON3_PIN, BUTTON3_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON3_RELAY}); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
#ifdef BUTTON4_PIN
|
|
|
|
{ |
|
|
|
unsigned int actions = buttonStore(BUTTON4_PRESS, BUTTON4_CLICK, BUTTON4_DBLCLICK, BUTTON4_LNGCLICK, BUTTON4_LNGLNGCLICK); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON4_PIN, BUTTON4_MODE), actions, BUTTON4_RELAY}); |
|
|
|
_buttons.push_back({new DebounceEvent(BUTTON4_PIN, BUTTON4_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON4_RELAY}); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|