MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / on_messages_ground_unit

Method on_messages_ground_unit

OpenHD/ohd_telemetry/src/AirTelemetry.cpp:105–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void AirTelemetry::on_messages_ground_unit(
106 std::vector<MavlinkMessage>& messages) {
107 // m_console->debug("on_messages_ground_unit {}", messages.size());
108 // filter out heartbeats from the openhd ground unit,we do not need to send
109 // them to the FC
110 std::vector<MavlinkMessage> filtered_messages_fc;
111 for (const auto& msg : messages) {
112 const mavlink_message_t& m = msg.m;
113 if (static_cast<int>(m.msgid) == MAVLINK_MSG_ID_HEARTBEAT &&
114 m.sysid == OHD_SYS_ID_GROUND)
115 continue;
116 filtered_messages_fc.push_back(msg);
117 }
118 send_messages_fc(filtered_messages_fc);
119 // any data created by an OpenHD component on the air pi only needs to be sent
120 // to the ground pi, the FC cannot do anything with it anyways.
121 std::lock_guard<std::mutex> guard(m_components_lock);
122 for (auto& component : m_components) {
123 std::vector<MavlinkMessage> responses{};
124 OHDUtil::vec_append(responses,
125 component->process_mavlink_messages(messages));
126 send_messages_ground_unit(responses);
127 }
128}
129
130void AirTelemetry::loop_infinite(bool& terminate,
131 const bool enableExtendedLogging) {

Callers

nothing calls this directly

Calls 3

vec_appendFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected