Files
ardupilot/Tools/scripts/build_log_message_documentation.sh
T
Peter Barker b2b1b3d279
pre-commit / ci (push) Canceled after 0s
test Renode / cubeorangeplus-quadplane (push) Canceled after 0s
test scripts / build (astyle-cleanliness) (push) Canceled after 0s
test scripts / build (check_autotest_options) (push) Canceled after 0s
test scripts / build (logger_metadata) (push) Canceled after 0s
test scripts / build (param-file-validation) (push) Canceled after 0s
test scripts / build (param_parse) (push) Canceled after 0s
test scripts / build (python-cleanliness) (push) Canceled after 0s
test scripts / build (shellcheck) (push) Canceled after 0s
test scripts / build (validate_board_list) (push) Canceled after 0s
Tools: decode_devid.py: parse device types from the C++ headers
Rather than maintaining copies of the bus and device type tables,
decode_devid.py now parses the enums in AP_HAL/Device.h, AP_SerialManager.h
and the compass, IMU, baro and airspeed backend headers using
logger_metadata/enum_parse.py.  A small rename map keeps established
display names (DRONECAN, AK0991x), and the retired LIS2MDL ID, which is
in no enum, is listed explicitly.  Comments on enum entries are shown as
warnings when decoding.

--dump-json and --dump-json5 write the tables, with a format_version
and a content-hash data_version, for tools without a source tree;
--json reads such a file back.  A copy of the script outside an
ArduPilot tree (as synced by MethodicConfigurator) reads devid.json from
its own directory.  The files are published alongside LogMessages.* by
build_log_message_documentation.sh, and CI dumps them in the
logger_metadata step so that header changes which break parsing are
caught.

The tables had drifted from the headers: ACC_LSM9DS1,
INS_ZEROONE_FPGA_SCH16T and INS_ICM56686 were missing, MMC5883 is now
MMC5983, AK8963/BMM150 had trailing spaces, and several names now
follow the headers.
2026-09-16 17:18:56 +10:00

38 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
set -x
if [ "x$BUILDLOGS" = "x" ]; then
BUILDLOGS="../buildlogs"
fi
DIR="$BUILDLOGS/LogMessages"
# work from either APM directory or above
[ -d ArduPlane ] || cd APM
/bin/mkdir -p "$DIR"
generate_log_message_documentation() {
VEHICLE="$1"
# generate Parameters.html, Parameters.rst etc etc:
./Tools/autotest/logger_metadata/parse.py --vehicle "$VEHICLE"
# stash some of the results away:
VEHICLE_DIR="$DIR/$VEHICLE"
mkdir -p "$VEHICLE_DIR"
/bin/cp LogMessages.* "$VEHICLE_DIR/"
gzip -9 <"$VEHICLE_DIR"/LogMessages.xml >"$VEHICLE_DIR"/LogMessages.xml.gz.new && mv "$VEHICLE_DIR"/LogMessages.xml.gz.new "$VEHICLE_DIR"/LogMessages.xml.gz
xz -e <"$VEHICLE_DIR"/LogMessages.xml >"$VEHICLE_DIR"/LogMessages.xml.xz.new && mv "$VEHICLE_DIR"/LogMessages.xml.xz.new "$VEHICLE_DIR"/LogMessages.xml.xz
}
for vehicle in Rover Plane Copter Tracker Blimp Sub; do
generate_log_message_documentation "$vehicle"
done
# device ID bus/device type tables (vehicle-independent) for decoding *_DEV_ID parameters and log fields:
./Tools/scripts/decode_devid.py --dump-json "$DIR/devid.json.new" --dump-json5 "$DIR/devid.json5.new"
mv "$DIR/devid.json.new" "$DIR/devid.json"
mv "$DIR/devid.json5.new" "$DIR/devid.json5"