From fd009c8be36a6bf2ec0d06eb753e1431e5d92cf9 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Mon, 6 Nov 2023 11:54:11 +0100 Subject: [PATCH] CPU resource check: use class member and fix param description Signed-off-by: Silvan Fuhrer --- .../commander/HealthAndArmingChecks/checks/cpuResourceCheck.cpp | 2 -- .../commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp | 2 ++ src/modules/commander/commander_params.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.cpp index 6a142ba73b..51df7df324 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.cpp @@ -41,8 +41,6 @@ void CpuResourceChecks::checkAndReport(const Context &context, Report &reporter) return; } - static hrt_abstime high_cpu_load_start_time_us_ = 0; - cpuload_s cpuload; if (!_cpuload_sub.copy(&cpuload) || hrt_elapsed_time(&cpuload.timestamp) > 2_s) { diff --git a/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp b/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp index c2582d171f..22f0007015 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp @@ -49,6 +49,8 @@ public: private: uORB::Subscription _cpuload_sub{ORB_ID(cpuload)}; + hrt_abstime high_cpu_load_start_time_us_{0}; + DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase, (ParamFloat) _param_com_cpu_max ) diff --git a/src/modules/commander/commander_params.c b/src/modules/commander/commander_params.c index b84fdeff6b..121fa14236 100644 --- a/src/modules/commander/commander_params.c +++ b/src/modules/commander/commander_params.c @@ -920,6 +920,7 @@ PARAM_DEFINE_FLOAT(COM_KILL_DISARM, 5.0f); /** * Maximum allowed CPU load to still arm. + * * The check fails if the CPU load is above this threshold for 2s. * * A negative value disables the check.