mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 05:23:34 +08:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user