Browse Source

Vehicle: check if health_and_arming_check event protocol supported

QGC4.4
Beat Küng 3 years ago
parent
commit
d3bbf300ca
  1. 5
      src/Vehicle/EventHandler.h
  2. 9
      src/Vehicle/Vehicle.cc

5
src/Vehicle/EventHandler.h

@ -41,6 +41,11 @@ public: @@ -41,6 +41,11 @@ public:
int getModeGroup(int32_t customMode);
bool healthAndArmingChecksSupported() const {
const auto& protocols = _parser.supportedProtocols(_compid);
return protocols.find("health_and_arming_check") != protocols.end();
}
signals:
void healthAndArmingChecksUpdated();

9
src/Vehicle/Vehicle.cc

@ -891,6 +891,15 @@ void Vehicle::_chunkedStatusTextCompleted(uint8_t compId) @@ -891,6 +891,15 @@ void Vehicle::_chunkedStatusTextCompleted(uint8_t compId)
bool ardupilotPrearm = messageText.startsWith(QStringLiteral("PreArm"));
bool px4Prearm = messageText.startsWith(QStringLiteral("preflight"), Qt::CaseInsensitive) && severity >= MAV_SEVERITY_CRITICAL;
if (ardupilotPrearm || px4Prearm) {
// check if expected as event
auto eventData = _events.find(compId);
if (eventData != _events.end()) {
if (eventData->data()->healthAndArmingChecksSupported()) {
qCDebug(VehicleLog) << "Dropping preflight message (expected as event):" << messageText;
return;
}
}
// Limit repeated PreArm message to once every 10 seconds
if (_noisySpokenPrearmMap.contains(messageText) && _noisySpokenPrearmMap[messageText].msecsTo(QTime::currentTime()) < (10 * 1000)) {
skipSpoken = true;

Loading…
Cancel
Save