mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-1814 Reset consumed energy from PFD
This commit is contained in:
parent
2350acb068
commit
da4dc0e935
@ -355,6 +355,13 @@ Item {
|
||||
Rectangle {
|
||||
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
|
||||
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" :
|
||||
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": info.batColors[SystemAlarms.Alarm_Battery]))
|
||||
|
@ -480,6 +480,13 @@ Item {
|
||||
Rectangle {
|
||||
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
|
||||
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" :
|
||||
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": panels.batColors[SystemAlarms.Alarm_Battery]))
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjectmanager.h"
|
||||
#include "uavobject.h"
|
||||
#include "flightbatterysettings.h"
|
||||
#include "utils/svgimageprovider.h"
|
||||
#ifdef USE_OSG
|
||||
#include "osgearth.h"
|
||||
@ -81,6 +82,8 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWindow *parent) :
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
m_uavoManager = pm->getObject<UAVObjectManager>();
|
||||
Q_ASSERT(m_uavoManager);
|
||||
|
||||
foreach(const QString &objectName, objectsToExport) {
|
||||
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)
|
||||
{
|
||||
if (m_earthFile != arg) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define PFDQMLGADGETWIDGET_H_
|
||||
|
||||
#include "pfdqmlgadgetconfiguration.h"
|
||||
#include "uavobjectmanager.h"
|
||||
#include <QQuickView>
|
||||
|
||||
class PfdQmlGadgetWidget : public QQuickView {
|
||||
@ -84,6 +85,8 @@ public:
|
||||
return m_altitude;
|
||||
}
|
||||
|
||||
Q_INVOKABLE void resetConsumedEnergy();
|
||||
|
||||
public slots:
|
||||
void setEarthFile(QString arg);
|
||||
void setTerrainEnabled(bool arg);
|
||||
@ -119,6 +122,7 @@ protected:
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
UAVObjectManager *m_uavoManager;
|
||||
QString m_qmlFileName;
|
||||
QString m_earthFile;
|
||||
bool m_openGLEnabled;
|
||||
|
Loading…
x
Reference in New Issue
Block a user