Commit 070a77b1 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #2332 from NaterGator/joystick-modeswitch

Enable binding mode commands to joystick buttons
parents 71c41962 d7a82382
......@@ -174,7 +174,7 @@ bool PX4FirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_m
int PX4FirmwarePlugin::manualControlReservedButtonCount(void)
{
return 8; // 8 buttons reserved for rc switch simulation
return 0; // 0 buttons reserved for rc switch simulation
}
void PX4FirmwarePlugin::adjustMavlinkMessage(mavlink_message_t* message)
......
......@@ -462,6 +462,10 @@ QStringList Joystick::actions(void)
list << "Arm" << "Disarm";
if (_activeVehicle) {
list << _activeVehicle->flightModes();
}
return list;
}
......@@ -558,6 +562,8 @@ void Joystick::_buttonAction(const QString& action)
_activeVehicle->setArmed(true);
} else if (action == "Disarm") {
_activeVehicle->setArmed(false);
} else if (_activeVehicle->flightModes().contains(action)) {
_activeVehicle->setFlightMode(action);
} else {
qCDebug(JoystickLog) << "_buttonAction unknown action:" << action;
}
......
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