Browse Source

Fixed Windows compilation of Joystick interface (MSVC doesn't support C99 & the NAN macro).

QGC4.4
Bryant 12 years ago
parent
commit
8b4ecdd37d
  1. 13
      src/input/JoystickInput.cc

13
src/input/JoystickInput.cc

@ -20,6 +20,9 @@
#include <QMutexLocker> #include <QMutexLocker>
#include <QSettings> #include <QSettings>
#include <math.h> #include <math.h>
#include <limits>
using namespace std;
/** /**
* The coordinate frame of the joystick axis is the aeronautical frame like shown on this image: * The coordinate frame of the joystick axis is the aeronautical frame like shown on this image:
@ -473,10 +476,10 @@ void JoystickInput::run()
// Now signal an update for all UI together. // Now signal an update for all UI together.
if (isEnabled) if (isEnabled)
{ {
float roll = rollAxis > -1?joystickAxes[rollAxis]:NAN; float roll = rollAxis > -1?joystickAxes[rollAxis]:numeric_limits<float>::quiet_NaN();
float pitch = pitchAxis > -1?joystickAxes[pitchAxis]:NAN; float pitch = pitchAxis > -1?joystickAxes[pitchAxis]:numeric_limits<float>::quiet_NaN();
float yaw = yawAxis > -1?joystickAxes[yawAxis]:NAN; float yaw = yawAxis > -1?joystickAxes[yawAxis]:numeric_limits<float>::quiet_NaN();
float throttle = throttleAxis > -1?joystickAxes[throttleAxis]:NAN; float throttle = throttleAxis > -1?joystickAxes[throttleAxis]:numeric_limits<float>::quiet_NaN();
emit joystickChanged(roll, pitch, yaw, throttle, xHat, yHat, joystickButtons); emit joystickChanged(roll, pitch, yaw, throttle, xHat, yHat, joystickButtons);
} }
@ -513,7 +516,7 @@ void JoystickInput::setActiveJoystick(int id)
joystickAxes.clear(); joystickAxes.clear();
for (int i = 0; i < joystickNumAxes; i++) for (int i = 0; i < joystickNumAxes; i++)
{ {
joystickAxes.append(NAN); joystickAxes.append(numeric_limits<float>::quiet_NaN());
} }
// Update cached joystick button values. // Update cached joystick button values.

Loading…
Cancel
Save