fix(mavlink): ignore DISTANCE_SENSOR on a distance sensor link (#29454)

A rangefinder peripheral such as the ARK DIST sends its ranges on a link in distance_sensor mode. The flight controller streams every range it has back on that link, the peripheral's own included, and the peripheral published each one as a second distance_sensor instance, which its DISTANCE_SENSOR stream then sent back out. On the flight controller the peripheral's own range came back a round trip late, and any other rangefinder's range came back labelled as the peripheral. A distance sensor link exists only to send ranges, so ignore the ones it receives.

Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit 4464ae66b5)
This commit is contained in:
Jacob Dahl authored and Ramon Roche committed 2026-11-16 07:26:09 -08:00
1 parent d00c2af091
commit c55679977e
1 file changed
+6 -1
+6 -1
View File
@@ -214,7 +214,12 @@ MavlinkReceiver::handle_message(mavlink_message_t *msg)
break;
case MAVLINK_MSG_ID_DISTANCE_SENSOR:
handle_message_distance_sensor(msg);
// The peer streams its ranges back on this link, ours among them, and the stream would send them out again
if (_mavlink.get_mode() != Mavlink::MAVLINK_MODE::MAVLINK_MODE_DISTANCE_SENSOR) {
handle_message_distance_sensor(msg);
}
break;
case MAVLINK_MSG_ID_FOLLOW_TARGET: