mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
px4iofirmware: fixed a bug with override handling
this fixes a race condition between the DMA completion handler updating registers in px4io and the mixer used for handling the override state. The register set code could set r_page_servos[] between the time when pwm_limit_calc() is called and the servos are actually output.
This commit is contained in:
parent
72d8a4f932
commit
d150b4b084
@ -143,7 +143,16 @@ mixer_tick(void)
|
||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_RAW_PWM) &&
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK)) {
|
||||
|
||||
source = MIX_NONE;
|
||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_OVERRIDE) > 0) {
|
||||
/* a channel based override has been
|
||||
* triggered, with FMU active */
|
||||
source = MIX_OVERRIDE_FMU_OK;
|
||||
|
||||
} else {
|
||||
/* don't actually mix anything - copy values from r_page_direct_pwm */
|
||||
source = MIX_NONE;
|
||||
memcpy(r_page_servos, r_page_direct_pwm, sizeof(uint16_t)*PX4IO_SERVO_COUNT);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@
|
||||
extern volatile uint16_t r_page_status[]; /* PX4IO_PAGE_STATUS */
|
||||
extern uint16_t r_page_actuators[]; /* PX4IO_PAGE_ACTUATORS */
|
||||
extern uint16_t r_page_servos[]; /* PX4IO_PAGE_SERVOS */
|
||||
extern uint16_t r_page_direct_pwm[]; /* PX4IO_PAGE_DIRECT_PWM */
|
||||
extern uint16_t r_page_raw_rc_input[]; /* PX4IO_PAGE_RAW_RC_INPUT */
|
||||
extern uint16_t r_page_rc_input[]; /* PX4IO_PAGE_RC_INPUT */
|
||||
extern uint16_t r_page_adc[]; /* PX4IO_PAGE_RAW_ADC_INPUT */
|
||||
|
||||
@ -143,6 +143,13 @@ uint16_t r_page_rc_input[] = {
|
||||
*/
|
||||
uint16_t r_page_scratch[32];
|
||||
|
||||
/**
|
||||
* PAGE 8
|
||||
*
|
||||
* RAW PWM values
|
||||
*/
|
||||
uint16_t r_page_direct_pwm[PX4IO_SERVO_COUNT];
|
||||
|
||||
/**
|
||||
* PAGE 100
|
||||
*
|
||||
@ -307,7 +314,7 @@ registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num
|
||||
|
||||
/* XXX range-check value? */
|
||||
if (*values != PWM_IGNORE_THIS_CHANNEL) {
|
||||
r_page_servos[offset] = *values;
|
||||
r_page_direct_pwm[offset] = *values;
|
||||
}
|
||||
|
||||
offset++;
|
||||
@ -1011,7 +1018,7 @@ registers_get(uint8_t page, uint8_t offset, uint16_t **values, unsigned *num_val
|
||||
break;
|
||||
|
||||
case PX4IO_PAGE_DIRECT_PWM:
|
||||
SELECT_PAGE(r_page_servos);
|
||||
SELECT_PAGE(r_page_direct_pwm);
|
||||
break;
|
||||
|
||||
case PX4IO_PAGE_FAILSAFE_PWM:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user