mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-18 23:10:35 +08:00
px4iofirmware: no override in multirotor mode
This fixes a bug where multirotors got into override mode when the FMU is dead/not responding. The main bug was that the check was for FMU_OK || MANUAL_OVERRIDE_OK in order to get further in the override checks. Also a mixer_tick was called inside the controls_tick even though these are called in px4io.c after each other anyway.
This commit is contained in:
@@ -481,14 +481,12 @@ controls_tick()
|
||||
/*
|
||||
* Check for manual override.
|
||||
*
|
||||
* The PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK flag must be set, and we
|
||||
* must have R/C input (NO FAILSAFE!).
|
||||
* Override is enabled if either the hardcoded channel / value combination
|
||||
* is selected, or the AP has requested it.
|
||||
* Firstly, manual override must be enabled, RC input available and a mixer loaded.
|
||||
*/
|
||||
if ((!(r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK) || (r_setup_arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK)) &&
|
||||
if ((r_setup_arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK) &&
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) &&
|
||||
!(r_raw_rc_flags & PX4IO_P_RAW_RC_FLAGS_FAILSAFE)) {
|
||||
!(r_raw_rc_flags & PX4IO_P_RAW_RC_FLAGS_FAILSAFE) &&
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK)) {
|
||||
|
||||
bool override = false;
|
||||
|
||||
@@ -499,29 +497,24 @@ controls_tick()
|
||||
* requested override.
|
||||
*
|
||||
*/
|
||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) && (REG_TO_SIGNED(rc_value_override) < RC_CHANNEL_LOW_THRESH)) {
|
||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) &&
|
||||
(REG_TO_SIGNED(rc_value_override) < RC_CHANNEL_LOW_THRESH)) {
|
||||
override = true;
|
||||
}
|
||||
|
||||
/*
|
||||
if the FMU is dead then enable override if we have a
|
||||
mixer and OVERRIDE_IMMEDIATE is set
|
||||
* If the FMU is dead then enable override if we have a mixer
|
||||
* and we want to immediately override (instead of using the RC channel
|
||||
* as in the case above.
|
||||
*/
|
||||
if (!(r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK) &&
|
||||
(r_setup_arming & PX4IO_P_SETUP_ARMING_OVERRIDE_IMMEDIATE) &&
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK)) {
|
||||
(r_setup_arming & PX4IO_P_SETUP_ARMING_OVERRIDE_IMMEDIATE)) {
|
||||
override = true;
|
||||
}
|
||||
|
||||
if (override) {
|
||||
|
||||
r_status_flags |= PX4IO_P_STATUS_FLAGS_OVERRIDE;
|
||||
|
||||
/* mix new RC input control values to servos */
|
||||
if (dsm_updated || sbus_updated || ppm_updated || st24_updated || sumd_updated) {
|
||||
mixer_tick();
|
||||
}
|
||||
|
||||
} else {
|
||||
r_status_flags &= ~(PX4IO_P_STATUS_FLAGS_OVERRIDE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user