diff --git a/docs/Cli.md b/docs/Cli.md index 9b483e55400..a6533162fb7 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -117,7 +117,6 @@ After restoring it's always a good idea to `dump` or `diff` the settings once ag | motor_pwm_protocol | STANDARD | Protocol that is used to send motor updates to ESCs. Possible values - STANDARD, ONESHOT125, ONESHOT42, MULTISHOT, DSHOT150, DSHOT300, DSHOT600, DSHOT1200, BRUSHED | | fixed_wing_auto_arm | OFF | Auto-arm fixed wing aircraft on throttle above min_throttle, and disarming with stick commands are disabled, so power cycle is required to disarm. Requires enabled motorstop and no arm switch configured. | | disarm_kill_switch | ON | Disarms the motors independently of throttle value. Setting to OFF reverts to the old behaviour of disarming only when the throttle is low. Only applies when arming and disarming with an AUX channel. | -| auto_disarm_delay | 5 | Delay before automatic disarming when using stick arming and MOTOR_STOP. This does not apply when using FIXED_WING | | switch_disarm_delay | 250 | Delay before disarming when requested by switch (ms) [0-1000] | | small_angle | 25 | If the aircraft tilt angle exceed this value the copter will refuse to arm. | | reboot_character | 82 | Special character used to trigger reboot | diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 2a5905f8bb6..bb91c209942 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -305,6 +305,16 @@ void validateAndFixConfig(void) gyroConfigMutable()->gyroSync = false; #endif + /* + * MOTOR_STOP is no longer allowed on Multirotors and Tricopters + */ + if ( + feature(FEATURE_MOTOR_STOP) && + (mixerConfig()->platformType == PLATFORM_MULTIROTOR || mixerConfig()->platformType == PLATFORM_TRICOPTER) + ) { + featureClear(FEATURE_MOTOR_STOP); + } + // Call target-specific validation function validateAndFixTargetConfig(); diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index 97359ea6d38..ed0d9c6e386 100755 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -106,8 +106,6 @@ int16_t headFreeModeHold; uint8_t motorControlEnable = false; -static uint32_t disarmAt; // Time of automatic disarm when "Don't spin the motors when armed" is enabled and auto_disarm_delay is nonzero - static bool isRXDataNew; static disarmReason_t lastDisarmReason = DISARM_NONE; @@ -395,7 +393,6 @@ void tryArm(void) blackboxStart(); } #endif - disarmAt = millis() + armingConfig()->auto_disarm_delay * 1000; // start disarm timeout, will be extended when throttle is nonzero //beep to indicate arming #ifdef USE_NAV @@ -418,8 +415,6 @@ void tryArm(void) void processRx(timeUs_t currentTimeUs) { - static bool armedBeeperOn = false; - // Calculate RPY channel data calculateRxChannelsAndUpdateFailsafe(currentTimeUs); @@ -440,50 +435,6 @@ void processRx(timeUs_t currentTimeUs) const throttleStatus_e throttleStatus = calculateThrottleStatus(); - // When armed and motors aren't spinning, do beeps and then disarm - // board after delay so users without buzzer won't lose fingers. - // mixTable constrains motor commands, so checking throttleStatus is enough - if (ARMING_FLAG(ARMED) - && feature(FEATURE_MOTOR_STOP) - && !STATE(FIXED_WING) - ) { - if (isUsingSticksForArming()) { - if (throttleStatus == THROTTLE_LOW) { - if (armingConfig()->auto_disarm_delay != 0 - && (int32_t)(disarmAt - millis()) < 0 - ) { - // auto-disarm configured and delay is over - disarm(DISARM_TIMEOUT); - armedBeeperOn = false; - } else { - // still armed; do warning beeps while armed - beeper(BEEPER_ARMED); - armedBeeperOn = true; - } - } else { - // throttle is not low - if (armingConfig()->auto_disarm_delay != 0) { - // extend disarm time - disarmAt = millis() + armingConfig()->auto_disarm_delay * 1000; - } - - if (armedBeeperOn) { - beeperSilence(); - armedBeeperOn = false; - } - } - } else { - // arming is via AUX switch; beep while throttle low - if (throttleStatus == THROTTLE_LOW) { - beeper(BEEPER_ARMED); - armedBeeperOn = true; - } else if (armedBeeperOn) { - beeperSilence(); - armedBeeperOn = false; - } - } - } - processRcStickPositions(throttleStatus); updateActivatedModes(); diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index b2ad5b075db..857f9eab6b0 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -578,7 +578,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF break; case MSP_ARMING_CONFIG: - sbufWriteU8(dst, armingConfig()->auto_disarm_delay); + sbufWriteU8(dst, 0); sbufWriteU8(dst, armingConfig()->disarm_kill_switch); break; @@ -1547,7 +1547,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) case MSP_SET_ARMING_CONFIG: if (dataSize >= 2) { - armingConfigMutable()->auto_disarm_delay = constrain(sbufReadU8(src), AUTO_DISARM_DELAY_MIN, AUTO_DISARM_DELAY_MAX); + sbufReadU8(src); //Swallow the first byte, used to be auto_disarm_delay armingConfigMutable()->disarm_kill_switch = !!sbufReadU8(src); } else return MSP_RESULT_ERROR; diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index 64b33504b7b..543902f6ba7 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -79,12 +79,11 @@ PG_RESET_TEMPLATE(rcControlsConfig_t, rcControlsConfig, .deadband3d_throttle = 50 ); -PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 1); +PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 2); PG_RESET_TEMPLATE(armingConfig_t, armingConfig, .fixed_wing_auto_arm = 0, .disarm_kill_switch = 1, - .auto_disarm_delay = 5, .switchDisarmDelayMs = DEFAULT_RC_SWITCH_DISARM_DELAY_MS, ); diff --git a/src/main/fc/rc_controls.h b/src/main/fc/rc_controls.h index 51d49884e02..6858f646e72 100644 --- a/src/main/fc/rc_controls.h +++ b/src/main/fc/rc_controls.h @@ -19,9 +19,6 @@ #include "config/parameter_group.h" -#define AUTO_DISARM_DELAY_MIN 0 -#define AUTO_DISARM_DELAY_MAX 60 - typedef enum rc_alias { ROLL = 0, PITCH, @@ -84,7 +81,6 @@ PG_DECLARE(rcControlsConfig_t, rcControlsConfig); typedef struct armingConfig_s { uint8_t fixed_wing_auto_arm; // Auto-arm fixed wing aircraft on throttle up and never disarm uint8_t disarm_kill_switch; // allow disarm via AUX switch regardless of throttle value - uint8_t auto_disarm_delay; // allow automatically disarming multicopters after auto_disarm_delay seconds of zero throttle. Disabled when 0 uint16_t switchDisarmDelayMs; // additional delay between ARM box going off and actual disarm } armingConfig_t; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 2137e488f9e..b98b09052f8 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -793,9 +793,6 @@ groups: type: bool - name: disarm_kill_switch type: bool - - name: auto_disarm_delay - min: 0 - max: 60 - name: switch_disarm_delay field: switchDisarmDelayMs min: 0