From a80abdac71c19a9f9ba2b42185931618f5456b89 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Mon, 30 Dec 2024 15:51:32 +1100 Subject: [PATCH] CarbonixCommon: bit_esc: suppress nil warnings These are caused by two well-understood race conditions and we don't need to put them up on the messages tab anymore. This will be fixed properly in a future PR. Also, driveby fix for resetting the nil counters. These should be done every time we get good data, not just when recoving from telemetry loss. --- .../CarbonixCommon/scripts/modules/bit_esc.lua | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/scripts/modules/bit_esc.lua b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/scripts/modules/bit_esc.lua index eadc59ae5a..6778ca8a03 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/scripts/modules/bit_esc.lua +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/scripts/modules/bit_esc.lua @@ -92,28 +92,24 @@ function ESC:update() -- Nil check for RPM reading elseif not esc_rpm then self.esc_rpm_nil_counter[i] = self.esc_rpm_nil_counter[i] + 1 - if self.esc_rpm_nil_counter[i] < self.NIL_WARN_THRESHOLD then - cx_msg:send(cx_msg.MAV_SEVERITY.INFO, "ESC " .. i .. " RPM nil") - elseif self.srv_rpm_in_err_status[i] == false then - cx_msg:send(cx_msg.MAV_SEVERITY.CRITICAL, "ESC " .. i .. " RPM nil") + if self.esc_rpm_nil_counter[i] > self.NIL_WARN_THRESHOLD and self.srv_rpm_in_err_status[i] == false then + cx_msg:send(cx_msg.MAV_SEVERITY.CRITICAL, "ESC " .. i .. " Telemetry Lost") self.srv_telem_in_err_status[i] = true end -- Nil check for servo output elseif not servo_out then self.servo_out_nil_counter[i] = self.servo_out_nil_counter[i] + 1 - if self.servo_out_nil_counter[i] < self.NIL_WARN_THRESHOLD then - cx_msg:send(cx_msg.MAV_SEVERITY.INFO, "ESC " .. i .. " Servo Out nil") - elseif self.srv_rpm_in_err_status[i] == false then - cx_msg:send(cx_msg.MAV_SEVERITY.CRITICAL, "ESC " .. i .. " Servo Out nil") + if self.servo_out_nil_counter[i] > self.NIL_WARN_THRESHOLD and self.srv_rpm_in_err_status[i] == false then + cx_msg:send(cx_msg.MAV_SEVERITY.CRITICAL, "ESC " .. i .. " Telemetry Lost") self.srv_telem_in_err_status[i] = true end -- Telemetry data is fresh and valid else + self.servo_out_nil_counter[i] = 0 + self.esc_rpm_nil_counter[i] = 0 if self.srv_telem_in_err_status[i] == true then cx_msg:send(cx_msg.MAV_SEVERITY.INFO, "ESC " .. i .. " Telemetry Recovered") self.srv_telem_in_err_status[i] = false - self.servo_out_nil_counter[i] = 0 - self.esc_rpm_nil_counter[i] = 0 end -- If armed, check that the motor is actually turning when it is commanded to if arming:is_armed() then