Commit 479ca562 authored by Rustom Jehangir's avatar Rustom Jehangir

Make supportsManualControl a plugin option

parent 3b82d52d
......@@ -57,3 +57,8 @@ bool ArduSubFirmwarePlugin::supportsThrottleModeCenterZero(void)
{
return false;
}
bool ArduSubFirmwarePlugin::supportsManualControl(void)
{
return true;
}
......@@ -71,6 +71,7 @@ public:
bool supportsThrottleModeCenterZero(void);
bool supportsManualControl(void);
};
#endif
......@@ -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);
......
......@@ -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.
......
......@@ -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()) {
......
......@@ -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;
......
......@@ -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
......
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