Add some additionally debugging, fix the 'ole broken switch statement.

This commit is contained in:
Anna Rose Wiggins 2021-11-09 06:11:36 +00:00
parent a69c2d3364
commit e09c21edf1
4 changed files with 46 additions and 17 deletions

View file

@ -25,7 +25,7 @@ enum ButtonType {
class Button {
public:
Button(uint8_t vbutton);
virtual void Update(Joystick* js) = 0;
virtual bool Update(Joystick* js) = 0;
virtual void ReleaseButtons(Joystick* js);
ButtonType type;
@ -41,7 +41,6 @@ class Button {
class SwitchButton : public Button {
public:
SwitchButton(uint8_t pin, uint8_t vbutton, bool pullup, Mux* mux);
virtual void Update(Joystick* js) = 0;
bool BouncerUpdate(); // returns true if the pin's status has changed
bool On();
@ -55,13 +54,13 @@ class SwitchButton : public Button {
class PassthruButton : public SwitchButton {
public:
PassthruButton(uint8_t pin, uint8_t vbutton, bool pullup = true, Mux* mux = NULL);
void Update(Joystick* js);
bool Update(Joystick* js);
};
class LatchedButton : public SwitchButton {
public:
LatchedButton(uint8_t pin, uint8_t vbutton, bool pullup = true, Mux* mux = NULL);
void Update(Joystick* js);
bool Update(Joystick* js);
protected:
bool pressed;
@ -70,7 +69,7 @@ class LatchedButton : public SwitchButton {
class PulsedButton : public SwitchButton {
public:
PulsedButton(uint8_t pin, uint8_t vbutton, bool double_action = false, bool split = false, bool pullup = true, Mux* mux = NULL);
void Update(Joystick* js);
bool Update(Joystick* js);
void ReleaseButtons(Joystick* js);
protected:
@ -82,7 +81,7 @@ class PulsedButton : public SwitchButton {
class EncoderButton : public Button {
public:
EncoderButton(uint8_t pin1, uint8_t pin2, uint8_t vbutton);
void Update(Joystick* js);
bool Update(Joystick* js);
void ReleaseButtons(Joystick* js);
protected: