Browse Source

Merge pull request #5961 from DonLakeFlyer/SetupComplete

Fix AutoPilotPlugin::setupCompleteChanged signalling
QGC4.4
Don Gagne 7 years ago committed by GitHub
parent
commit
3cd68166a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/AutoPilotPlugins/AutoPilotPlugin.cc
  2. 2
      src/AutoPilotPlugins/AutoPilotPlugin.h
  3. 2
      src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
  4. 2
      src/VehicleSetup/VehicleComponent.h
  5. 1
      src/VehicleSetup/VehicleSummary.qml

11
src/AutoPilotPlugins/AutoPilotPlugin.cc

@ -61,6 +61,17 @@ bool AutoPilotPlugin::setupComplete(void) @@ -61,6 +61,17 @@ bool AutoPilotPlugin::setupComplete(void)
void AutoPilotPlugin::parametersReadyPreChecks(void)
{
_recalcSetupComplete();
// Connect signals in order to keep setupComplete up to date
foreach(const QVariant componentVariant, vehicleComponents()) {
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
if (component) {
connect(component, &VehicleComponent::setupCompleteChanged, this, &AutoPilotPlugin::_recalcSetupComplete);
} else {
qWarning() << "AutoPilotPlugin::_recalcSetupComplete Incorrectly typed VehicleComponent";
}
}
if (!_setupComplete) {
qgcApp()->showMessage(tr("One or more vehicle components require setup prior to flight."));

2
src/AutoPilotPlugins/AutoPilotPlugin.h

@ -66,7 +66,7 @@ protected: @@ -66,7 +66,7 @@ protected:
FirmwarePlugin* _firmwarePlugin;
bool _setupComplete;
private:
private slots:
void _recalcSetupComplete(void);
};

2
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h

@ -44,6 +44,7 @@ public: @@ -44,6 +44,7 @@ public:
const QVariantList& vehicleComponents(void) override;
void parametersReadyPreChecks(void) override;
QString prerequisiteSetup(VehicleComponent* component) const override;
protected:
bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed
PX4AirframeLoader* _airframeFacts;
@ -58,6 +59,7 @@ protected: @@ -58,6 +59,7 @@ protected:
MotorComponent* _motorComponent;
PX4TuningComponent* _tuningComponent;
SyslinkComponent* _syslinkComponent;
private:
QVariantList _components;
};

2
src/VehicleSetup/VehicleComponent.h

@ -56,7 +56,7 @@ public: @@ -56,7 +56,7 @@ public:
virtual void addSummaryQmlComponent(QQmlContext* context, QQuickItem* parent);
/// @brief Returns an list of parameter names for which a change should cause the setupCompleteChanged
/// signal to be emitted. Last element is signalled by NULL.
/// signal to be emitted.
virtual QStringList setupCompleteChangedTriggerList(void) const = 0;
/// Should be called after the component is created (but not in constructor) to setup the

1
src/VehicleSetup/VehicleSummary.qml

@ -86,6 +86,7 @@ Rectangle { @@ -86,6 +86,7 @@ Rectangle {
text: setupComplete ?
qsTr("Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component.") :
qsTr("WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left.")
property bool setupComplete: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.setupComplete : false
}

Loading…
Cancel
Save