17 , _name(tr(
"Flight Modes"))
28 return tr(
"Choose how the pilot selects flight modes, and what each transmitter switch does.");
33 return "/qmlimages/FlightModesComponentIcon.png";
38 return QUrl::fromUserInput(
"qrc:/qml/QGroundControl/AutoPilotPlugins/PX4/PX4FlightModes.qml");
43 QStringList triggers{QStringLiteral(
"RC_MAP_FLTMODE"), QStringLiteral(
"RC_MAP_FLTM_BTN"),
44 QStringLiteral(
"COM_FLTMODE_BOOT")};
46 triggers.append(QStringLiteral(
"COM_FLTMODE%1").arg(slot));
60QString FlightModesComponent::_modeName(
const QString& paramName)
const
67 const QStringList externalNames =
71 externalNames, fact->
rawValue().toInt());
80 const int modeChannelValue = modeChannel ? modeChannel->
rawValue().toInt() : 0;
81 const int buttonMask = buttons ? buttons->
rawValue().toInt() : 0;
83 QList<VehicleSummaryItem> items;
84 bool selectionAssigned =
true;
87 items.append({tr(
"Mode selection"), modeChannel->
enumStringValue(), VehicleSummaryItem::Normal});
92 channels.append(tr(
"Ch %1").arg(channel));
94 items.append({tr(
"Mode selection"), tr(
"Buttons on %1").arg(channels.join(QStringLiteral(
", "))),
95 VehicleSummaryItem::Normal});
99 selectionAssigned =
false;
100 items.append({tr(
"Mode selection"), tr(
"Not assigned"), VehicleSummaryItem::Muted});
104 if (selectionAssigned) {
106 const QString paramName = QStringLiteral(
"COM_FLTMODE%1").arg(slot);
108 items.append({tr(
"Flight Mode %1").arg(slot), _modeName(paramName), VehicleSummaryItem::Normal});
114 items.append({tr(
"Mode on boot"), _modeName(QStringLiteral(
"COM_FLTMODE_BOOT")), VehicleSummaryItem::Normal});
The AutoPilotPlugin class is an abstract base class which represents the methods and objects which ar...
A Fact is used to hold a single value within the system.
QVariantList enumValues() const
QStringList enumStrings() const
QString cookedValueString() const
QString enumStringValue()
QVariant rawValue() const
QString name(void) const final
QString description(void) const final
QList< VehicleSummaryItem > summaryItems() const final
Values for this component's card on the Summary page. A component with none falls back to summaryQmlS...
QStringList summaryChangedTriggerList() const final
Parameters whose change emits summaryItemsChanged, besides those that change setupComplete.
QString iconResource(void) const final
QUrl setupSource(void) const final
void setupTriggerSignals() final
FlightModesComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, QObject *parent=nullptr)
static QStringList externalFlightModeNames(const FlightModeList &modeList)
externalFlightModeName of each of External Mode 1-8, in order
VehicleComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent, QObject *parent=nullptr)
void summaryItemsChanged()
Fact * _parameterFact(const QString &name) const
Fact of a parameter of the default component, nullptr when the vehicle does not have it.
virtual void setupTriggerSignals()
void flightModesChanged()
QList< int > buttonChannels(int buttonMask)
QString modeName(const QString ¶mName, const QStringList &enumStrings, const QVariantList &enumValues, const QStringList &externalNames, int value)
Label of the mode a parameter value selects, as modeChoices shows it. Empty for a value with no choic...
SelectionMethod selectionMethod(int modeChannel, int buttonMask)
PX4 ignores the mode buttons while a mode channel is set.
constexpr int kModeSlotCount
Number of mode slots, COM_FLTMODE1 to COM_FLTMODE6.