diff --git a/Joystick.cpp b/Joystick.cpp index 9712454..de8e1e0 100644 --- a/Joystick.cpp +++ b/Joystick.cpp @@ -55,7 +55,8 @@ void Joystick::AddButton(uint8_t pin, ButtonType type, bool pullup) { // todo: fail here } - _buttons.push_back(button); + _buttons[_num_buttons] = button; + _num_buttons++; last_button_index += increment; if (type & _BUTTON_PULSED_TYPES) _have_pulsed_button = true; @@ -69,8 +70,8 @@ void Joystick::AddAxis(uint8_t pin) { void Joystick::Update() { JoyReport oldReport = _joyReport; - for (list