mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 08:33:34 +08:00
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:
committed by
Lorenz Meier
parent
619efa7b45
commit
a0c8a78a14
@@ -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;
|
||||
|
||||
|
||||
@@ -130,6 +130,94 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV7, 0);
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_REV8, 0);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 1
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM1, 1500);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 2
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM2, 1500);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 3
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM3, 1500);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 4
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM4, 1500);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 5
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM5, 1500);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 6
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM6, 1500);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 7
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM7, 1500);
|
||||
|
||||
/**
|
||||
* Trim value for main output channel 8
|
||||
*
|
||||
* Set to neutral period in usec
|
||||
*
|
||||
* @min 1400
|
||||
* @max 1600
|
||||
* @group PWM Outputs
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PWM_MAIN_TRIM8, 1500);
|
||||
|
||||
/**
|
||||
* S.BUS out
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user