From a9461c4d1a1fe077144207ba3694b7c8eb495861 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Mon, 23 Feb 2026 14:42:53 +0100 Subject: [PATCH] escCheck: Change MOTFAIL_TIME unit to seconds for better UX --- .../HealthAndArmingChecks/checks/escCheck.cpp | 5 ++--- .../HealthAndArmingChecks/checks/escCheck.hpp | 2 +- .../HealthAndArmingChecks/esc_check_params.c | 11 ++++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp index aa884447d7..5011d78cda 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.cpp @@ -75,7 +75,6 @@ void EscChecks::checkAndReport(const Context &context, Report &reporter) esc_status_s esc_status; - // Run motor status checks even when no new ESC data arrives (to detect timeouts) if (_esc_status_sub.copy(&esc_status)) { if (esc_status.esc_count <= 0) { @@ -257,8 +256,8 @@ uint16_t EscChecks::checkMotorStatus(const Context &context, Report &reporter, c bool current_too_low = current < (thrust * _param_motfail_c2t.get()) - _param_motfail_low_off.get(); bool current_too_high = current > (thrust * _param_motfail_c2t.get()) + _param_motfail_high_off.get(); - _esc_undercurrent_hysteresis[i].set_hysteresis_time_from(false, _param_motfail_time.get() * 1_ms); - _esc_overcurrent_hysteresis[i].set_hysteresis_time_from(false, _param_motfail_time.get() * 1_ms); + _esc_undercurrent_hysteresis[i].set_hysteresis_time_from(false, _param_motfail_time.get() * 1_s); + _esc_overcurrent_hysteresis[i].set_hysteresis_time_from(false, _param_motfail_time.get() * 1_s); if (!_esc_undercurrent_hysteresis[i].get_state()) { // Only set, never clear mid-air: stopping the motor in response could make it appear healthy again diff --git a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp index 21319282e5..3f0a950934 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/escCheck.hpp @@ -73,7 +73,7 @@ private: (ParamBool) _param_com_arm_chk_escs, (ParamBool) _param_fd_act_en, (ParamFloat) _param_motfail_c2t, - (ParamInt) _param_motfail_time, + (ParamFloat) _param_motfail_time, (ParamFloat) _param_motfail_low_off, (ParamFloat) _param_motfail_high_off); }; diff --git a/src/modules/commander/HealthAndArmingChecks/esc_check_params.c b/src/modules/commander/HealthAndArmingChecks/esc_check_params.c index 64ecb1f8cd..e30536ea8e 100644 --- a/src/modules/commander/HealthAndArmingChecks/esc_check_params.c +++ b/src/modules/commander/HealthAndArmingChecks/esc_check_params.c @@ -95,9 +95,10 @@ PARAM_DEFINE_FLOAT(MOTFAIL_HIGH_OFF, 10.f); * Motor failure only triggers after current thresholds are exceeded for this time. * * @group Motor Failure - * @unit ms - * @min 10 - * @max 10000 - * @increment 100 + * @unit s + * @min 0.01 + * @max 10 + * @decimal 2 + * @increment 1 */ -PARAM_DEFINE_INT32(MOTFAIL_TIME, 1000); +PARAM_DEFINE_FLOAT(MOTFAIL_TIME, 1.f);