8#include <QtCore/QCoreApplication>
12AutoPilotPlugin::AutoPilotPlugin(
Vehicle *vehicle, QObject *parent)
15 , _firmwarePlugin(vehicle->firmwarePlugin())
17 qCDebug(AutoPilotPluginLog) <<
this;
20AutoPilotPlugin::~AutoPilotPlugin()
22 qCDebug(AutoPilotPluginLog) <<
this;
25void AutoPilotPlugin::_recalcSetupComplete()
27 bool newSetupComplete =
true;
29 for (
const QVariant &componentVariant : vehicleComponents()) {
30 const VehicleComponent *
const component = qobject_cast<const VehicleComponent*>(qvariant_cast<const QObject*>(componentVariant));
32 if (!component->setupComplete()) {
33 newSetupComplete =
false;
37 qCWarning(AutoPilotPluginLog) <<
"Incorrectly typed VehicleComponent";
47void AutoPilotPlugin::parametersReadyPreChecks()
49 _recalcSetupComplete();
52 for (QVariant componentVariant : vehicleComponents()) {
53 VehicleComponent *
const component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject*>(componentVariant));
57 qCWarning(AutoPilotPluginLog) <<
"Incorrectly typed VehicleComponent";
63 qgcApp()->showVehicleConfig();
64 QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
65 qgcApp()->showAppMessage(tr(
"One or more vehicle components require setup prior to flight."));
69VehicleComponent *AutoPilotPlugin::findKnownVehicleComponent(KnownVehicleComponent knownVehicleComponent)
71 if (knownVehicleComponent != UnknownVehicleComponent) {
72 for (
const QVariant &componentVariant: vehicleComponents()) {
73 VehicleComponent *
const component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
74 if (component && (component->KnownVehicleComponent() == knownVehicleComponent)) {
#define QGC_LOGGING_CATEGORY(name, categoryStr)
void setupCompleteChanged()
void setupCompleteChanged()