mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-18 03:50:35 +08:00
pwm systemcmd can now set the failsafe values, fmu uses failsafe values as well now, fix to only send the appropriate number of pwm values to IO at once
This commit is contained in:
@@ -199,7 +199,7 @@ uint16_t r_page_rc_input_config[PX4IO_CONTROL_CHANNELS * PX4IO_P_RC_CONFIG_STRI
|
||||
*
|
||||
* Disable pulses as default.
|
||||
*/
|
||||
uint16_t r_page_servo_failsafe[PX4IO_SERVO_COUNT] = { 0 };
|
||||
uint16_t r_page_servo_failsafe[PX4IO_SERVO_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
/**
|
||||
* PAGE 106
|
||||
@@ -276,8 +276,15 @@ 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)) {
|
||||
|
||||
/* XXX range-check value? */
|
||||
r_page_servo_failsafe[offset] = *values;
|
||||
if (*values == 0) {
|
||||
/* ignore 0 */
|
||||
} else if (*values < PWM_MIN) {
|
||||
r_page_servo_failsafe[offset] = PWM_MIN;
|
||||
} else if (*values > PWM_MAX) {
|
||||
r_page_servo_failsafe[offset] = PWM_MAX;
|
||||
} else {
|
||||
r_page_servo_failsafe[offset] = *values;
|
||||
}
|
||||
|
||||
/* flag the failsafe values as custom */
|
||||
r_setup_arming |= PX4IO_P_SETUP_ARMING_FAILSAFE_CUSTOM;
|
||||
|
||||
Reference in New Issue
Block a user