diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index ffbc0bf66f6fee9b832c12bee1cef512fe25492b..15676750a3d6978156797af2ed334a8d92f45293 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -742,6 +742,7 @@ HEADERS+= \
src/AutoPilotPlugins/PX4/SensorsComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponentController.h \
src/AutoPilotPlugins/PX4/SafetyComponent.h \
+ src/AutoPilotPlugins/PX4/PowerComponent.h \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \
SOURCES += \
@@ -764,6 +765,7 @@ SOURCES += \
src/AutoPilotPlugins/PX4/SensorsComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponentController.cc \
src/AutoPilotPlugins/PX4/SafetyComponent.cc \
+ src/AutoPilotPlugins/PX4/PowerComponent.cc \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \
# Fact System code
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 16459b2f42d82337cf273530d5f93621be5920bc..3210730c133eb2adbe684acead9e069afc352850 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -247,13 +247,11 @@
src/test.qml
src/QmlControls/QmlTest.qml
-
src/FactSystem/FactControls/qmldir
src/FactSystem/FactControls/FactLabel.qml
src/FactSystem/FactControls/FactTextField.qml
src/FactSystem/FactControls/FactCheckBox.qml
src/FactSystem/FactControls/FactComboBox.qml
-
src/QmlControls/qmldir
src/QmlControls/QGCButton.qml
src/QmlControls/QGCRadioButton.qml
@@ -263,30 +261,26 @@
src/QmlControls/QGCComboBox.qml
src/QmlControls/QGCColoredImage.qml
src/QmlControls/QGCToolBarButton.qml
-
src/QmlControls/SubMenuButton.qml
src/QmlControls/IndicatorButton.qml
src/QmlControls/VehicleRotationCal.qml
-
src/QmlControls/arrow-down.png
-
files/images/px4/airframes/octo_x.png
files/images/px4/boards/px4fmu_2.x.png
src/VehicleSetup/SetupViewButtons.qml
src/VehicleSetup/VehicleSummary.qml
src/VehicleSetup/FirmwareUpgrade.qml
-
src/AutoPilotPlugins/PX4/SafetyComponent.qml
+ src/AutoPilotPlugins/PX4/PowerComponent.qml
src/AutoPilotPlugins/PX4/SensorsComponent.qml
src/AutoPilotPlugins/PX4/FlightModesComponent.qml
-
src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml
+ src/AutoPilotPlugins/PX4/PowerComponentSummary.qml
src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml
src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml
src/AutoPilotPlugins/PX4/RadioComponentSummary.qml
src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml
src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml
-
src/AutoPilotPlugins/PX4/Images/SafetyComponentTree.png
src/AutoPilotPlugins/PX4/Images/SafetyComponentHome.png
src/AutoPilotPlugins/PX4/Images/SafetyComponentArrowDown.png
@@ -297,16 +291,15 @@
src/AutoPilotPlugins/PX4/Images/VehicleRight.png
src/AutoPilotPlugins/PX4/Images/VehicleNoseDown.png
src/AutoPilotPlugins/PX4/Images/VehicleTailDown.png
-
files/Setup/cogwheels.png
src/AutoPilotPlugins/PX4/Images/SensorsComponentIcon.png
src/AutoPilotPlugins/PX4/Images/RadioComponentIcon.png
src/AutoPilotPlugins/PX4/Images/FlightModesComponentIcon.png
src/AutoPilotPlugins/PX4/Images/AirframeComponentIcon.png
src/AutoPilotPlugins/PX4/Images/SafetyComponentIcon.png
+ src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png
src/VehicleSetup/FirmwareUpgradeIcon.png
src/VehicleSetup/VehicleSummaryIcon.png
-
src/ui/toolbar/MainToolBar.qml
diff --git a/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png b/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..cba13b67525fa2e315ea53d7ac3e0eb3474cb834
Binary files /dev/null and b/src/AutoPilotPlugins/PX4/Images/PowerComponentIcon.png differ
diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
index e9e553efe25e97edaf7450477ee8923dc85786a7..0bf534915dbb4323f2ba628810e98bb78bbdde52 100644
--- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
@@ -70,6 +70,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) :
_flightModesComponent(NULL),
_sensorsComponent(NULL),
_safetyComponent(NULL),
+ _powerComponent(NULL),
_incorrectParameterVersion(false)
{
Q_ASSERT(uas);
@@ -214,6 +215,10 @@ const QVariantList& PX4AutoPilotPlugin::components(void)
Q_CHECK_PTR(_sensorsComponent);
_components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent));
+ _powerComponent = new PowerComponent(_uas, this);
+ Q_CHECK_PTR(_powerComponent);
+ _components.append(QVariant::fromValue((VehicleComponent*)_powerComponent));
+
_safetyComponent = new SafetyComponent(_uas, this);
Q_CHECK_PTR(_safetyComponent);
_components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent));
diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
index 92e1499c033d6e8f18606bf9e1c2f90ea1cc521c..47c6ee5927cadcbd7cfa50234c3564b7773341c5 100644
--- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
+++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
@@ -33,6 +33,7 @@
#include "FlightModesComponent.h"
#include "SensorsComponent.h"
#include "SafetyComponent.h"
+#include "PowerComponent.h"
#include
@@ -64,7 +65,8 @@ public:
FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; }
SensorsComponent* sensorsComponent(void) { return _sensorsComponent; }
SafetyComponent* safetyComponent(void) { return _safetyComponent; }
-
+ PowerComponent* powerComponent(void) { return _powerComponent; }
+
private slots:
void _checkForIncorrectParameterVersion(void);
@@ -76,6 +78,7 @@ private:
FlightModesComponent* _flightModesComponent;
SensorsComponent* _sensorsComponent;
SafetyComponent* _safetyComponent;
+ PowerComponent* _powerComponent;
bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed
};
diff --git a/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml b/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml
index bde8da849f57ed7ade9be84fc6dd7d161e76737b..9a27ed5a4d2ebbc79b4d7ed3bba599a6513719a0 100644
--- a/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml
+++ b/src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml
@@ -5,17 +5,20 @@
Empty cell voltage
Defines the voltage where a single cell of the battery is considered empty.
3.4
+ V
Full cell voltage
Defines the voltage where a single cell of the battery is considered full.
4.2
+ V
Voltage drop per cell on 100% load
This implicitely defines the internal resistance
to maximum current ratio and assumes linearity.
0.07
+ V
Number of cells
diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.cc b/src/AutoPilotPlugins/PX4/PowerComponent.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5a3ff31f173892e51f9835a106a3c6d1dac26ca1
--- /dev/null
+++ b/src/AutoPilotPlugins/PX4/PowerComponent.cc
@@ -0,0 +1,118 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+/// @file
+/// @author Gus Grubba
+
+#include "PowerComponent.h"
+#include "PX4RCCalibration.h"
+#include "QGCQmlWidgetHolder.h"
+#include "PX4AutoPilotPlugin.h"
+
+PowerComponent::PowerComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ PX4Component(uas, autopilot, parent),
+ _name(tr("Power"))
+{
+}
+
+QString PowerComponent::name(void) const
+{
+ return _name;
+}
+
+QString PowerComponent::description(void) const
+{
+ return tr("The Power Component is used to setup battery parameters as well as advanced settings for propellers and magnetometer.");
+}
+
+QString PowerComponent::iconResource(void) const
+{
+ return "PowerComponentIcon.png";
+}
+
+bool PowerComponent::requiresSetup(void) const
+{
+ return true;
+}
+
+bool PowerComponent::setupComplete(void) const
+{
+ QVariant cvalue, evalue, nvalue;
+ if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_V_CHARGED", cvalue)) {
+ if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_V_EMPTY", evalue)) {
+ if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "BAT_N_CELLS", nvalue)) {
+ return (cvalue.toFloat() > 0.1f) && (evalue.toFloat() > 0.1f) && (nvalue.toInt() > 0);
+ }
+ }
+ }
+ Q_ASSERT(false);
+ return false;
+}
+
+QString PowerComponent::setupStateDescription(void) const
+{
+ const char* stateDescription;
+
+ if (requiresSetup()) {
+ stateDescription = "Requires setup";
+ } else {
+ stateDescription = "Setup complete";
+ }
+ return QString(stateDescription);
+}
+
+QStringList PowerComponent::setupCompleteChangedTriggerList(void) const
+{
+ return QStringList();
+}
+
+QStringList PowerComponent::paramFilterList(void) const
+{
+ QStringList list;
+
+ return list;
+}
+
+QWidget* PowerComponent::setupWidget(void) const
+{
+ QGCQmlWidgetHolder* holder = new QGCQmlWidgetHolder();
+ Q_CHECK_PTR(holder);
+ holder->setAutoPilot(_autopilot);
+ holder->setSource(QUrl::fromUserInput("qrc:/qml/PowerComponent.qml"));
+ return holder;
+}
+
+QUrl PowerComponent::summaryQmlSource(void) const
+{
+ return QUrl::fromUserInput("qrc:/qml/PowerComponentSummary.qml");
+}
+
+QString PowerComponent::prerequisiteSetup(void) const
+{
+ PX4AutoPilotPlugin* plugin = dynamic_cast(_autopilot);
+ Q_ASSERT(plugin);
+ if (!plugin->airframeComponent()->setupComplete()) {
+ return plugin->airframeComponent()->name();
+ }
+ return QString();
+}
diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.h b/src/AutoPilotPlugins/PX4/PowerComponent.h
new file mode 100644
index 0000000000000000000000000000000000000000..a89ef9a4acd611d827f65817cccec95dad74b595
--- /dev/null
+++ b/src/AutoPilotPlugins/PX4/PowerComponent.h
@@ -0,0 +1,60 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+#ifndef PowerComponent_H
+#define PowerComponent_H
+
+#include "PX4Component.h"
+
+/// @file
+/// @brief Battery, propeller and magnetometer settings
+/// @author Gus Grubba
+
+class PowerComponent : public PX4Component
+{
+ Q_OBJECT
+
+public:
+ PowerComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
+
+ // Virtuals from PX4Component
+ virtual QStringList setupCompleteChangedTriggerList(void) const;
+
+ // Virtuals from VehicleComponent
+ virtual QString name (void) const;
+ virtual QString description (void) const;
+ virtual QString iconResource (void) const;
+ virtual bool requiresSetup (void) const;
+ virtual bool setupComplete (void) const;
+ virtual QString setupStateDescription (void) const;
+ virtual QWidget* setupWidget (void) const;
+ virtual QStringList paramFilterList (void) const;
+ virtual QUrl summaryQmlSource (void) const;
+ virtual QString prerequisiteSetup (void) const;
+
+private:
+ const QString _name;
+ QVariantList _summaryItems;
+};
+
+#endif
diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml
new file mode 100644
index 0000000000000000000000000000000000000000..671a0cf455e04139273445d20e96d7dfebd46bd1
--- /dev/null
+++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml
@@ -0,0 +1,116 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+/// @file
+/// @brief Battery, propeller and magnetometer settings
+/// @author Gus Grubba
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+
+import QGroundControl.FactSystem 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.Controls 1.0
+
+Rectangle {
+ QGCPalette { id: palette; colorGroupEnabled: true }
+
+ width: 600
+ height: 600
+ color: palette.window
+
+ property int firstColumnWidth: 220
+
+ Column {
+ anchors.fill: parent
+ spacing: 10
+
+ QGCLabel {
+ text: "POWER CONFIG"
+ font.pointSize: 20
+ }
+
+ Item { height: 1; width: 10 }
+
+ QGCLabel {
+ text: "Battery"
+ color: palette.text
+ font.pointSize: 20
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 160
+ color: palette.windowShade
+
+ Column {
+ id: batteryColumn
+ spacing: 10
+ anchors.verticalCenter: parent.verticalCenter
+ x: (parent.x + 20)
+
+ Row {
+ spacing: 10
+ QGCLabel { text: "Number of Cells"; width: firstColumnWidth; anchors.baseline: cellsField.baseline}
+ FactTextField {
+ id: cellsField
+ fact: Fact { name: "BAT_N_CELLS" }
+ showUnits: true
+ }
+ }
+
+ Row {
+ spacing: 10
+ QGCLabel { text: "Full Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battHighField.baseline}
+ FactTextField {
+ id: battHighField
+ fact: Fact { name: "BAT_V_CHARGED" }
+ showUnits: true
+ }
+ }
+
+ Row {
+ spacing: 10
+ QGCLabel { text: "Empty Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battLowField.baseline}
+ FactTextField {
+ id: battLowField
+ fact: Fact { name: "BAT_V_EMPTY" }
+ showUnits: true
+ }
+ }
+
+ Row {
+ spacing: 10
+ QGCLabel { text: "Voltage Drop on Full Load (per cell)"; width: firstColumnWidth; anchors.baseline: battDropField.baseline}
+ FactTextField {
+ id: battDropField
+ fact: Fact { name: "BAT_V_LOAD_DROP" }
+ showUnits: true
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml b/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml
new file mode 100644
index 0000000000000000000000000000000000000000..f2cc77661621bf3927ad04aa3b8c70dac000d573
--- /dev/null
+++ b/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml
@@ -0,0 +1,80 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+/// @file
+/// @brief Battery, propeller and magnetometer summary
+/// @author Gus Grubba
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+
+import QGroundControl.FactSystem 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Controls 1.0
+
+Column {
+ anchors.fill: parent
+ anchors.margins: 8
+
+ Row {
+ width: parent.width
+ QGCLabel { id: battFull; text: "Battery Full:" }
+ FactLabel {
+ fact: Fact { name: "BAT_V_CHARGED" }
+ horizontalAlignment: Text.AlignRight;
+ width: parent.width - battFull.contentWidth;
+ }
+ }
+
+ Row {
+ width: parent.width
+ QGCLabel { id: battEmpty; text: "Battery Empty:" }
+ FactLabel {
+ fact: Fact { name: "BAT_V_EMPTY" }
+ horizontalAlignment: Text.AlignRight;
+ width: parent.width - battEmpty.contentWidth;
+ }
+ }
+
+ Row {
+ width: parent.width
+ QGCLabel { id: battCells; text: "Number of Cells:" }
+ FactLabel {
+ fact: Fact { name: "BAT_N_CELLS" }
+ horizontalAlignment: Text.AlignRight;
+ width: parent.width - battCells.contentWidth;
+ }
+ }
+
+ Row {
+ width: parent.width
+ QGCLabel { id: battDrop; text: "Voltage Drop:" }
+ FactLabel {
+ fact: Fact { name: "BAT_V_LOAD_DROP" }
+ horizontalAlignment: Text.AlignRight;
+ width: parent.width - battDrop.contentWidth;
+ }
+ }
+
+}
diff --git a/src/QmlControls/QGCColoredImage.qml b/src/QmlControls/QGCColoredImage.qml
index 72e4ee77580ddd6aab3504edf31e2b5e4e179b44..c6d7a43277804d04ea29669eb82379c28ea828e7 100644
--- a/src/QmlControls/QGCColoredImage.qml
+++ b/src/QmlControls/QGCColoredImage.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.2
+import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtGraphicalEffects 1.0
@@ -17,6 +17,7 @@ Item {
property alias paintedWidth: image.paintedWidth
property alias progress: image.progress
property alias smooth: image.smooth
+ property alias mipmap: image.mipmap
property alias source: image.source
property alias sourceSize: image.sourceSize
property alias status: image.status
@@ -28,6 +29,7 @@ Item {
Image {
id: image
smooth: true
+ mipmap: true
visible: false
anchors.fill: parent
}
@@ -37,4 +39,4 @@ Item {
source: image
color: parent.color
}
-}
\ No newline at end of file
+}