summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_joystick.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/process_keycode/process_joystick.c')
-rw-r--r--quantum/process_keycode/process_joystick.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/quantum/process_keycode/process_joystick.c b/quantum/process_keycode/process_joystick.c
index 5778a7434c..3ffaf42bf8 100644
--- a/quantum/process_keycode/process_joystick.c
+++ b/quantum/process_keycode/process_joystick.c
@@ -129,17 +129,17 @@ bool process_joystick_analogread_quantum() {
// test the converted value against the lower range
int32_t ref = joystick_axes[axis_index].mid_digit;
int32_t range = joystick_axes[axis_index].min_digit;
- int32_t ranged_val = ((axis_val - ref) * -127) / (range - ref);
+ int32_t ranged_val = ((axis_val - ref) * -JOYSTICK_RESOLUTION) / (range - ref);
if (ranged_val > 0) {
// the value is in the higher range
range = joystick_axes[axis_index].max_digit;
- ranged_val = ((axis_val - ref) * 127) / (range - ref);
+ ranged_val = ((axis_val - ref) * JOYSTICK_RESOLUTION) / (range - ref);
}
// clamp the result in the valid range
- ranged_val = ranged_val < -127 ? -127 : ranged_val;
- ranged_val = ranged_val > 127 ? 127 : ranged_val;
+ ranged_val = ranged_val < -JOYSTICK_RESOLUTION ? -JOYSTICK_RESOLUTION : ranged_val;
+ ranged_val = ranged_val > JOYSTICK_RESOLUTION ? JOYSTICK_RESOLUTION : ranged_val;
if (ranged_val != joystick_status.axes[axis_index]) {
joystick_status.axes[axis_index] = ranged_val;