From 92a75661e05e420645cf8bc98caef4db361ec4df Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Tue, 17 Aug 2021 19:22:11 +0200 Subject: [PATCH] AP_FETtecOneWire: Fix state of CRC error counters after _fast_throttle_cmd_count overflow --- libraries/AP_FETtecOneWire/AP_FETtecOneWire.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/AP_FETtecOneWire/AP_FETtecOneWire.cpp b/libraries/AP_FETtecOneWire/AP_FETtecOneWire.cpp index 0bc6b632a8..9a5a2dc5b1 100644 --- a/libraries/AP_FETtecOneWire/AP_FETtecOneWire.cpp +++ b/libraries/AP_FETtecOneWire/AP_FETtecOneWire.cpp @@ -418,9 +418,11 @@ void AP_FETtecOneWire::handle_message_telem(ESC &esc) // update rpm and error rate float error_rate_pct = 0; - if (_fast_throttle_cmd_count) { + if (_fast_throttle_cmd_count > _esc_count) { error_rate_pct = (tlm.tx_err_count-esc.error_count_at_throttle_count_overflow)*(float)100/(float)_fast_throttle_cmd_count; } else { + // the telemetry is requested in a round-robin, sequential fashion + // so the in the first _esc_count times all ESCs get to initialize this esc.error_count_at_throttle_count_overflow = tlm.tx_err_count; } update_rpm(esc.servo_ofs,