Commit c8f1e925 authored by Don Gagne's avatar Don Gagne

Add setup pre-flight check

parent 4b3c2cec
...@@ -80,7 +80,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) : ...@@ -80,7 +80,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) :
_parameterFacts = new PX4ParameterFacts(uas, this); _parameterFacts = new PX4ParameterFacts(uas, this);
Q_CHECK_PTR(_parameterFacts); Q_CHECK_PTR(_parameterFacts);
connect(_parameterFacts, &PX4ParameterFacts::factsReady, this, &PX4AutoPilotPlugin::_checkForIncorrectParameterVersion); connect(_parameterFacts, &PX4ParameterFacts::factsReady, this, &PX4AutoPilotPlugin::_pluginReadyPreChecks);
PX4ParameterFacts::loadParameterFactMetaData(); PX4ParameterFacts::loadParameterFactMetaData();
} }
...@@ -237,12 +237,29 @@ QUrl PX4AutoPilotPlugin::setupBackgroundImage(void) ...@@ -237,12 +237,29 @@ QUrl PX4AutoPilotPlugin::setupBackgroundImage(void)
return QUrl::fromUserInput("qrc:/qml/px4fmu_2.x.png"); return QUrl::fromUserInput("qrc:/qml/px4fmu_2.x.png");
} }
void PX4AutoPilotPlugin::_checkForIncorrectParameterVersion(void) /// This will perform various checks prior to signalling that the plug in ready
void PX4AutoPilotPlugin::_pluginReadyPreChecks(void)
{ {
// Check for older parameter version set
// FIXME: Firmware is moving to version stamp parameter set. Once that is complete the version stamp
// should be used instead.
if (parameters().contains("SENS_GYRO_XOFF")) { if (parameters().contains("SENS_GYRO_XOFF")) {
_incorrectParameterVersion = true; _incorrectParameterVersion = true;
QGCMessageBox::warning(tr("Setup"), tr("This version of GroundControl can only perform vehicle setup on a newer version of firmware. " QGCMessageBox::warning(tr("Setup"), tr("This version of GroundControl can only perform vehicle setup on a newer version of firmware. "
"Please perform a Firmware Upgrade if you wish to use Vehicle Setup.")); "Please perform a Firmware Upgrade if you wish to use Vehicle Setup."));
} else {
// Check for missing setup complete
foreach(const QVariant componentVariant, components()) {
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
Q_ASSERT(component);
if (!component->setupComplete()) {
QGCMessageBox::warning(tr("Setup"), tr("One or more vehicle components require setup prior to flight. "
"Please correct these by going to the Setup view."));
break;
}
}
} }
emit pluginReady(); emit pluginReady();
} }
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
PowerComponent* powerComponent(void) { return _powerComponent; } PowerComponent* powerComponent(void) { return _powerComponent; }
private slots: private slots:
void _checkForIncorrectParameterVersion(void); void _pluginReadyPreChecks(void);
private: private:
PX4ParameterFacts* _parameterFacts; PX4ParameterFacts* _parameterFacts;
......
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