diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index f062923..51e7f31 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -750,6 +750,7 @@ HEADERS+= \ src/AutoPilotPlugins/AutoPilotPlugin.h \ src/AutoPilotPlugins/Common/ESP8266Component.h \ src/AutoPilotPlugins/Common/ESP8266ComponentController.h \ + src/AutoPilotPlugins/Common/MixersComponent.h \ src/AutoPilotPlugins/Common/MotorComponent.h \ src/AutoPilotPlugins/Common/RadioComponentController.h \ src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \ @@ -771,6 +772,7 @@ SOURCES += \ src/AutoPilotPlugins/AutoPilotPlugin.cc \ src/AutoPilotPlugins/Common/ESP8266Component.cc \ src/AutoPilotPlugins/Common/ESP8266ComponentController.cc \ + src/AutoPilotPlugins/Common/MixersComponent.cc \ src/AutoPilotPlugins/Common/MotorComponent.cc \ src/AutoPilotPlugins/Common/RadioComponentController.cc \ src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 870f120..512e9dc 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -39,6 +39,7 @@ src/ui/preferences/MavlinkSettings.qml src/MissionEditor/MissionEditor.qml src/MissionEditor/MissionSettingsEditor.qml + src/AutoPilotPlugins/Common/MixersComponent.qml src/ui/preferences/MockLink.qml src/ui/preferences/MockLinkSettings.qml src/MultiVehicle/MultiVehicleView.qml diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc index 200b04d..c8bf2d9 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc @@ -28,6 +28,7 @@ #include "APMLightsComponent.h" #include "APMSubFrameComponent.h" #include "ESP8266Component.h" +#include "MixersComponent.h" /// This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_ARDUPILOT type. APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) @@ -49,6 +50,7 @@ APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) , _tuningComponent(NULL) , _airframeFacts(new APMAirframeLoader(this, vehicle->uas(), this)) , _esp8266Component(NULL) + , _mixersComponent(NULL) { APMAirframeLoader::loadAirframeFactMetaData(); } @@ -102,6 +104,10 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) _tuningComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); + _mixersComponent = new MixersComponent(_vehicle, this); + _mixersComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_mixersComponent)); + _cameraComponent = new APMCameraComponent(_vehicle, this); _cameraComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent)); diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h index 8ac267b..838bbe3 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h @@ -27,6 +27,7 @@ class APMCameraComponent; class APMLightsComponent; class APMSubFrameComponent; class ESP8266Component; +class MixersComponent; /// This is the APM specific implementation of the AutoPilot class. class APMAutoPilotPlugin : public AutoPilotPlugin @@ -55,6 +56,7 @@ public: APMSensorsComponent* sensorsComponent (void) const { return _sensorsComponent; } APMTuningComponent* tuningComponent (void) const { return _tuningComponent; } ESP8266Component* esp8266Component (void) const { return _esp8266Component; } + MixersComponent* mixersComponent (void) { return _mixersComponent; } private: bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed @@ -76,6 +78,7 @@ private: APMTuningComponent* _tuningComponent; APMAirframeLoader* _airframeFacts; ESP8266Component* _esp8266Component; + MixersComponent* _mixersComponent; }; #endif diff --git a/src/AutoPilotPlugins/Common/MixersComponent.cc b/src/AutoPilotPlugins/Common/MixersComponent.cc new file mode 100644 index 0000000..75579a5 --- /dev/null +++ b/src/AutoPilotPlugins/Common/MixersComponent.cc @@ -0,0 +1,64 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#include "MixersComponent.h" +#include "APMAutoPilotPlugin.h" +#include "APMAirframeComponent.h" +#include "ParameterManager.h" + +MixersComponent::MixersComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) + : VehicleComponent(vehicle, autopilot, parent) + , _name(tr("Mixers")) +{ +} + +QString MixersComponent::name(void) const +{ + return _name; +} + +QString MixersComponent::description(void) const +{ + return tr("Mixers tuning is used to blah, blah, blah... [WIP]"); +} + +QString MixersComponent::iconResource(void) const +{ + return QStringLiteral("/qmlimages/TuningComponentIcon.png"); +} + +bool MixersComponent::requiresSetup(void) const +{ + return false; +} + +bool MixersComponent::setupComplete(void) const +{ + return true; +} + +QStringList MixersComponent::setupCompleteChangedTriggerList(void) const +{ + return QStringList(); +} + +QUrl MixersComponent::setupSource(void) const +{ + return QUrl::fromUserInput(QStringLiteral("qrc:/qml/MixersComponent.qml")); +} + +QUrl MixersComponent::summaryQmlSource(void) const +{ + return QUrl(); +} + +QString MixersComponent::prerequisiteSetup(void) const +{ + return QString(); +} diff --git a/src/AutoPilotPlugins/Common/MixersComponent.h b/src/AutoPilotPlugins/Common/MixersComponent.h new file mode 100644 index 0000000..5a624d6 --- /dev/null +++ b/src/AutoPilotPlugins/Common/MixersComponent.h @@ -0,0 +1,42 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#ifndef MixersComponent_H +#define MixersComponent_H + +#include "VehicleComponent.h" + +// Mixers Tuning vehicle component +class MixersComponent : public VehicleComponent +{ + Q_OBJECT + +public: + MixersComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); + + // Virtuals from VehicleComponent + QStringList setupCompleteChangedTriggerList(void) const final; + + // Virtuals from VehicleComponent + QString name(void) const final; + QString description(void) const final; + QString iconResource(void) const final; + bool requiresSetup(void) const final; + bool setupComplete(void) const final; + QUrl setupSource(void) const final; + QUrl summaryQmlSource(void) const final; + QString prerequisiteSetup(void) const final; + bool allowSetupWhileArmed(void) const final { return true; } + +private: + const QString _name; + QVariantList _summaryItems; +}; + +#endif diff --git a/src/AutoPilotPlugins/Common/MixersComponent.qml b/src/AutoPilotPlugins/Common/MixersComponent.qml new file mode 100644 index 0000000..8403442 --- /dev/null +++ b/src/AutoPilotPlugins/Common/MixersComponent.qml @@ -0,0 +1,38 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 + +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 + +// Mixer Tuning setup page +SetupPage { + id: tuningPage + pageComponent: tuningPageComponent + + Component { + id: tuningPageComponent + + Column { + width: availableWidth + spacing: _margins + + FactPanelController { id: controller; factPanel: tuningPage.viewPanel } + + QGCPalette { id: palette; colorGroupEnabled: true } + + QGCLabel { text: qsTr("Lot of Qml code goes here...") } + } // Column + } // Component +} // SetupView diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index 0b96501..3036a15 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -31,6 +31,8 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(Vehicle* vehicle, QObject* parent) , _safetyComponent(NULL) , _powerComponent(NULL) , _motorComponent(NULL) + , _tuningComponent(NULL) + , _mixersComponent(NULL) , _incorrectParameterVersion(false) { Q_ASSERT(vehicle); @@ -89,6 +91,10 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) _tuningComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); + _mixersComponent = new MixersComponent(_vehicle, this); + _mixersComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_mixersComponent)); + //-- Is there support for cameras? if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "TRIG_MODE")) { _cameraComponent = new CameraComponent(_vehicle, this); diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h index 32f63dd..e5f0efa 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h @@ -23,6 +23,7 @@ #include "PowerComponent.h" #include "MotorComponent.h" #include "PX4TuningComponent.h" +#include "MixersComponent.h" #include "Vehicle.h" #include @@ -54,6 +55,7 @@ public: PowerComponent* powerComponent(void) { return _powerComponent; } MotorComponent* motorComponent(void) { return _motorComponent; } PX4TuningComponent* tuningComponent(void) { return _tuningComponent; } + MixersComponent* mixersComponent(void) { return _mixersComponent; } private: PX4AirframeLoader* _airframeFacts; @@ -68,6 +70,7 @@ private: PowerComponent* _powerComponent; MotorComponent* _motorComponent; PX4TuningComponent* _tuningComponent; + MixersComponent* _mixersComponent; bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed };