Commit 2f8cd513 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #2186 from mavlink/joystickfix

Disable COM_RC_IN_MODE magic handling, as its causing confusion on al…
parents fb371f36 09bf9fdb
...@@ -813,25 +813,7 @@ bool Vehicle::joystickEnabled(void) ...@@ -813,25 +813,7 @@ bool Vehicle::joystickEnabled(void)
void Vehicle::setJoystickEnabled(bool enabled) void Vehicle::setJoystickEnabled(bool enabled)
{ {
// The magic parameter will go away, _joystickEnabled = enabled;
// until then don't mess with the logic here!
Fact* fact = _autopilotPlugin->getParameterFact(FactSystem::defaultComponentId, "COM_RC_IN_MODE");
if (!fact) {
qCWarning(JoystickLog) << "Missing COM_RC_IN_MODE parameter";
}
// Any value greater than one
// indicates special handling on
// the autopilot side. Force the
// joystick to on.
if (fact->value().toInt() > 1) {
// Mandatory in this setting
_joystickEnabled = true;
} else {
fact->setValue(enabled ? 1 : 0);
_joystickEnabled = enabled;
}
_startJoystick(_joystickEnabled); _startJoystick(_joystickEnabled);
_saveSettings(); _saveSettings();
} }
......
...@@ -356,11 +356,10 @@ QGCView { ...@@ -356,11 +356,10 @@ QGCView {
QGCCheckBox { QGCCheckBox {
enabled: allowEnableDisable enabled: allowEnableDisable
text: _activeJoystick.calibrated ? (rcInMode.value < 2 ? "Enable joystick input, disable RC input" : "Enable/Disable not allowed (COM_RC_IN_MODE=2)") : "Enable/Disable not allowed (Calibrate First)" text: _activeJoystick.calibrated ? "Enable joystick input" : "Enable/Disable not allowed (Calibrate First)"
checked: _activeVehicle.joystickEnabled checked: _activeVehicle.joystickEnabled
property bool allowEnableDisable: _activeJoystick.calibrated && rcInMode.value < 2 property bool allowEnableDisable: _activeJoystick.calibrated
property Fact rcInMode: controller.getParameterFact(-1, "COM_RC_IN_MODE")
onClicked: _activeVehicle.joystickEnabled = checked onClicked: _activeVehicle.joystickEnabled = checked
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment