diff options
-rw-r--r-- | quantum/process_keycode/process_joystick.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/quantum/process_keycode/process_joystick.c b/quantum/process_keycode/process_joystick.c index 3ffaf42bf..fa9c2c1db 100644 --- a/quantum/process_keycode/process_joystick.c +++ b/quantum/process_keycode/process_joystick.c | |||
@@ -28,10 +28,11 @@ bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record) { | |||
28 | if (keycode < JS_BUTTON0 || keycode > JS_BUTTON_MAX) { | 28 | if (keycode < JS_BUTTON0 || keycode > JS_BUTTON_MAX) { |
29 | return true; | 29 | return true; |
30 | } else { | 30 | } else { |
31 | uint8_t button_idx = (keycode - JS_BUTTON0); | ||
31 | if (record->event.pressed) { | 32 | if (record->event.pressed) { |
32 | joystick_status.buttons[(keycode - JS_BUTTON0) / 8] |= 1 << (keycode % 8); | 33 | joystick_status.buttons[button_idx / 8] |= 1 << (button_idx % 8); |
33 | } else { | 34 | } else { |
34 | joystick_status.buttons[(keycode - JS_BUTTON0) / 8] &= ~(1 << (keycode % 8)); | 35 | joystick_status.buttons[button_idx / 8] &= ~(1 << (button_idx % 8)); |
35 | } | 36 | } |
36 | 37 | ||
37 | joystick_status.status |= JS_UPDATED; | 38 | joystick_status.status |= JS_UPDATED; |