Add some logic to the encoder to only register a button press after a certain number of inputs.

This commit is contained in:
2021-12-21 04:16:07 +00:00
parent 4c5b51f7b8
commit 145e383bc5
5 changed files with 20 additions and 7 deletions

View File

@ -63,7 +63,7 @@ class PulsedButton : public Button {
class EncoderButton : public Button {
public:
EncoderButton(uint8_t pin1, uint8_t pin2, uint8_t vbutton);
EncoderButton(uint8_t pin1, uint8_t pin2, uint8_t vbutton, int8_t tick_threshold);
bool Update(Joystick* js);
protected:
@ -72,6 +72,8 @@ class EncoderButton : public Button {
uint8_t vbutton2;
unsigned long release_time1;
unsigned long release_time2;
int8_t ticks;
int8_t tick_threshold;
};
#endif