QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PowerComponent.cc
Go to the documentation of this file.
1#include "PowerComponent.h"
2#include "ParameterManager.h"
3#include "Vehicle.h"
4
5PowerComponent::PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
6 : VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownPowerVehicleComponent, parent)
7 , _name(tr("Power"))
8{
9}
10
11QString PowerComponent::name(void) const
12{
13 return _name;
14}
15
16QString PowerComponent::description(void) const
17{
18 return tr("Power Setup is used to setup battery parameters as well as advanced settings for propellers.");
19}
20
22{
23 return "/qmlimages/PowerComponentIcon.png";
24}
25
27{
28 return true;
29}
30
32{
37 return true;
38 }
39 return _vehicle->parameterManager()->getParameter(ParameterManager::defaultComponentId, "BAT1_SOURCE")->rawValue().toInt() == -1 ||
40 (_vehicle->parameterManager()->getParameter(ParameterManager::defaultComponentId, "BAT1_V_CHARGED")->rawValue().toFloat() != 0.0f &&
41 _vehicle->parameterManager()->getParameter(ParameterManager::defaultComponentId, "BAT1_V_EMPTY")->rawValue().toFloat() != 0.0f &&
42 _vehicle->parameterManager()->getParameter(ParameterManager::defaultComponentId, "BAT1_N_CELLS")->rawValue().toInt() != 0);
43}
44
46{
47 return {"BAT1_SOURCE", "BAT1_V_CHARGED", "BAT1_V_EMPTY", "BAT1_N_CELLS"};
48}
49
51{
52 return QUrl::fromUserInput("qrc:/qml/QGroundControl/AutoPilotPlugins/PX4/PowerComponent.qml");
53}
54
56{
57 return QUrl::fromUserInput("qrc:/qml/QGroundControl/AutoPilotPlugins/PX4/PowerComponentSummary.qml");
58}
bool parameterExists(int componentId, const QString &paramName) const
Fact * getParameter(int componentId, const QString &paramName)
static constexpr int defaultComponentId
QStringList setupCompleteChangedTriggerList(void) const override
QString name(void) const override
bool requiresSetup(void) const override
QString description(void) const override
bool setupComplete(void) const override
PowerComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, QObject *parent=nullptr)
QUrl summaryQmlSource(void) const override
QUrl setupSource(void) const override
QString iconResource(void) const override
ParameterManager * parameterManager()
Definition Vehicle.h:578