From 0d9693347fff77223613b7b319473ccc25d6d921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= <beat-kueng@gmx.net> Date: Thu, 15 Feb 2018 21:31:23 +0100 Subject: [PATCH] fmu + px4io: fixes for MC_AIRMODE parameter - fmu: in case of _mot_t_max==0 _airmode was not set in the mixer - px4io: param_val is a float --- src/drivers/px4fmu/fmu.cpp | 5 +++-- src/drivers/px4io/px4io.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index e3a55852a8..4c2ac5ddde 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -1294,7 +1294,6 @@ PX4FMU::cycle() // factor 2 is needed because actuator outputs are in the range [-1,1] const float delta_out_max = 2.0f * 1000.0f * dt / (_max_pwm[0] - _min_pwm[0]) / _mot_t_max; _mixers->set_max_delta_out_once(delta_out_max); - _mixers->set_airmode(_airmode); } if (_thr_mdl_fac > FLT_EPSILON) { @@ -1363,6 +1362,8 @@ PX4FMU::cycle() ORB_PRIO_DEFAULT); } + _mixers->set_airmode(_airmode); + perf_end(_ctl_latency); } } @@ -1791,7 +1792,7 @@ void PX4FMU::update_params() param_handle = param_find("MC_AIRMODE"); if (param_handle != PARAM_INVALID) { - int val; + int32_t val; param_get(param_handle, &val); _airmode = val > 0; PX4_DEBUG("%s: %d", "MC_AIRMODE", _airmode); diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 3b83580909..164d798c2d 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1226,8 +1226,9 @@ PX4IO::task_main() parm_handle = param_find("MC_AIRMODE"); if (parm_handle != PARAM_INVALID) { - param_get(parm_handle, ¶m_val); - (void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_AIRMODE, SIGNED_TO_REG(param_val)); + int32_t param_val_int; + param_get(parm_handle, ¶m_val_int); + (void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_AIRMODE, SIGNED_TO_REG(param_val_int)); } } -- GitLab