Browse Source

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
sbg
Beat Küng 7 years ago committed by Roman Bapst
parent
commit
0d9693347f
  1. 5
      src/drivers/px4fmu/fmu.cpp
  2. 5
      src/drivers/px4io/px4io.cpp

5
src/drivers/px4fmu/fmu.cpp

@ -1294,7 +1294,6 @@ PX4FMU::cycle() @@ -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() @@ -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() @@ -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);

5
src/drivers/px4io/px4io.cpp

@ -1226,8 +1226,9 @@ PX4IO::task_main() @@ -1226,8 +1226,9 @@ PX4IO::task_main()
parm_handle = param_find("MC_AIRMODE");
if (parm_handle != PARAM_INVALID) {
param_get(parm_handle, &param_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, &param_val_int);
(void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_AIRMODE, SIGNED_TO_REG(param_val_int));
}
}

Loading…
Cancel
Save