Browse Source

AP_FETtecOneWire: Fix state of CRC error counters after _fast_throttle_cmd_count overflow

gps-1.3.1
Dr.-Ing. Amilcar do Carmo Lucas 4 years ago committed by Peter Barker
parent
commit
92a75661e0
  1. 4
      libraries/AP_FETtecOneWire/AP_FETtecOneWire.cpp

4
libraries/AP_FETtecOneWire/AP_FETtecOneWire.cpp

@ -418,9 +418,11 @@ void AP_FETtecOneWire::handle_message_telem(ESC &esc) @@ -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,

Loading…
Cancel
Save