Speculative fix for latched buttons.
This commit is contained in:
parent
a89a74ac3f
commit
9ae0777c6b
|
@ -134,8 +134,6 @@ void Joystick::_ReleasePulsedButtons() {
|
||||||
for (uint8_t i = 0; i < _num_buttons; i++) {
|
for (uint8_t i = 0; i < _num_buttons; i++) {
|
||||||
if (_buttons[i].type & _BUTTON_PULSED_TYPES) ReleaseButton(i);
|
if (_buttons[i].type & _BUTTON_PULSED_TYPES) ReleaseButton(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_debug) Serial.println("DEBUG: Pulse button release recorded.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joystick::Write() {
|
void Joystick::Write() {
|
||||||
|
@ -164,8 +162,8 @@ void Joystick::_UpdateButton(Button& button, uint8_t index) {
|
||||||
|
|
||||||
switch (button.type) {
|
switch (button.type) {
|
||||||
case BUTTON_LATCHED:
|
case BUTTON_LATCHED:
|
||||||
if (value == HIGH) PressButton(index);
|
if (value == HIGH && button.last_state != HIGH) PressButton(index);
|
||||||
else ReleaseButton(index);
|
else if (value == LOW && button.last_state != LOW) ReleaseButton(index);
|
||||||
break;
|
break;
|
||||||
case BUTTON_PULSED:
|
case BUTTON_PULSED:
|
||||||
if (value == HIGH && button.last_state == LOW) PressButton(index);
|
if (value == HIGH && button.last_state == LOW) PressButton(index);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user