Skip to content

Commit 8dbb7e7

Browse files
authored
Merge pull request #4640 from iNavFlight/dzikuvx-remove-sticks-arming
Remove sticks arming
2 parents 5754cf7 + cf431d7 commit 8dbb7e7

File tree

6 files changed

+21
-88
lines changed

6 files changed

+21
-88
lines changed

src/main/fc/fc_core.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,11 @@ static void updateArmingStatus(void)
250250
}
251251

252252
/* CHECK: Arming switch */
253-
if (!isUsingSticksForArming()) {
254-
// If arming is disabled and the ARM switch is on
255-
if (isArmingDisabled() && IS_RC_MODE_ACTIVE(BOXARM)) {
256-
ENABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
257-
} else if (!IS_RC_MODE_ACTIVE(BOXARM)) {
258-
DISABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
259-
}
253+
// If arming is disabled and the ARM switch is on
254+
if (isArmingDisabled() && IS_RC_MODE_ACTIVE(BOXARM)) {
255+
ENABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
256+
} else if (!IS_RC_MODE_ACTIVE(BOXARM)) {
257+
DISABLE_ARMING_FLAG(ARMING_DISABLED_ARM_SWITCH);
260258
}
261259

262260
/* CHECK: BOXFAILSAFE */
@@ -655,17 +653,6 @@ void taskMainPidLoop(timeUs_t currentTimeUs)
655653
applyWaypointNavigationAndAltitudeHold();
656654
#endif
657655

658-
// If we're armed, at minimum throttle, and we do arming via the
659-
// sticks, do not process yaw input from the rx. We do this so the
660-
// motors do not spin up while we are trying to arm or disarm.
661-
// Allow yaw control for tricopters if the user wants the servo to move even when unarmed.
662-
if (isUsingSticksForArming() && rxGetChannelValue(THROTTLE) <= rxConfig()->mincheck
663-
&& !((mixerConfig()->platformType == PLATFORM_TRICOPTER) && servoConfig()->tri_unarmed_servo)
664-
&& mixerConfig()->platformType != PLATFORM_AIRPLANE
665-
) {
666-
rcCommand[YAW] = 0;
667-
}
668-
669656
// Apply throttle tilt compensation
670657
if (!STATE(FIXED_WING)) {
671658
int16_t thrTiltCompStrength = 0;

src/main/fc/rc_controls.c

Lines changed: 15 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -177,25 +177,23 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
177177
rcSticks = stTmp;
178178

179179
// perform actions
180-
if (!isUsingSticksForArming()) {
181-
if (IS_RC_MODE_ACTIVE(BOXARM)) {
182-
rcDisarmTimeMs = currentTimeMs;
183-
tryArm();
184-
} else {
185-
// Disarming via ARM BOX
186-
// Don't disarm via switch if failsafe is active or receiver doesn't receive data - we can't trust receiver
187-
// and can't afford to risk disarming in the air
188-
if (ARMING_FLAG(ARMED) && !IS_RC_MODE_ACTIVE(BOXFAILSAFE) && rxIsReceivingSignal() && !failsafeIsActive()) {
189-
const timeMs_t disarmDelay = currentTimeMs - rcDisarmTimeMs;
190-
if (disarmDelay > armingConfig()->switchDisarmDelayMs) {
191-
if (armingConfig()->disarm_kill_switch || (throttleStatus == THROTTLE_LOW)) {
192-
disarm(DISARM_SWITCH);
193-
}
180+
if (IS_RC_MODE_ACTIVE(BOXARM)) {
181+
rcDisarmTimeMs = currentTimeMs;
182+
tryArm();
183+
} else {
184+
// Disarming via ARM BOX
185+
// Don't disarm via switch if failsafe is active or receiver doesn't receive data - we can't trust receiver
186+
// and can't afford to risk disarming in the air
187+
if (ARMING_FLAG(ARMED) && !IS_RC_MODE_ACTIVE(BOXFAILSAFE) && rxIsReceivingSignal() && !failsafeIsActive()) {
188+
const timeMs_t disarmDelay = currentTimeMs - rcDisarmTimeMs;
189+
if (disarmDelay > armingConfig()->switchDisarmDelayMs) {
190+
if (armingConfig()->disarm_kill_switch || (throttleStatus == THROTTLE_LOW)) {
191+
disarm(DISARM_SWITCH);
194192
}
195193
}
196-
else {
197-
rcDisarmTimeMs = currentTimeMs;
198-
}
194+
}
195+
else {
196+
rcDisarmTimeMs = currentTimeMs;
199197
}
200198
}
201199

@@ -208,23 +206,6 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
208206
return;
209207
}
210208

211-
if (isUsingSticksForArming()) {
212-
// Disarm on throttle down + yaw
213-
if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_CE) {
214-
// Dont disarm if fixedwing and motorstop
215-
if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && armingConfig()->fixed_wing_auto_arm) {
216-
return;
217-
}
218-
else if (ARMING_FLAG(ARMED)) {
219-
disarm(DISARM_STICKS);
220-
}
221-
else {
222-
beeper(BEEPER_DISARM_REPEAT); // sound tone while stick held
223-
rcDelayCommand = 0; // reset so disarm tone will repeat
224-
}
225-
}
226-
}
227-
228209
if (ARMING_FLAG(ARMED)) {
229210
// actions during armed
230211
return;
@@ -294,40 +275,18 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
294275
saveConfigAndNotify();
295276
}
296277

297-
298-
// Arming by sticks
299-
if (isUsingSticksForArming()) {
300-
if (STATE(FIXED_WING) && feature(FEATURE_MOTOR_STOP) && armingConfig()->fixed_wing_auto_arm) {
301-
// Auto arm on throttle when using fixedwing and motorstop
302-
if (throttleStatus != THROTTLE_LOW) {
303-
tryArm();
304-
return;
305-
}
306-
}
307-
else {
308-
if (rcSticks == THR_LO + YAW_HI + PIT_CE + ROL_CE) {
309-
// Arm via YAW
310-
tryArm();
311-
return;
312-
}
313-
}
314-
}
315-
316-
317278
// Calibrating Acc
318279
if (rcSticks == THR_HI + YAW_LO + PIT_LO + ROL_CE) {
319280
accStartCalibration();
320281
return;
321282
}
322283

323-
324284
// Calibrating Mag
325285
if (rcSticks == THR_HI + YAW_HI + PIT_LO + ROL_CE) {
326286
ENABLE_STATE(CALIBRATE_MAG);
327287
return;
328288
}
329289

330-
331290
// Accelerometer Trim
332291
if (rcSticks == THR_HI + YAW_CE + PIT_HI + ROL_CE) {
333292
applyAndSaveBoardAlignmentDelta(0, -2);

src/main/fc/rc_modes.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "rx/rx.h"
3636

3737
static uint8_t specifiedConditionCountPerMode[CHECKBOX_ITEM_COUNT];
38-
static bool isUsingSticksToArm = true;
3938
#ifdef USE_NAV
4039
static bool isUsingNAVModes = false;
4140
#endif
@@ -54,11 +53,6 @@ boxBitmask_t rcModeActivationMask; // one bit per mode defined in boxId_e
5453
PG_REGISTER_ARRAY(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions, PG_MODE_ACTIVATION_PROFILE, 0);
5554
PG_REGISTER(modeActivationOperatorConfig_t, modeActivationOperatorConfig, PG_MODE_ACTIVATION_OPERATOR_CONFIG, 0);
5655

57-
bool isUsingSticksForArming(void)
58-
{
59-
return isUsingSticksToArm;
60-
}
61-
6256
bool isAirmodeActive(void)
6357
{
6458
return feature(FEATURE_AIRMODE) || IS_RC_MODE_ACTIVE(BOXAIRMODE);
@@ -159,8 +153,6 @@ void updateUsedModeActivationConditionFlags(void)
159153
}
160154
}
161155

162-
isUsingSticksToArm = !isModeActivationConditionPresent(BOXARM);
163-
164156
#ifdef USE_NAV
165157
isUsingNAVModes = isModeActivationConditionPresent(BOXNAVPOSHOLD) ||
166158
isModeActivationConditionPresent(BOXNAVRTH) ||

src/main/fc/rc_modes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ void rcModeUpdate(boxBitmask_t *newState);
120120

121121
bool isModeActivationConditionPresent(boxId_e modeId);
122122

123-
bool isUsingSticksForArming(void);
124123
bool isAirmodeActive(void);
125124
bool isUsingNavigationModes(void);
126125
bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range);

src/main/flight/failsafe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ void failsafeUpdateState(void)
513513
if (receivingRxDataAndNotFailsafeMode) {
514514
if (millis() > failsafeState.receivingRxDataPeriod) {
515515
// rx link is good now, when arming via ARM switch, it must be OFF first
516-
if (!(!isUsingSticksForArming() && IS_RC_MODE_ACTIVE(BOXARM))) {
516+
if (!IS_RC_MODE_ACTIVE(BOXARM)) {
517517
// XXX: Requirements for removing the ARMING_DISABLED_FAILSAFE_SYSTEM flag
518518
// are tested by osd.c to show the user how to re-arm. If these
519519
// requirements change, update osdArmingDisabledReasonMessage().

src/main/io/osd.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,10 +600,6 @@ static const char * osdArmingDisabledReasonMessage(void)
600600
// See handling of FAILSAFE_RX_LOSS_MONITORING in failsafe.c
601601
if (failsafePhase() == FAILSAFE_RX_LOSS_MONITORING) {
602602
if (failsafeIsReceivingRxData()) {
603-
if (isUsingSticksForArming()) {
604-
// Need to power-cycle
605-
return OSD_MESSAGE_STR("POWER CYCLE TO ARM");
606-
}
607603
// If we're not using sticks, it means the ARM switch
608604
// hasn't been off since entering FAILSAFE_RX_LOSS_MONITORING
609605
// yet

0 commit comments

Comments
 (0)