Add some logic to the encoder to only register a button press after a certain number of inputs.
This commit is contained in:
4
Button.h
4
Button.h
@ -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
|
||||
|
Reference in New Issue
Block a user