diff --git a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp index 0aff00d016e..ac459c78f84 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp @@ -91,7 +91,7 @@ void EscChecks::checkAndReport(const Context &context, Report &reporter) mask |= checkMotorStatus(context, reporter, esc_status, now); } - if (_param_com_esc_ot_warn.get() >= FLT_EPSILON) { + if (_param_esc_temp_warn_th.get() >= FLT_EPSILON) { checkEscTemperature(reporter, esc_status); } @@ -220,12 +220,12 @@ uint16_t EscChecks::checkEscStatus(const Context &context, Report &reporter, con void EscChecks::checkEscTemperature(Report &reporter, const esc_status_s &esc_status) { - const float warn_temp = _param_com_esc_ot_warn.get(); + const float warn_temp = _param_esc_temp_warn_th.get(); - int hottest_esc_index = -1; + uint8_t hottest_esc_index = UINT8_MAX; float max_temperature = -FLT_MAX; - for (int esc_index = 0; esc_index < esc_status_s::CONNECTED_ESC_MAX; esc_index++) { + for (uint8_t esc_index = 0; esc_index < esc_status_s::CONNECTED_ESC_MAX; esc_index++) { if (!math::isInRange(esc_status.esc[esc_index].actuator_function, esc_report_s::ACTUATOR_FUNCTION_MOTOR1, esc_report_s::ACTUATOR_FUNCTION_MOTOR_MAX)) { continue; @@ -246,7 +246,7 @@ void EscChecks::checkEscTemperature(Report &reporter, const esc_status_s &esc_st /* EVENT * @description * - * This check can be configured via COM_ESC_OT_WARN parameter. + * Configured by ESC_TEMP_WARN_TH * */ reporter.healthFailure(NavModes::None, health_component_t::motors_escs, @@ -257,18 +257,17 @@ void EscChecks::checkEscTemperature(Report &reporter, const esc_status_s &esc_st } } - if (hottest_esc_index < 0) { + if (hottest_esc_index == UINT8_MAX) { return; } - if (max_temperature > warn_temp) { + if (max_temperature >= warn_temp) { if (!_esc_over_temp_warned && reporter.mavlink_log_pub()) { - mavlink_log_warning(reporter.mavlink_log_pub(), - "High ESC temperature. Reduce throttle!"); + mavlink_log_warning(reporter.mavlink_log_pub(), "High ESC temperature. Reduce throttle!"); _esc_over_temp_warned = true; } - } else if (max_temperature < warn_temp - ESC_OVER_TEMP_RESET_MARGIN) { + } else if (max_temperature < warn_temp - 5.f) { _esc_over_temp_warned = false; } } diff --git a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp index cb160497670..8989317b6e4 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp @@ -61,7 +61,7 @@ private: static constexpr hrt_abstime ESC_TIMEOUT_US = 400_ms; - static constexpr float ESC_OVER_TEMP_RESET_MARGIN = 5.f; + uORB::Subscription _esc_status_sub{ORB_ID(esc_status)}; uORB::Subscription _actuator_motors_sub{ORB_ID(actuator_motors)}; @@ -80,5 +80,5 @@ private: (ParamFloat) _param_motfail_c2t, (ParamFloat) _param_motfail_time, (ParamFloat) _param_motfail_off, - (ParamFloat) _param_com_esc_ot_warn); + (ParamFloat) _param_esc_temp_warn_th); }; diff --git a/src/modules/commander/HealthAndArmingChecks/esc_check_params.yaml b/src/modules/commander/HealthAndArmingChecks/esc_check_params.yaml index 4b56967e5f6..6a840ee528f 100644 --- a/src/modules/commander/HealthAndArmingChecks/esc_check_params.yaml +++ b/src/modules/commander/HealthAndArmingChecks/esc_check_params.yaml @@ -51,12 +51,12 @@ parameters: increment: 1 - group: ESC definitions: - COM_ESC_OT_WARN: + ESC_TEMP_WARN_TH: description: - short: ESC over-temperature warning threshold + short: ESC temperature warning threshold long: |- - Warning raised if ESC temperature gets above threshold: no failsafe action triggered or arming prevented. - Set to -1 to disable the check. + Warning only, no failsafe or arming blocked. + -1 disables the check. type: float default: 90.0 min: -1