Debounce the rest of the buttons
This commit is contained in:
parent
7c2e245796
commit
0eeafa9393
|
@ -51,13 +51,22 @@ void read_buttons(){
|
|||
Stw_data.Stw_shift_down = debouncer[4].rose();
|
||||
Stw_data.Stw_shift_up = debouncer[5].rose();
|
||||
|
||||
// These are also used for GUI, so if we set them only at rising edge, they
|
||||
// might never be high when checked in the GUI.
|
||||
// TODO: Rewrite so we can use debounced values here as well
|
||||
Stw_data.buttonState1 = digitalRead(button1);
|
||||
Stw_data.buttonState4 = digitalRead(button4);
|
||||
Stw_data.buttonStateEnc1 = digitalRead(enc1PinS);
|
||||
Stw_data.buttonStateEnc2 = digitalRead(enc2PinS);
|
||||
if (debouncer[0].rose()) {
|
||||
Stw_data.button1_rises++;
|
||||
}
|
||||
if (debouncer[3].rose()) {
|
||||
Stw_data.button4_rises++;
|
||||
}
|
||||
if (debouncer[6].rose()) {
|
||||
Stw_data.enc1_rises++;
|
||||
}
|
||||
if (debouncer[7].rose()) {
|
||||
Stw_data.enc2_rises++;
|
||||
}
|
||||
}
|
||||
|
||||
void read_rotary(){
|
||||
|
|
|
@ -69,6 +69,10 @@ typedef struct
|
|||
uint8_t trc;
|
||||
uint8_t mode;
|
||||
|
||||
uint8_t button1_rises;
|
||||
uint8_t button4_rises;
|
||||
uint8_t enc1_rises;
|
||||
uint8_t enc2_rises;
|
||||
} stw_data_type;
|
||||
|
||||
typedef struct
|
||||
|
|
Loading…
Reference in New Issue