mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +03:00
Remove sticks arming
This commit is contained in:
parent
5754cf7d61
commit
6ea467bd4c
6 changed files with 21 additions and 85 deletions
|
@ -250,13 +250,11 @@ static void updateArmingStatus(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CHECK: Arming switch */
|
/* CHECK: Arming switch */
|
||||||
if (!isUsingSticksForArming()) {
|
// If arming is disabled and the ARM switch is on
|
||||||
// If arming is disabled and the ARM switch is on
|
if (isArmingDisabled() && IS_RC_MODE_ACTIVE(BOXARM)) {
|
||||||
if (isArmingDisabled() && IS_RC_MODE_ACTIVE(BOXARM)) {
|
ENABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
|
||||||
ENABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
|
} else if (!IS_RC_MODE_ACTIVE(BOXARM)) {
|
||||||
} else if (!IS_RC_MODE_ACTIVE(BOXARM)) {
|
DISABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
|
||||||
DISABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CHECK: BOXFAILSAFE */
|
/* CHECK: BOXFAILSAFE */
|
||||||
|
@ -655,17 +653,6 @@ void taskMainPidLoop(timeUs_t currentTimeUs)
|
||||||
applyWaypointNavigationAndAltitudeHold();
|
applyWaypointNavigationAndAltitudeHold();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If we're armed, at minimum throttle, and we do arming via the
|
|
||||||
// sticks, do not process yaw input from the rx. We do this so the
|
|
||||||
// motors do not spin up while we are trying to arm or disarm.
|
|
||||||
// Allow yaw control for tricopters if the user wants the servo to move even when unarmed.
|
|
||||||
if (isUsingSticksForArming() && rxGetChannelValue(THROTTLE) <= rxConfig()->mincheck
|
|
||||||
&& !((mixerConfig()->platformType == PLATFORM_TRICOPTER) && servoConfig()->tri_unarmed_servo)
|
|
||||||
&& mixerConfig()->platformType != PLATFORM_AIRPLANE
|
|
||||||
) {
|
|
||||||
rcCommand[YAW] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply throttle tilt compensation
|
// Apply throttle tilt compensation
|
||||||
if (!STATE(FIXED_WING)) {
|
if (!STATE(FIXED_WING)) {
|
||||||
int16_t thrTiltCompStrength = 0;
|
int16_t thrTiltCompStrength = 0;
|
||||||
|
|
|
@ -177,25 +177,23 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
|
||||||
rcSticks = stTmp;
|
rcSticks = stTmp;
|
||||||
|
|
||||||
// perform actions
|
// perform actions
|
||||||
if (!isUsingSticksForArming()) {
|
if (IS_RC_MODE_ACTIVE(BOXARM)) {
|
||||||
if (IS_RC_MODE_ACTIVE(BOXARM)) {
|
rcDisarmTimeMs = currentTimeMs;
|
||||||
rcDisarmTimeMs = currentTimeMs;
|
tryArm();
|
||||||
tryArm();
|
} else {
|
||||||
} else {
|
// Disarming via ARM BOX
|
||||||
// Disarming via ARM BOX
|
// Don't disarm via switch if failsafe is active or receiver doesn't receive data - we can't trust receiver
|
||||||
// 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
|
||||||
// and can't afford to risk disarming in the air
|
if (ARMING_FLAG(ARMED) && !IS_RC_MODE_ACTIVE(BOXFAILSAFE) && rxIsReceivingSignal() && !failsafeIsActive()) {
|
||||||
if (ARMING_FLAG(ARMED) && !IS_RC_MODE_ACTIVE(BOXFAILSAFE) && rxIsReceivingSignal() && !failsafeIsActive()) {
|
const timeMs_t disarmDelay = currentTimeMs - rcDisarmTimeMs;
|
||||||
const timeMs_t disarmDelay = currentTimeMs - rcDisarmTimeMs;
|
if (disarmDelay > armingConfig()->switchDisarmDelayMs) {
|
||||||
if (disarmDelay > armingConfig()->switchDisarmDelayMs) {
|
if (armingConfig()->disarm_kill_switch || (throttleStatus == THROTTLE_LOW)) {
|
||||||
if (armingConfig()->disarm_kill_switch || (throttleStatus == THROTTLE_LOW)) {
|
disarm(DISARM_SWITCH);
|
||||||
disarm(DISARM_SWITCH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
rcDisarmTimeMs = currentTimeMs;
|
else {
|
||||||
}
|
rcDisarmTimeMs = currentTimeMs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,23 +206,6 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUsingSticksForArming()) {
|
|
||||||
// Disarm on throttle down + yaw
|
|
||||||
if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_CE) {
|
|
||||||
// Dont disarm if fixedwing and motorstop
|
|
||||||
if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && armingConfig()->fixed_wing_auto_arm) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (ARMING_FLAG(ARMED)) {
|
|
||||||
disarm(DISARM_STICKS);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
beeper(BEEPER_DISARM_REPEAT); // sound tone while stick held
|
|
||||||
rcDelayCommand = 0; // reset so disarm tone will repeat
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ARMING_FLAG(ARMED)) {
|
if (ARMING_FLAG(ARMED)) {
|
||||||
// actions during armed
|
// actions during armed
|
||||||
return;
|
return;
|
||||||
|
@ -294,40 +275,18 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
|
||||||
saveConfigAndNotify();
|
saveConfigAndNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Arming by sticks
|
|
||||||
if (isUsingSticksForArming()) {
|
|
||||||
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 (rcSticks == THR_LO + YAW_HI + PIT_CE + ROL_CE) {
|
|
||||||
// Arm via YAW
|
|
||||||
tryArm();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Calibrating Acc
|
// Calibrating Acc
|
||||||
if (rcSticks == THR_HI + YAW_LO + PIT_LO + ROL_CE) {
|
if (rcSticks == THR_HI + YAW_LO + PIT_LO + ROL_CE) {
|
||||||
accStartCalibration();
|
accStartCalibration();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calibrating Mag
|
// Calibrating Mag
|
||||||
if (rcSticks == THR_HI + YAW_HI + PIT_LO + ROL_CE) {
|
if (rcSticks == THR_HI + YAW_HI + PIT_LO + ROL_CE) {
|
||||||
ENABLE_STATE(CALIBRATE_MAG);
|
ENABLE_STATE(CALIBRATE_MAG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Accelerometer Trim
|
// Accelerometer Trim
|
||||||
if (rcSticks == THR_HI + YAW_CE + PIT_HI + ROL_CE) {
|
if (rcSticks == THR_HI + YAW_CE + PIT_HI + ROL_CE) {
|
||||||
applyAndSaveBoardAlignmentDelta(0, -2);
|
applyAndSaveBoardAlignmentDelta(0, -2);
|
||||||
|
|
|
@ -54,11 +54,6 @@ boxBitmask_t rcModeActivationMask; // one bit per mode defined in boxId_e
|
||||||
PG_REGISTER_ARRAY(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions, PG_MODE_ACTIVATION_PROFILE, 0);
|
PG_REGISTER_ARRAY(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions, PG_MODE_ACTIVATION_PROFILE, 0);
|
||||||
PG_REGISTER(modeActivationOperatorConfig_t, modeActivationOperatorConfig, PG_MODE_ACTIVATION_OPERATOR_CONFIG, 0);
|
PG_REGISTER(modeActivationOperatorConfig_t, modeActivationOperatorConfig, PG_MODE_ACTIVATION_OPERATOR_CONFIG, 0);
|
||||||
|
|
||||||
bool isUsingSticksForArming(void)
|
|
||||||
{
|
|
||||||
return isUsingSticksToArm;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isAirmodeActive(void)
|
bool isAirmodeActive(void)
|
||||||
{
|
{
|
||||||
return feature(FEATURE_AIRMODE) || IS_RC_MODE_ACTIVE(BOXAIRMODE);
|
return feature(FEATURE_AIRMODE) || IS_RC_MODE_ACTIVE(BOXAIRMODE);
|
||||||
|
|
|
@ -120,7 +120,6 @@ void rcModeUpdate(boxBitmask_t *newState);
|
||||||
|
|
||||||
bool isModeActivationConditionPresent(boxId_e modeId);
|
bool isModeActivationConditionPresent(boxId_e modeId);
|
||||||
|
|
||||||
bool isUsingSticksForArming(void);
|
|
||||||
bool isAirmodeActive(void);
|
bool isAirmodeActive(void);
|
||||||
bool isUsingNavigationModes(void);
|
bool isUsingNavigationModes(void);
|
||||||
bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range);
|
bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range);
|
||||||
|
|
|
@ -513,7 +513,7 @@ void failsafeUpdateState(void)
|
||||||
if (receivingRxDataAndNotFailsafeMode) {
|
if (receivingRxDataAndNotFailsafeMode) {
|
||||||
if (millis() > failsafeState.receivingRxDataPeriod) {
|
if (millis() > failsafeState.receivingRxDataPeriod) {
|
||||||
// rx link is good now, when arming via ARM switch, it must be OFF first
|
// rx link is good now, when arming via ARM switch, it must be OFF first
|
||||||
if (!(!isUsingSticksForArming() && IS_RC_MODE_ACTIVE(BOXARM))) {
|
if (!IS_RC_MODE_ACTIVE(BOXARM)) {
|
||||||
// XXX: Requirements for removing the ARMING_DISABLED_FAILSAFE_SYSTEM flag
|
// XXX: Requirements for removing the ARMING_DISABLED_FAILSAFE_SYSTEM flag
|
||||||
// are tested by osd.c to show the user how to re-arm. If these
|
// are tested by osd.c to show the user how to re-arm. If these
|
||||||
// requirements change, update osdArmingDisabledReasonMessage().
|
// requirements change, update osdArmingDisabledReasonMessage().
|
||||||
|
|
|
@ -600,10 +600,6 @@ static const char * osdArmingDisabledReasonMessage(void)
|
||||||
// See handling of FAILSAFE_RX_LOSS_MONITORING in failsafe.c
|
// See handling of FAILSAFE_RX_LOSS_MONITORING in failsafe.c
|
||||||
if (failsafePhase() == FAILSAFE_RX_LOSS_MONITORING) {
|
if (failsafePhase() == FAILSAFE_RX_LOSS_MONITORING) {
|
||||||
if (failsafeIsReceivingRxData()) {
|
if (failsafeIsReceivingRxData()) {
|
||||||
if (isUsingSticksForArming()) {
|
|
||||||
// Need to power-cycle
|
|
||||||
return OSD_MESSAGE_STR("POWER CYCLE TO ARM");
|
|
||||||
}
|
|
||||||
// If we're not using sticks, it means the ARM switch
|
// If we're not using sticks, it means the ARM switch
|
||||||
// hasn't been off since entering FAILSAFE_RX_LOSS_MONITORING
|
// hasn't been off since entering FAILSAFE_RX_LOSS_MONITORING
|
||||||
// yet
|
// yet
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue