mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1814 Reset consumed energy from PFD
This commit is contained in:
parent
2350acb068
commit
da4dc0e935
@ -355,6 +355,13 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: reset_consumed_energy_mouseArea;
|
||||||
|
anchors.fill: parent;
|
||||||
|
cursorShape: Qt.PointingHandCursor;
|
||||||
|
onClicked: qmlWidget.resetConsumedEnergy();
|
||||||
|
}
|
||||||
|
|
||||||
// Alarm based on FlightBatteryState.EstimatedFlightTime < 120s orange, < 60s red
|
// Alarm based on FlightBatteryState.EstimatedFlightTime < 120s orange, < 60s red
|
||||||
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" :
|
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" :
|
||||||
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": info.batColors[SystemAlarms.Alarm_Battery]))
|
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": info.batColors[SystemAlarms.Alarm_Battery]))
|
||||||
|
@ -480,6 +480,13 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: reset_panel_consumed_energy_mouseArea;
|
||||||
|
anchors.fill: parent;
|
||||||
|
cursorShape: Qt.PointingHandCursor;
|
||||||
|
onClicked: qmlWidget.resetConsumedEnergy();
|
||||||
|
}
|
||||||
|
|
||||||
// Alarm based on FlightBatteryState.EstimatedFlightTime < 120s orange, < 60s red
|
// Alarm based on FlightBatteryState.EstimatedFlightTime < 120s orange, < 60s red
|
||||||
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" :
|
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" :
|
||||||
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": panels.batColors[SystemAlarms.Alarm_Battery]))
|
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": panels.batColors[SystemAlarms.Alarm_Battery]))
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "extensionsystem/pluginmanager.h"
|
#include "extensionsystem/pluginmanager.h"
|
||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
#include "uavobject.h"
|
#include "uavobject.h"
|
||||||
|
#include "flightbatterysettings.h"
|
||||||
#include "utils/svgimageprovider.h"
|
#include "utils/svgimageprovider.h"
|
||||||
#ifdef USE_OSG
|
#ifdef USE_OSG
|
||||||
#include "osgearth.h"
|
#include "osgearth.h"
|
||||||
@ -81,6 +82,8 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWindow *parent) :
|
|||||||
|
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
|
m_uavoManager = pm->getObject<UAVObjectManager>();
|
||||||
|
Q_ASSERT(m_uavoManager);
|
||||||
|
|
||||||
foreach(const QString &objectName, objectsToExport) {
|
foreach(const QString &objectName, objectsToExport) {
|
||||||
UAVObject *object = objManager->getObject(objectName);
|
UAVObject *object = objManager->getObject(objectName);
|
||||||
@ -124,6 +127,14 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PfdQmlGadgetWidget::resetConsumedEnergy()
|
||||||
|
{
|
||||||
|
FlightBatterySettings *mBatterySettings = FlightBatterySettings::GetInstance(m_uavoManager);
|
||||||
|
|
||||||
|
mBatterySettings->setResetConsumedEnergy(true);
|
||||||
|
mBatterySettings->setData(mBatterySettings->getData());
|
||||||
|
}
|
||||||
|
|
||||||
void PfdQmlGadgetWidget::setEarthFile(QString arg)
|
void PfdQmlGadgetWidget::setEarthFile(QString arg)
|
||||||
{
|
{
|
||||||
if (m_earthFile != arg) {
|
if (m_earthFile != arg) {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define PFDQMLGADGETWIDGET_H_
|
#define PFDQMLGADGETWIDGET_H_
|
||||||
|
|
||||||
#include "pfdqmlgadgetconfiguration.h"
|
#include "pfdqmlgadgetconfiguration.h"
|
||||||
|
#include "uavobjectmanager.h"
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
|
|
||||||
class PfdQmlGadgetWidget : public QQuickView {
|
class PfdQmlGadgetWidget : public QQuickView {
|
||||||
@ -84,6 +85,8 @@ public:
|
|||||||
return m_altitude;
|
return m_altitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_INVOKABLE void resetConsumedEnergy();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setEarthFile(QString arg);
|
void setEarthFile(QString arg);
|
||||||
void setTerrainEnabled(bool arg);
|
void setTerrainEnabled(bool arg);
|
||||||
@ -119,6 +122,7 @@ protected:
|
|||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
UAVObjectManager *m_uavoManager;
|
||||||
QString m_qmlFileName;
|
QString m_qmlFileName;
|
||||||
QString m_earthFile;
|
QString m_earthFile;
|
||||||
bool m_openGLEnabled;
|
bool m_openGLEnabled;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user