diff --git a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc index 8adf5ca3ddb2c7b7f92df6959edc9ed30460f860..9bd1445e51adf1402b199109f3c6469a05925d35 100644 --- a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc +++ b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc @@ -57,3 +57,8 @@ bool ArduSubFirmwarePlugin::supportsThrottleModeCenterZero(void) { return false; } + +bool ArduSubFirmwarePlugin::supportsManualControl(void) +{ + return true; +} diff --git a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h index e5d01b2ad512601fb1e19f7b4fef4a654990552b..15ec48c76139a35feed2ffddbbec443acdac749c 100644 --- a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h +++ b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h @@ -71,6 +71,7 @@ public: bool supportsThrottleModeCenterZero(void); + bool supportsManualControl(void); }; #endif diff --git a/src/FirmwarePlugin/FirmwarePlugin.cc b/src/FirmwarePlugin/FirmwarePlugin.cc index f615f73f2fa145bd53ab8431befbc6b320a0670b..7e96cbbe01011eab8aea4cc289cfce72f2dedcac 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.cc +++ b/src/FirmwarePlugin/FirmwarePlugin.cc @@ -89,6 +89,11 @@ bool FirmwarePlugin::supportsThrottleModeCenterZero(void) return true; } +bool FirmwarePlugin::supportsManualControl(void) +{ + return false; +} + bool FirmwarePlugin::adjustIncomingMavlinkMessage(Vehicle* vehicle, mavlink_message_t* message) { Q_UNUSED(vehicle); diff --git a/src/FirmwarePlugin/FirmwarePlugin.h b/src/FirmwarePlugin/FirmwarePlugin.h index 59fe8d9fffd156347b9fc2eeb76771ffe3238236..aa73597fd940edf382f3668a752e8264231d0c3c 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.h +++ b/src/FirmwarePlugin/FirmwarePlugin.h @@ -133,6 +133,10 @@ public: /// throttle. virtual bool supportsThrottleModeCenterZero(void); + /// Returns true if the firmware supports the use of the MAVlink "MANUAL_CONTROL" message. + /// By default, this returns false unless overridden in the firmware plugin. + virtual bool supportsManualControl(void); + /// Called before any mavlink message is processed by Vehicle such that the firmwre plugin /// can adjust any message characteristics. This is handy to adjust or differences in mavlink /// spec implementations such that the base code can remain mavlink generic. diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc index 92535305d54d06fe43a71d991dd3f4acb47b22ad..847f9ae44297c20763fbec8bcd75938f064673f8 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc @@ -170,6 +170,11 @@ int PX4FirmwarePlugin::manualControlReservedButtonCount(void) return 0; // 0 buttons reserved for rc switch simulation } +bool PX4FirmwarePlugin::supportsManualControl(void) +{ + return true; +} + bool PX4FirmwarePlugin::isCapable(const Vehicle *vehicle, FirmwareCapabilities capabilities) { if(vehicle->multiRotor()) { diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h index 13d8b420200069f75b5069580ebfb258d39dc979..f85058403563e32375240c499f90d89027584c6e 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h @@ -44,6 +44,7 @@ public: void guidedModeChangeAltitude (Vehicle* vehicle, double altitudeRel) final; bool isGuidedMode (const Vehicle* vehicle) const; int manualControlReservedButtonCount(void) final; + bool supportsManualControl (void) final; void initializeVehicle (Vehicle* vehicle) final; bool sendHomePositionToVehicle (void) final; void addMetaDataToFact (QObject* parameterMetaData, Fact* fact, MAV_TYPE vehicleType) final; diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 00963e03e45e595fa553b6f6837ca182b01253e5..53ce31129a1f606be843c07c9fdbc789f707cfe2 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1517,15 +1517,7 @@ bool Vehicle::vtol(void) const bool Vehicle::supportsManualControl(void) const { - // PX4 Firmware supports manual control message - if ( px4Firmware() ) { - return true; - } - // ArduSub supports manual control message (identified by APM + Submarine type) - if ( apmFirmware() && vehicleType() == MAV_TYPE_SUBMARINE ) { - return true; - } - return false; + return _firmwarePlugin->supportsManualControl(); } bool Vehicle::supportsThrottleModeCenterZero(void) const