Skip to content

Commit

Permalink
HACK: AP_Periph: embed good count in error_count
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robertlong13 committed Nov 12, 2024
1 parent 51f1cf0 commit 053511c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Tools/AP_Periph/can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] {};
Expand Down

0 comments on commit 053511c

Please sign in to comment.