Skip to content

Commit

Permalink
SDL2: Force user to recalibrate on SDL2 update.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjehangir committed Oct 5, 2016
1 parent 1f10999 commit 1e920e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Joystick/Joystick.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ QGC_LOGGING_CATEGORY(JoystickLog, "JoystickLog")
QGC_LOGGING_CATEGORY(JoystickValuesLog, "JoystickValuesLog")

const char* Joystick::_settingsGroup = "Joysticks";
const char* Joystick::_calibratedSettingsKey = "Calibrated";
const char* Joystick::_calibratedSettingsKey = "Calibrated1"; // Increment number to force recalibration
const char* Joystick::_buttonActionSettingsKey = "ButtonActionName%1";
const char* Joystick::_throttleModeSettingsKey = "ThrottleMode";
const char* Joystick::_exponentialSettingsKey = "Exponential";
Expand Down Expand Up @@ -369,6 +369,11 @@ void Joystick::startPolling(Vehicle* vehicle)
// Always set up the new vehicle
_activeVehicle = vehicle;

// If joystick is not calibrated, disable it
if ( !_calibrated ) {
vehicle->setJoystickEnabled(false);
}

// Only connect the new vehicle if it wants joystick data
if (vehicle->joystickEnabled()) {
_pollingStartedForCalibration = false;
Expand Down

0 comments on commit 1e920e3

Please sign in to comment.