From df173d4d8a0bae59f35d38feae7e72bd06ace7f1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 9 Jul 2017 19:18:11 +0200 Subject: [PATCH] Sensors: Do not update calibration when armed. Run at lower priority than attitude control and estimator This ensures that the massive (several hundred params if temperature compensation is enabled) param load is not done in flight. We also lower the priority to ensure that attitude controllers and estimators which might consume sensor data directly execute immediately, which should reduce their latency. --- src/modules/sensors/sensors.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index 2ac72126bb..07cd55ac6c 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -311,6 +311,10 @@ Sensors::~Sensors() int Sensors::parameters_update() { + if (_armed) { + return 0; + } + /* read the parameter values into _parameters */ int ret = update_parameters(_parameter_handles, _parameters); @@ -709,7 +713,7 @@ Sensors::start() /* start the task */ _sensors_task = px4_task_spawn_cmd("sensors", SCHED_DEFAULT, - SCHED_PRIORITY_MAX - 5, + SCHED_PRIORITY_MAX - 6, 2000, (px4_main_t)&Sensors::task_main_trampoline, nullptr);