mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 16:25:26 +03:00
Fix fixed-wing auto-arming
This commit is contained in:
parent
6821ada395
commit
0246dd7c31
1 changed files with 32 additions and 21 deletions
|
@ -173,37 +173,48 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
|
|||
rcDelayCommand++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
rcDelayCommand = 0;
|
||||
}
|
||||
|
||||
rcSticks = stTmp;
|
||||
|
||||
// perform actions
|
||||
bool armingSwitchIsActive = IS_RC_MODE_ACTIVE(BOXARM);
|
||||
emergencyArmingUpdate(armingSwitchIsActive);
|
||||
if (armingSwitchIsActive) {
|
||||
rcDisarmTimeMs = currentTimeMs;
|
||||
tryArm();
|
||||
} else {
|
||||
// Disarming via ARM BOX
|
||||
// Don't disarm via switch if failsafe is active or receiver doesn't receive data - we can't trust receiver
|
||||
// and can't afford to risk disarming in the air
|
||||
if (ARMING_FLAG(ARMED) && !IS_RC_MODE_ACTIVE(BOXFAILSAFE) && rxIsReceivingSignal() && !failsafeIsActive()) {
|
||||
const timeMs_t disarmDelay = currentTimeMs - rcDisarmTimeMs;
|
||||
if (disarmDelay > armingConfig()->switchDisarmDelayMs) {
|
||||
if (armingConfig()->disarm_kill_switch || (throttleStatus == THROTTLE_LOW)) {
|
||||
disarm(DISARM_SWITCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
rcDisarmTimeMs = currentTimeMs;
|
||||
|
||||
if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && armingConfig()->fixed_wing_auto_arm) {
|
||||
// Auto arm on throttle when using fixedwing and motorstop
|
||||
if (throttleStatus != THROTTLE_LOW) {
|
||||
tryArm();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (armingSwitchIsActive) {
|
||||
rcDisarmTimeMs = currentTimeMs;
|
||||
tryArm();
|
||||
} else {
|
||||
// Disarming via ARM BOX
|
||||
// Don't disarm via switch if failsafe is active or receiver doesn't receive data - we can't trust receiver
|
||||
// and can't afford to risk disarming in the air
|
||||
if (ARMING_FLAG(ARMED) && !IS_RC_MODE_ACTIVE(BOXFAILSAFE) && rxIsReceivingSignal() && !failsafeIsActive()) {
|
||||
const timeMs_t disarmDelay = currentTimeMs - rcDisarmTimeMs;
|
||||
if (disarmDelay > armingConfig()->switchDisarmDelayMs) {
|
||||
if (armingConfig()->disarm_kill_switch || (throttleStatus == THROTTLE_LOW)) {
|
||||
disarm(DISARM_SWITCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
rcDisarmTimeMs = currentTimeMs;
|
||||
}
|
||||
}
|
||||
|
||||
// KILLSWITCH disarms instantly
|
||||
if (IS_RC_MODE_ACTIVE(BOXKILLSWITCH)) {
|
||||
disarm(DISARM_KILLSWITCH);
|
||||
// KILLSWITCH disarms instantly
|
||||
if (IS_RC_MODE_ACTIVE(BOXKILLSWITCH)) {
|
||||
disarm(DISARM_KILLSWITCH);
|
||||
}
|
||||
}
|
||||
|
||||
if (rcDelayCommand != 20) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue