CPU resource check: use class member and fix param description

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer 2023-11-06 11:54:11 +01:00 committed by Matthias Grob
parent c054bc2370
commit fd009c8be3
3 changed files with 3 additions and 2 deletions

View File

@ -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) {

View File

@ -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<px4::params::COM_CPU_MAX>) _param_com_cpu_max
)

View File

@ -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.