From 8e2d41f37fe79a02382ee858a3979090f8a28349 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 8 Oct 2014 11:41:07 -0700 Subject: [PATCH] remove deadzone handling from Joystick class --- interface/src/devices/Joystick.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/interface/src/devices/Joystick.cpp b/interface/src/devices/Joystick.cpp index f636e47a42..fe67eaceaa 100644 --- a/interface/src/devices/Joystick.cpp +++ b/interface/src/devices/Joystick.cpp @@ -42,14 +42,12 @@ void Joystick::update() { #ifdef HAVE_SDL // update our current values, emit a signal when there is a change for (int j = 0; j < getNumAxes(); j++) { - float value = glm::round(SDL_JoystickGetAxis(_sdlJoystick, j) + 0.5f) / std::numeric_limits::max(); - const float DEAD_ZONE = 0.1f; - float cleanValue = glm::abs(value) < DEAD_ZONE ? 0.0f : value; - - if (_axes[j] != cleanValue) { + float newValue = glm::round(SDL_JoystickGetAxis(_sdlJoystick, j) + 0.5f) / std::numeric_limits::max(); + + if (_axes[j] != newValue) { float oldValue = _axes[j]; - _axes[j] = cleanValue; - emit axisValueChanged(j, cleanValue, oldValue); + _axes[j] = newValue; + emit axisValueChanged(j, newValue, oldValue); } } for (int j = 0; j < getNumButtons(); j++) {