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:
Andrew Tridgell
2016-12-26 16:32:33 +01:00
committed by Lorenz Meier
parent 72d8a4f932
commit d150b4b084
3 changed files with 20 additions and 3 deletions
+10 -1
View File
@@ -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 {