use trim values to set mixer:scaler.offset

clamp mixer output offset to [-.2,.2] ([-2000, 2000] in mixer file)

add 8 main PWM trim parameters

add long desc to parameters and bump minor parameter version
This commit is contained in:
Mark Whitehorn
2016-12-10 12:56:39 +01:00
committed by Lorenz Meier
parent 619efa7b45
commit a0c8a78a14
8 changed files with 181 additions and 9 deletions
+24
View File
@@ -1204,6 +1204,30 @@ PX4IO::task_main()
(void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_REVERSE, pwm_invert_mask);
// update trim values
struct pwm_output_values pwm_values;
memset(&pwm_values, 0, sizeof(pwm_values));
ret = io_reg_get(PX4IO_PAGE_CONTROL_TRIM_PWM, 0, (uint16_t *)pwm_values.values, _max_actuators);
for (unsigned i = 0; i < _max_actuators; i++) {
char pname[16];
int32_t ival;
/* fetch the trim values from parameters */
sprintf(pname, "PWM_MAIN_TRIM%u", i + 1);
param_t param_h = param_find(pname);
if (param_h != PARAM_INVALID) {
param_get(param_h, &ival);
pwm_values.values[i] = ival;
}
}
/* copy values to registers in IO */
ret = io_reg_set(PX4IO_PAGE_CONTROL_TRIM_PWM, 0, pwm_values.values, _max_actuators);
float param_val;
param_t parm_handle;