Browse Source

Fix joystick button off-by-one error (#16037)

pull/16042/head 0.15.17
Ryan 2 years ago
committed by GitHub
parent
commit
3e0ee6fb74
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      quantum/process_keycode/process_joystick.c

+ 3
- 2
quantum/process_keycode/process_joystick.c View File

@ -28,10 +28,11 @@ bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record) {
if (keycode < JS_BUTTON0 || keycode > JS_BUTTON_MAX) {
return true;
} else {
uint8_t button_idx = (keycode - JS_BUTTON0);
if (record->event.pressed) {
joystick_status.buttons[(keycode - JS_BUTTON0) / 8] |= 1 << (keycode % 8);
joystick_status.buttons[button_idx / 8] |= 1 << (button_idx % 8);
} else {
joystick_status.buttons[(keycode - JS_BUTTON0) / 8] &= ~(1 << (keycode % 8));
joystick_status.buttons[button_idx / 8] &= ~(1 << (button_idx % 8));
}
joystick_status.status |= JS_UPDATED;


Loading…
Cancel
Save