diff --git a/Tools/px4params/xmlout.py b/Tools/px4params/xmlout.py index f10d5f4fd2..21ed9aa923 100644 --- a/Tools/px4params/xmlout.py +++ b/Tools/px4params/xmlout.py @@ -25,7 +25,7 @@ class XMLOutput(): xml_version = ET.SubElement(xml_parameters, "parameter_version_major") xml_version.text = "1" xml_version = ET.SubElement(xml_parameters, "parameter_version_minor") - xml_version.text = "12" + xml_version.text = "13" importtree = ET.parse(inject_xml_file_name) injectgroups = importtree.getroot().findall("group") for igroup in injectgroups: diff --git a/src/drivers/px4fmu/px4fmu_params.c b/src/drivers/px4fmu/px4fmu_params.c index 19afcd77a3..9d0b341a7a 100644 --- a/src/drivers/px4fmu/px4fmu_params.c +++ b/src/drivers/px4fmu/px4fmu_params.c @@ -111,7 +111,7 @@ PARAM_DEFINE_INT32(PWM_AUX_REV6, 0); /** * Trim value for FMU PWM output channel 1 * - * Set to neutral period in usec + * Set to normalized offset * * @min -0.2 * @max 0.2 @@ -123,7 +123,7 @@ PARAM_DEFINE_FLOAT(PWM_AUX_TRIM1, 0); /** * Trim value for FMU PWM output channel 2 * - * Set to neutral period in usec + * Set to normalized offset * * @min -0.2 * @max 0.2 @@ -135,7 +135,7 @@ PARAM_DEFINE_FLOAT(PWM_AUX_TRIM2, 0); /** * Trim value for FMU PWM output channel 3 * - * Set to neutral period in usec + * Set to normalized offset * * @min -0.2 * @max 0.2 @@ -147,7 +147,7 @@ PARAM_DEFINE_FLOAT(PWM_AUX_TRIM3, 0); /** * Trim value for FMU PWM output channel 4 * - * Set to neutral period in usec + * Set to normalized offset * * @min -0.2 * @max 0.2 @@ -159,7 +159,7 @@ PARAM_DEFINE_FLOAT(PWM_AUX_TRIM4, 0); /** * Trim value for FMU PWM output channel 5 * - * Set to neutral period in usec + * Set to normalized offset * * @min -0.2 * @max 0.2 @@ -171,7 +171,7 @@ PARAM_DEFINE_FLOAT(PWM_AUX_TRIM5, 0); /** * Trim value for FMU PWM output channel 6 * - * Set to neutral period in usec + * Set to normalized offset * * @min -0.2 * @max 0.2 diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index c1cba71300..93bead77e8 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1207,12 +1207,12 @@ PX4IO::task_main() // 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); +// 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; + float pval; /* fetch the trim values from parameters */ sprintf(pname, "PWM_MAIN_TRIM%u", i + 1); @@ -1220,8 +1220,8 @@ PX4IO::task_main() if (param_h != PARAM_INVALID) { - param_get(param_h, &ival); - pwm_values.values[i] = ival; + param_get(param_h, &pval); + pwm_values.values[i] = (int16_t)(10000 * pval); } } diff --git a/src/drivers/px4io/px4io_params.c b/src/drivers/px4io/px4io_params.c index 85f16c0a2a..0f2a6fbb1c 100644 --- a/src/drivers/px4io/px4io_params.c +++ b/src/drivers/px4io/px4io_params.c @@ -133,90 +133,98 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV8, 0); /** * Trim value for main output channel 1 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM1, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM1, 0); /** * Trim value for main output channel 2 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM2, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM2, 0); /** * Trim value for main output channel 3 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM3, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM3, 0); /** * Trim value for main output channel 4 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM4, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM4, 0); /** * Trim value for main output channel 5 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM5, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM5, 0); /** * Trim value for main output channel 6 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM6, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM6, 0); /** * Trim value for main output channel 7 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM7, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM7, 0); /** * Trim value for main output channel 8 * - * Set to neutral period in usec + * Set to normalized offset * - * @min 1400 - * @max 1600 + * @min -0.2 + * @max 0.2 + * @decimal 2 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_TRIM8, 1500); +PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM8, 0); /** * S.BUS out diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 22029b91f8..f535bfa7e8 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -399,19 +399,19 @@ registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num /* copy channel data */ while ((offset < PX4IO_SERVO_COUNT) && (num_values > 0)) { - if (*values == 0) { - /* allow 0 - turns the trim option off */ - r_page_servo_control_trim[offset] = 0; - - } else if (*values > PWM_HIGHEST_MAX) { - r_page_servo_control_trim[offset] = PWM_HIGHEST_MAX; - - } else if (*values < PWM_LOWEST_MAX) { - r_page_servo_control_trim[offset] = PWM_LOWEST_MAX; - - } else { - r_page_servo_control_trim[offset] = *values; - } +// if (*values == 0) { +// /* allow 0 - turns the trim option off */ +// r_page_servo_control_trim[offset] = 0; +// +// } else if (*values > PWM_HIGHEST_MAX) { +// r_page_servo_control_trim[offset] = PWM_HIGHEST_MAX; +// +// } else if (*values < PWM_LOWEST_MAX) { +// r_page_servo_control_trim[offset] = PWM_LOWEST_MAX; +// +// } else { + r_page_servo_control_trim[offset] = *values; +// } offset++; num_values--;