diff --git a/Joystick.cpp b/Joystick.cpp index e27492c..1bef20d 100644 --- a/Joystick.cpp +++ b/Joystick.cpp @@ -134,8 +134,6 @@ void Joystick::_ReleasePulsedButtons() { for (uint8_t i = 0; i < _num_buttons; i++) { if (_buttons[i].type & _BUTTON_PULSED_TYPES) ReleaseButton(i); } - - if (_debug) Serial.println("DEBUG: Pulse button release recorded."); } void Joystick::Write() { @@ -164,8 +162,8 @@ void Joystick::_UpdateButton(Button& button, uint8_t index) { switch (button.type) { case BUTTON_LATCHED: - if (value == HIGH) PressButton(index); - else ReleaseButton(index); + if (value == HIGH && button.last_state != HIGH) PressButton(index); + else if (value == LOW && button.last_state != LOW) ReleaseButton(index); break; case BUTTON_PULSED: if (value == HIGH && button.last_state == LOW) PressButton(index);