From 8c817f27a2cbf36a346adab28f2abaf31186c836 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Mon, 21 Oct 2024 09:34:16 +1100 Subject: [PATCH] HACK: AP_Periph: send ESC count and error count This sends both the count and the error count within the error_count field of the ESC telemetry message. count is held in the lower 16 bits and error count in the upper 16 bits. --- Tools/AP_Periph/can.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tools/AP_Periph/can.cpp b/Tools/AP_Periph/can.cpp index 30ec6e133b..b945032ef4 100644 --- a/Tools/AP_Periph/can.cpp +++ b/Tools/AP_Periph/can.cpp @@ -1705,6 +1705,13 @@ void AP_Periph_FW::esc_telem_update() #endif pkt.error_count = 0; + uint16_t error_count, count; + if (esc_telem.get_count(i, count)) { + pkt.error_count = count; + } + if (esc_telem.get_error_count(i, error_count)) { + pkt.error_count += (error_count & 0xFFFF) << 16; + } uint8_t buffer[UAVCAN_EQUIPMENT_ESC_STATUS_MAX_SIZE] {}; uint16_t total_size = uavcan_equipment_esc_Status_encode(&pkt, buffer, !canfdout());