Skip to content

fix(mavlink): report lost links, keep saved serial ports, and isolate parsers between streams - #51

Merged
RickyWu18 merged 5 commits into
masterfrom
fix/mavlink-connection-problem
Dec 3, 2026
Merged

RickyWu18 merged 5 commits into
masterfrom
fix/mavlink-connection-problem

Conversation

@RickyWu18

Copy link
Copy Markdown
Owner

Summary

Fixes several MAVLink stream connection problems (#27). A link that stops receiving now ends the stream with an error that names the link. A saved serial port that is not plugged in is kept instead of being silently replaced. The baud list goes up to 921600. Two MAVLink streams running at once no longer corrupt each other's frames.

  • Lost link: when the remote closes a TCP connection, a serial device is unplugged, or a read fails, the stream stops with an error, for example Connection closed by <host>:<port> or Serial port <name> lost: .... Before this change, the source kept running with no data and no error. Bytes received before the failure are still delivered.
  • Saved serial port: the dialog shows a missing port as <port> (not found), and starting fails with Serial port <port> not found. Before this change, the first listed port replaced it, was opened and was saved. The port list is read again on start, so a device plugged in after the dialog opened is found.
  • Baud rates: 230400, 460800 and 921600 are added. If the configured rate is not in the list, it is inserted in sorted order and selected. Before this change, the combo showed 1200 while the link used the configured rate.
  • Parallel streams: every StreamParser shared the MAVLink library's global framing state for channel 0. Each parser now owns its state through mavlink_frame_char_buffer(), and it recovers from a bad CRC or signature the same way as mavlink_parse_char().

Target PlotJuggler version

  • PJ3 (pj3/)
  • PJ4 (pj4/)
  • Both / shared (3rdparty/, docs/, root files)

Plugin(s) affected

  • DataStreamMavlink
  • DataLoadArdupilot
  • Shared / build / CI
  • New plugin

Type of change

  • feat — new feature
  • fix — bug fix
  • refactor — no behavior change
  • docs — documentation only
  • build — CMake / vcpkg / CI

Testing

  • New unit tests in core/tests/mavlink_decoder_test.cpp: ParsersKeepSeparateFramingState, RecoversAfterACorruptedFrame.
  • New data_stream_mavlink_test target (built with PJ_BUILD_TESTS): tests/transport_test.cpp, tests/mavlink_dialog_test.cpp.

@RickyWu18
RickyWu18 merged commit 9895b52 into master Dec 3, 2026
7 checks passed
@RickyWu18
RickyWu18 deleted the fix/mavlink-connection-problem branch December 3, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant