Files
ardupilot/Tools/scripts
Peter BarkerandClaude Opus 4.8 5152cde404 Tools: check SerialProtocol default-protocol gate coverage
serial_protocol_compiled_in() in
AP_SerialManager_default_protocol_check.cpp gates each serial port default
protocol against the feature that provides it, but falls through to "true"
for any protocol it does not name -- so a protocol added to the enum without
a term there is silently treated as always-compiled-in, defeating the check
for that protocol.  Nothing in the C++ can notice that omission.

Add check_serial_protocol_gates.py, which parses the SerialProtocol
enumerators from AP_SerialManager.h and the protocols named by
serial_protocol_compiled_in(), and requires every enumerator to be either
gated there or listed in an explicit UNGATED register (with the reason).  A
new protocol in neither, or a stale name in the C++/register, is an error.

The register also makes visible the protocols that have a feature but are not
yet gated (GPS, Rangefinder, AirSpeed, AHRS, ...); gating those is a
behaviour-neutral follow-up.

Run it from pre-commit when the header, the check, or the script changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 14:03:37 +10:00
..
…
2026-06-30 09:39:04 +10:00
…