--[[ ArduPilot lua script to log debug messages from AM32 DroneCAN ESCs on the flight controller To install set SCR_ENABLE=1 and put this script in APM/SCRIPTS/ on the microSD of the flight controller then restart the flight controller --]] -- assume ESCs are nodes 30, 31, 32 and 33 local ESC_BASE = 30 local AM32_DEBUG = 100 local last_tstamp = {} local ts_zero = uint32_t(0) local reported_version_error = false function log_AM32() for i = 0, 3 do local last_ts = last_tstamp[i] or ts_zero tstamp_us, msg = DroneCAN_get_FlexDebug(0, ESC_BASE+i, AM32_DEBUG, last_ts) if tstamp_us and msg then version, commutation_interval, num_commands, num_input, rx_errors, rxframe_error, rx_ecode, auto_advance_level = string.unpack("