13 bool shouldHandle =
false;
14 uint32_t firstIndex = 0;
18 switch (message.msgid) {
19 case MAVLINK_MSG_ID_ESC_INFO:
21 mavlink_esc_status_t escStatus{};
22 mavlink_msg_esc_status_decode(&message, &escStatus);
23 firstIndex = escStatus.index;
27 case MAVLINK_MSG_ID_ESC_STATUS:
29 mavlink_esc_status_t escStatus{};
30 mavlink_msg_esc_status_decode(&message, &escStatus);
31 firstIndex = escStatus.index;
55 :
FactGroupWithId(1000, QStringLiteral(
":/json/Vehicle/EscStatusFactGroup.json"), parent)
68 _rpmFact.setRawValue(0);
69 _currentFact.setRawValue(0);
70 _voltageFact.setRawValue(0);
71 _countFact.setRawValue(0);
72 _connectionTypeFact.setRawValue(0);
73 _infoFact.setRawValue(0);
74 _failureFlagsFact.setRawValue(0);
75 _errorCountFact.setRawValue(0);
76 _temperatureFact.setRawValue(0);
81 switch (message.msgid) {
82 case MAVLINK_MSG_ID_ESC_INFO:
83 _handleEscInfo(vehicle, message);
85 case MAVLINK_MSG_ID_ESC_STATUS:
86 _handleEscStatus(vehicle, message);
95 mavlink_esc_info_t escInfo{};
96 mavlink_msg_esc_info_decode(&message, &escInfo);
98 uint8_t index =
_idFact.rawValue().toUInt();
100 if (index < escInfo.index || index >= escInfo.index + 4) {
106 _countFact.setRawValue(escInfo.count);
107 _connectionTypeFact.setRawValue(escInfo.connection_type);
108 _infoFact.setRawValue(escInfo.info);
109 _failureFlagsFact.setRawValue(escInfo.failure_flags[index]);
110 _errorCountFact.setRawValue(escInfo.error_count[index]);
111 _temperatureFact.setRawValue(escInfo.temperature[index]);
118 mavlink_esc_status_t escStatus{};
119 mavlink_msg_esc_status_decode(&message, &escStatus);
121 uint8_t index =
_idFact.rawValue().toUInt();
123 if (index < escStatus.index || index >= escStatus.index + 4) {
129 _rpmFact.setRawValue(escStatus.rpm[index]);
130 _currentFact.setRawValue(escStatus.current[index]);
131 _voltageFact.setRawValue(escStatus.voltage[index]);
struct __mavlink_message mavlink_message_t
EscStatusFactGroupListModel(QObject *parent=nullptr)
bool _shouldHandleMessage(const mavlink_message_t &message, QList< uint32_t > &ids) const final
FactGroupWithId * _createFactGroupWithId(uint32_t id) final
EscStatusFactGroup(uint32_t escIndex, QObject *parent=nullptr)
void handleMessage(Vehicle *vehicle, const mavlink_message_t &message) final
Allows a FactGroup to parse incoming messages and fill in values.
FactGroupListModel(const char *factGroupNamePrefix, QObject *parent=nullptr)
FactGroupWithId is a FactGroup which has an id Fact which can be used to identify the group.
FactGroupWithId(int updateRateMsecs, const QString &metaDataFile, QObject *parent=nullptr, bool ignoreCamelCase=false)
void _setTelemetryAvailable(bool telemetryAvailable)
void _addFact(Fact *fact, const QString &name)
QModelIndex index(int row, int column=0, const QModelIndex &parent=QModelIndex()) const override
QModelIndex parent(const QModelIndex &child) const override