Commit 5b3311a3 authored by Gus Grubba's avatar Gus Grubba

Instead of trying to keep a vehicle type within the FirmwarePlugin instance,...

Instead of trying to keep a vehicle type within the FirmwarePlugin instance, pass the vehicle to the function so it can query the type that way.
parent ad5d6b68
...@@ -74,7 +74,7 @@ void ArduRoverFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double ...@@ -74,7 +74,7 @@ void ArduRoverFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double
qgcApp()->showMessage(QStringLiteral("Change altitude not supported.")); qgcApp()->showMessage(QStringLiteral("Change altitude not supported."));
} }
bool ArduRoverFirmwarePlugin::supportsNegativeThrust(void) bool ArduRoverFirmwarePlugin::supportsNegativeThrust(Vehicle* /*vehicle*/)
{ {
return true; return true;
} }
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
void guidedModeChangeAltitude (Vehicle* vehicle, double altitudeChange) final; void guidedModeChangeAltitude (Vehicle* vehicle, double altitudeChange) final;
int remapParamNameHigestMinorVersionNumber (int majorVersionNumber) const final; int remapParamNameHigestMinorVersionNumber (int majorVersionNumber) const final;
const FirmwarePlugin::remapParamNameMajorVersionMap_t& paramNameRemapMajorVersionMap(void) const final { return _remapParamName; } const FirmwarePlugin::remapParamNameMajorVersionMap_t& paramNameRemapMajorVersionMap(void) const final { return _remapParamName; }
bool supportsNegativeThrust (void) final; bool supportsNegativeThrust (Vehicle *) final;
bool supportsSmartRTL (void) const override { return true; } bool supportsSmartRTL (void) const override { return true; }
QString offlineEditingParamFile (Vehicle* vehicle) override { Q_UNUSED(vehicle); return QStringLiteral(":/FirmwarePlugin/APM/Rover.OfflineEditing.params"); } QString offlineEditingParamFile (Vehicle* vehicle) override { Q_UNUSED(vehicle); return QStringLiteral(":/FirmwarePlugin/APM/Rover.OfflineEditing.params"); }
......
...@@ -50,11 +50,6 @@ FirmwarePluginFactoryRegister* FirmwarePluginFactoryRegister::instance(void) ...@@ -50,11 +50,6 @@ FirmwarePluginFactoryRegister* FirmwarePluginFactoryRegister::instance(void)
return _instance; return _instance;
} }
FirmwarePlugin::FirmwarePlugin(MAV_TYPE vehicleType)
{
_vehicleType = vehicleType;
}
AutoPilotPlugin* FirmwarePlugin::autopilotPlugin(Vehicle* vehicle) AutoPilotPlugin* FirmwarePlugin::autopilotPlugin(Vehicle* vehicle)
{ {
return new GenericAutoPilotPlugin(vehicle, vehicle); return new GenericAutoPilotPlugin(vehicle, vehicle);
...@@ -132,7 +127,7 @@ bool FirmwarePlugin::supportsThrottleModeCenterZero(void) ...@@ -132,7 +127,7 @@ bool FirmwarePlugin::supportsThrottleModeCenterZero(void)
return true; return true;
} }
bool FirmwarePlugin::supportsNegativeThrust(void) bool FirmwarePlugin::supportsNegativeThrust(Vehicle* /*vehicle*/)
{ {
// By default, this is not supported // By default, this is not supported
return false; return false;
......
...@@ -49,8 +49,6 @@ public: ...@@ -49,8 +49,6 @@ public:
TakeoffVehicleCapability = 1 << 4, ///< Vehicle supports guided takeoff TakeoffVehicleCapability = 1 << 4, ///< Vehicle supports guided takeoff
} FirmwareCapabilities; } FirmwareCapabilities;
FirmwarePlugin(MAV_TYPE vehicleType = MAV_TYPE_GENERIC);
/// Maps from on parameter name to another /// Maps from on parameter name to another
/// key: parameter name to translate from /// key: parameter name to translate from
/// value: mapped parameter name /// value: mapped parameter name
...@@ -164,7 +162,7 @@ public: ...@@ -164,7 +162,7 @@ public:
/// Returns true if the vehicle and firmware supports the use of negative thrust /// Returns true if the vehicle and firmware supports the use of negative thrust
/// Typically supported rover. /// Typically supported rover.
virtual bool supportsNegativeThrust(void); virtual bool supportsNegativeThrust(Vehicle *);
/// Returns true if the firmware supports the use of the RC radio and requires the RC radio /// Returns true if the firmware supports the use of the RC radio and requires the RC radio
/// setup page. Returns true by default. /// setup page. Returns true by default.
...@@ -346,9 +344,6 @@ protected: ...@@ -346,9 +344,6 @@ protected:
// Returns regex QString to extract version information from text // Returns regex QString to extract version information from text
virtual QString _versionRegex() { return QString(); } virtual QString _versionRegex() { return QString(); }
protected:
MAV_TYPE _vehicleType = MAV_TYPE_GENERIC;
private: private:
QVariantList _toolBarIndicatorList; QVariantList _toolBarIndicatorList;
static QVariantList _cameraList; ///< Standard QGC camera list static QVariantList _cameraList; ///< Standard QGC camera list
......
...@@ -35,9 +35,8 @@ PX4FirmwarePluginInstanceData::PX4FirmwarePluginInstanceData(QObject* parent) ...@@ -35,9 +35,8 @@ PX4FirmwarePluginInstanceData::PX4FirmwarePluginInstanceData(QObject* parent)
} }
PX4FirmwarePlugin::PX4FirmwarePlugin(MAV_TYPE vehicleType) PX4FirmwarePlugin::PX4FirmwarePlugin()
: FirmwarePlugin(vehicleType) : _manualFlightMode (tr("Manual"))
, _manualFlightMode (tr("Manual"))
, _acroFlightMode (tr("Acro")) , _acroFlightMode (tr("Acro"))
, _stabilizedFlightMode (tr("Stabilized")) , _stabilizedFlightMode (tr("Stabilized"))
, _rattitudeFlightMode (tr("Rattitude")) , _rattitudeFlightMode (tr("Rattitude"))
...@@ -591,7 +590,7 @@ QString PX4FirmwarePlugin::_versionRegex() { ...@@ -591,7 +590,7 @@ QString PX4FirmwarePlugin::_versionRegex() {
return QStringLiteral("v([0-9,\\.]*) Stable"); return QStringLiteral("v([0-9,\\.]*) Stable");
} }
bool PX4FirmwarePlugin::supportsNegativeThrust(void) bool PX4FirmwarePlugin::supportsNegativeThrust(Vehicle* vehicle)
{ {
return _vehicleType == MAV_TYPE_GROUND_ROVER; return vehicle->vehicleType() == MAV_TYPE_GROUND_ROVER;
} }
...@@ -23,7 +23,7 @@ class PX4FirmwarePlugin : public FirmwarePlugin ...@@ -23,7 +23,7 @@ class PX4FirmwarePlugin : public FirmwarePlugin
Q_OBJECT Q_OBJECT
public: public:
PX4FirmwarePlugin (MAV_TYPE vehicleType); PX4FirmwarePlugin ();
~PX4FirmwarePlugin () override; ~PX4FirmwarePlugin () override;
// Overrides from FirmwarePlugin // Overrides from FirmwarePlugin
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
QString autoDisarmParameter (Vehicle* vehicle) override { Q_UNUSED(vehicle); return QStringLiteral("COM_DISARM_LAND"); } QString autoDisarmParameter (Vehicle* vehicle) override { Q_UNUSED(vehicle); return QStringLiteral("COM_DISARM_LAND"); }
uint32_t highLatencyCustomModeTo32Bits (uint16_t hlCustomMode) override; uint32_t highLatencyCustomModeTo32Bits (uint16_t hlCustomMode) override;
bool supportsTerrainFrame (void) const override { return false; } bool supportsTerrainFrame (void) const override { return false; }
bool supportsNegativeThrust (void) override; bool supportsNegativeThrust (Vehicle *vehicle) override;
protected: protected:
typedef struct { typedef struct {
......
...@@ -29,11 +29,11 @@ QList<MAV_AUTOPILOT> PX4FirmwarePluginFactory::supportedFirmwareTypes(void) cons ...@@ -29,11 +29,11 @@ QList<MAV_AUTOPILOT> PX4FirmwarePluginFactory::supportedFirmwareTypes(void) cons
return list; return list;
} }
FirmwarePlugin* PX4FirmwarePluginFactory::firmwarePluginForAutopilot(MAV_AUTOPILOT autopilotType, MAV_TYPE vehicleType) FirmwarePlugin* PX4FirmwarePluginFactory::firmwarePluginForAutopilot(MAV_AUTOPILOT autopilotType, MAV_TYPE /*vehicleType*/)
{ {
if (autopilotType == MAV_AUTOPILOT_PX4) { if (autopilotType == MAV_AUTOPILOT_PX4) {
if (!_pluginInstance) { if (!_pluginInstance) {
_pluginInstance = new PX4FirmwarePlugin(vehicleType); _pluginInstance = new PX4FirmwarePlugin();
} }
return _pluginInstance; return _pluginInstance;
} }
......
...@@ -2871,9 +2871,9 @@ bool Vehicle::supportsThrottleModeCenterZero(void) const ...@@ -2871,9 +2871,9 @@ bool Vehicle::supportsThrottleModeCenterZero(void) const
return _firmwarePlugin->supportsThrottleModeCenterZero(); return _firmwarePlugin->supportsThrottleModeCenterZero();
} }
bool Vehicle::supportsNegativeThrust(void) const bool Vehicle::supportsNegativeThrust(void)
{ {
return _firmwarePlugin->supportsNegativeThrust(); return _firmwarePlugin->supportsNegativeThrust(this);
} }
bool Vehicle::supportsRadio(void) const bool Vehicle::supportsRadio(void) const
......
...@@ -854,7 +854,7 @@ public: ...@@ -854,7 +854,7 @@ public:
bool sub(void) const; bool sub(void) const;
bool supportsThrottleModeCenterZero (void) const; bool supportsThrottleModeCenterZero (void) const;
bool supportsNegativeThrust (void) const; bool supportsNegativeThrust (void);
bool supportsRadio (void) const; bool supportsRadio (void) const;
bool supportsJSButton (void) const; bool supportsJSButton (void) const;
bool supportsMotorInterference (void) const; bool supportsMotorInterference (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