From 053511c8f19ddd3a1e67c73b3a35fd61d9a5794a Mon Sep 17 00:00:00 2001 From: Bob Long Date: Tue, 12 Nov 2024 11:05:05 +1100 Subject: [PATCH] HACK: AP_Periph: embed good count in 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 8 bits and error count in the upper 24 bits. --- Tools/AP_Periph/can.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tools/AP_Periph/can.cpp b/Tools/AP_Periph/can.cpp index 822cd716fa..a4f89765b1 100644 --- a/Tools/AP_Periph/can.cpp +++ b/Tools/AP_Periph/can.cpp @@ -1706,8 +1706,12 @@ void AP_Periph_FW::esc_telem_update() pkt.error_count = 0; uint32_t error_count; + uint16_t count; + if (esc_telem.get_count(i, count)) { + pkt.error_count = count & 0xFF; + } if (esc_telem.get_error_count(i, error_count)) { - pkt.error_count = error_count; + pkt.error_count += (error_count & 0xFFFFFF) << 8; } uint8_t buffer[UAVCAN_EQUIPMENT_ESC_STATUS_MAX_SIZE] {};