Browse Source

Separate startJoystick from enableJoystick. Just because the joystick is not enabled doesn't mean that we don't want to be able to monitor its behavior

QGC4.4
nanthony21 7 years ago
parent
commit
2569fef554
  1. 6
      src/Vehicle/Vehicle.cc

6
src/Vehicle/Vehicle.cc

@ -1787,6 +1787,7 @@ void Vehicle::_loadSettings(void) @@ -1787,6 +1787,7 @@ void Vehicle::_loadSettings(void)
// Joystick enabled is a global setting so first make sure there are any joysticks connected
if (_toolbox->joystickManager()->joysticks().count()) {
setJoystickEnabled(settings.value(_joystickEnabledSettingsKey, false).toBool());
_startJoystick(true);
}
}
@ -1839,7 +1840,6 @@ bool Vehicle::joystickEnabled(void) @@ -1839,7 +1840,6 @@ bool Vehicle::joystickEnabled(void)
void Vehicle::setJoystickEnabled(bool enabled)
{
_joystickEnabled = enabled;
_startJoystick(_joystickEnabled);
_saveSettings();
emit joystickEnabledChanged(_joystickEnabled);
}
@ -1849,9 +1849,7 @@ void Vehicle::_startJoystick(bool start) @@ -1849,9 +1849,7 @@ void Vehicle::_startJoystick(bool start)
Joystick* joystick = _joystickManager->activeJoystick();
if (joystick) {
if (start) {
if (_joystickEnabled) {
joystick->startPolling(this);
}
joystick->startPolling(this);
} else {
joystick->stopPolling();
}

Loading…
Cancel
Save