For pulsed buttons, implement per-button 'timers' that independently end the pulse instead of having a 250ms delay between every single update...

This commit is contained in:
Anna Rose Wiggins 2021-11-13 22:48:12 +00:00
parent 3b69b7e960
commit 1a4916fd0e
4 changed files with 43 additions and 25 deletions

View file

@ -75,6 +75,8 @@ class PulsedButton : public SwitchButton {
protected:
bool double_action;
bool split;
unsigned long release_time1;
unsigned long release_time2;
uint8_t vbutton2;
};
@ -88,9 +90,8 @@ class EncoderButton : public Button {
Encoder* encoder;
long last_value;
uint8_t vbutton2;
unsigned long release_time1;
unsigned long release_time2;
};
// Internal use only.
#define _BUTTON_PULSED_TYPES (BUTTON_PULSED | BUTTON_PULSED_DOUBLE_ACTION | BUTTON_PULSED_DOUBLE_ACTION_SPLIT | ENCODER_PULSED_SPLIT)
#endif