From c501d159a90bcc0525eef5af8a6978e9fe334f79 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 3 Oct 2021 14:10:21 -0700
Subject: [PATCH] Fixed range for Steam Controller sensor values
---
src/joystick/hidapi/SDL_hidapi_steam.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c
index b015e6ba22..fdec0f072c 100644
--- a/src/joystick/hidapi/SDL_hidapi_steam.c
+++ b/src/joystick/hidapi/SDL_hidapi_steam.c
@@ -1236,14 +1236,14 @@ HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device)
if (ctx->report_sensors) {
float values[3];
- values[0] = (ctx->m_state.sGyroX / 32767.0f) * (2000.0f * (M_PI / 180.0f));
- values[1] = (ctx->m_state.sGyroZ / 32767.0f) * (2000.0f * (M_PI / 180.0f));
- values[2] = (ctx->m_state.sGyroY / 32767.0f) * (2000.0f * (M_PI / 180.0f));
+ values[0] = (ctx->m_state.sGyroX / 32768.0f) * (2000.0f * (M_PI / 180.0f));
+ values[1] = (ctx->m_state.sGyroZ / 32768.0f) * (2000.0f * (M_PI / 180.0f));
+ values[2] = (ctx->m_state.sGyroY / 32768.0f) * (2000.0f * (M_PI / 180.0f));
SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, values, 3);
- values[0] = (ctx->m_state.sAccelX / 32767.0f) * 2.0f * SDL_STANDARD_GRAVITY;
- values[1] = (ctx->m_state.sAccelZ / 32767.0f) * 2.0f * SDL_STANDARD_GRAVITY;
- values[2] = (-ctx->m_state.sAccelY / 32767.0f) * 2.0f * SDL_STANDARD_GRAVITY;
+ values[0] = (ctx->m_state.sAccelX / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY;
+ values[1] = (ctx->m_state.sAccelZ / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY;
+ values[2] = (-ctx->m_state.sAccelY / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY;
SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, values, 3);
}