From 46ae6ff7453d68502e1321288b6d003c27dabf0f Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 25 Mar 2024 21:34:19 +0100 Subject: [PATCH 1/5] Remove killswitch --- docs/development/Blackbox Internals.md | 1 - src/main/fc/fc_core.c | 10 +--- src/main/fc/fc_core.h | 1 - src/main/fc/fc_msp.c | 13 ----- src/main/fc/fc_msp_box.c | 3 - src/main/fc/rc_controls.c | 12 +--- src/main/fc/rc_controls.h | 1 - src/main/fc/rc_modes.h | 1 - src/main/fc/runtime_config.c | 3 +- src/main/fc/runtime_config.h | 4 +- src/main/fc/settings.yaml | 4 -- src/main/io/osd.c | 4 +- src/main/io/osd.h | 1 - src/main/io/osd_dji_hd.c | 2 - src/main/msp/msp_protocol.h | 3 - src/test/unit/flight_failsafe_unittest.cc.txt | 56 ------------------- 16 files changed, 7 insertions(+), 112 deletions(-) diff --git a/docs/development/Blackbox Internals.md b/docs/development/Blackbox Internals.md index bf7991c7041..5e82979bcad 100644 --- a/docs/development/Blackbox Internals.md +++ b/docs/development/Blackbox Internals.md @@ -566,7 +566,6 @@ The log end marker is an optional Event ("E") frame of type 0xFF whose payload i
  • Sticks
  • Switch_3D
  • Switch
  • -
  • Killswitch
  • Failsafe
  • Navigation
  • diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index 6bee30e572b..9986b8e934d 100644 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -307,14 +307,6 @@ static void updateArmingStatus(void) DISABLE_ARMING_FLAG(ARMING_DISABLED_BOXFAILSAFE); } - /* CHECK: BOXKILLSWITCH */ - if (IS_RC_MODE_ACTIVE(BOXKILLSWITCH)) { - ENABLE_ARMING_FLAG(ARMING_DISABLED_BOXKILLSWITCH); - } - else { - DISABLE_ARMING_FLAG(ARMING_DISABLED_BOXKILLSWITCH); - } - /* CHECK: Do not allow arming if Servo AutoTrim is enabled */ if (IS_RC_MODE_ACTIVE(BOXAUTOTRIM)) { ENABLE_ARMING_FLAG(ARMING_DISABLED_SERVO_AUTOTRIM); @@ -525,7 +517,7 @@ bool emergInflightRearmEnabled(void) timeMs_t currentTimeMs = millis(); emergRearmStabiliseTimeout = 0; - if ((lastDisarmReason != DISARM_SWITCH && lastDisarmReason != DISARM_KILLSWITCH) || + if ((lastDisarmReason != DISARM_SWITCH) || (currentTimeMs > US2MS(lastDisarmTimeUs) + EMERGENCY_INFLIGHT_REARM_TIME_WINDOW_MS)) { return false; } diff --git a/src/main/fc/fc_core.h b/src/main/fc/fc_core.h index 455e5b3849e..0e83ef7a467 100644 --- a/src/main/fc/fc_core.h +++ b/src/main/fc/fc_core.h @@ -27,7 +27,6 @@ typedef enum disarmReason_e { DISARM_STICKS = 2, DISARM_SWITCH_3D = 3, DISARM_SWITCH = 4, - DISARM_KILLSWITCH = 5, DISARM_FAILSAFE = 6, DISARM_NAVIGATION = 7, DISARM_LANDING = 8, diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index c076fa88c42..2d47d0ec2e9 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -670,11 +670,6 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU16(dst, getRSSI()); break; - case MSP_ARMING_CONFIG: - sbufWriteU8(dst, 0); - sbufWriteU8(dst, armingConfig()->disarm_kill_switch); - break; - case MSP_LOOP_TIME: sbufWriteU16(dst, gyroConfig()->looptime); break; @@ -1828,14 +1823,6 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) break; #endif - case MSP_SET_ARMING_CONFIG: - if (dataSize == 2) { - sbufReadU8(src); //Swallow the first byte, used to be auto_disarm_delay - armingConfigMutable()->disarm_kill_switch = !!sbufReadU8(src); - } else - return MSP_RESULT_ERROR; - break; - case MSP_SET_LOOP_TIME: if (sbufReadU16Safe(&tmp_u16, src)) gyroConfigMutable()->looptime = tmp_u16; diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index c61c2aa19e9..8cc0e948bde 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -76,7 +76,6 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = { { .boxId = BOXTURNASSIST, .boxName = "TURN ASSIST", .permanentId = 35 }, { .boxId = BOXNAVLAUNCH, .boxName = "NAV LAUNCH", .permanentId = 36 }, { .boxId = BOXAUTOTRIM, .boxName = "SERVO AUTOTRIM", .permanentId = 37 }, - { .boxId = BOXKILLSWITCH, .boxName = "KILLSWITCH", .permanentId = 38 }, { .boxId = BOXCAMERA1, .boxName = "CAMERA CONTROL 1", .permanentId = 39 }, { .boxId = BOXCAMERA2, .boxName = "CAMERA CONTROL 2", .permanentId = 40 }, { .boxId = BOXCAMERA3, .boxName = "CAMERA CONTROL 3", .permanentId = 41 }, @@ -320,7 +319,6 @@ void initActiveBoxIds(void) } #endif - ADD_ACTIVE_BOX(BOXKILLSWITCH); ADD_ACTIVE_BOX(BOXFAILSAFE); #if defined(USE_RCDEVICE) || defined(USE_MSP_DISPLAYPORT) @@ -405,7 +403,6 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) CHECK_ACTIVE_BOX(IS_ENABLED(FLIGHT_MODE(NAV_LAUNCH_MODE)), BOXNAVLAUNCH); CHECK_ACTIVE_BOX(IS_ENABLED(FLIGHT_MODE(AUTO_TUNE)), BOXAUTOTUNE); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXAUTOTRIM)), BOXAUTOTRIM); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXKILLSWITCH)), BOXKILLSWITCH); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXHOMERESET)), BOXHOMERESET); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXCAMERA1)), BOXCAMERA1); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXCAMERA2)), BOXCAMERA2); diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index 6c65736dbe5..b06b4bf51fe 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -87,11 +87,10 @@ PG_RESET_TEMPLATE(rcControlsConfig_t, rcControlsConfig, .airmodeThrottleThreshold = SETTING_AIRMODE_THROTTLE_THRESHOLD_DEFAULT, ); -PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 2); +PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 3); PG_RESET_TEMPLATE(armingConfig_t, armingConfig, .fixed_wing_auto_arm = SETTING_FIXED_WING_AUTO_ARM_DEFAULT, - .disarm_kill_switch = SETTING_DISARM_KILL_SWITCH_DEFAULT, .switchDisarmDelayMs = SETTING_SWITCH_DISARM_DELAY_DEFAULT, .prearmTimeoutMs = SETTING_PREARM_TIMEOUT_DEFAULT, ); @@ -231,20 +230,13 @@ void processRcStickPositions(bool isThrottleLow) 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 || isThrottleLow) { - disarm(DISARM_SWITCH); - } + disarm(DISARM_SWITCH); } } else { rcDisarmTimeMs = currentTimeMs; } } - - // KILLSWITCH disarms instantly - if (IS_RC_MODE_ACTIVE(BOXKILLSWITCH)) { - disarm(DISARM_KILLSWITCH); - } } if (rcDelayCommand != 20) { diff --git a/src/main/fc/rc_controls.h b/src/main/fc/rc_controls.h index 0c9bcb199d3..4ea5b9f3f50 100644 --- a/src/main/fc/rc_controls.h +++ b/src/main/fc/rc_controls.h @@ -95,7 +95,6 @@ PG_DECLARE(rcControlsConfig_t, rcControlsConfig); typedef struct armingConfig_s { bool fixed_wing_auto_arm; // Auto-arm fixed wing aircraft on throttle up and never disarm - bool disarm_kill_switch; // allow disarm via AUX switch regardless of throttle value uint16_t switchDisarmDelayMs; // additional delay between ARM box going off and actual disarm uint16_t prearmTimeoutMs; // duration for which Prearm being activated is valid. after this, Prearm needs to be reset. 0 means Prearm does not timeout. } armingConfig_t; diff --git a/src/main/fc/rc_modes.h b/src/main/fc/rc_modes.h index fa1827a6ad0..04aea681bc9 100644 --- a/src/main/fc/rc_modes.h +++ b/src/main/fc/rc_modes.h @@ -49,7 +49,6 @@ typedef enum { BOXAIRMODE = 20, BOXHOMERESET = 21, BOXGCSNAV = 22, - BOXKILLSWITCH = 23, // old HEADING LOCK BOXSURFACE = 24, BOXFLAPERON = 25, BOXTURNASSIST = 26, diff --git a/src/main/fc/runtime_config.c b/src/main/fc/runtime_config.c index daeb9cbbcde..44118ef54b9 100644 --- a/src/main/fc/runtime_config.c +++ b/src/main/fc/runtime_config.c @@ -34,7 +34,7 @@ static EXTENDED_FASTRAM uint32_t enabledSensors = 0; #if !defined(CLI_MINIMAL_VERBOSITY) const char *armingDisableFlagNames[]= { "FS", "ANGLE", "CAL", "OVRLD", "NAV", "COMPASS", - "ACC", "ARMSW", "HWFAIL", "BOXFS", "KILLSW", "RX", + "ACC", "ARMSW", "HWFAIL", "BOXFS", "RX", "THR", "CLI", "CMS", "OSD", "ROLL/PITCH", "AUTOTRIM", "OOM", "SETTINGFAIL", "PWMOUT", "NOPREARM", "DSHOTBEEPER", "LANDED" }; @@ -50,7 +50,6 @@ const armingFlag_e armDisableReasonsChecklist[] = { ARMING_DISABLED_NAVIGATION_UNSAFE, ARMING_DISABLED_ARM_SWITCH, ARMING_DISABLED_BOXFAILSAFE, - ARMING_DISABLED_BOXKILLSWITCH, ARMING_DISABLED_THROTTLE, ARMING_DISABLED_CLI, ARMING_DISABLED_CMS_MENU, diff --git a/src/main/fc/runtime_config.h b/src/main/fc/runtime_config.h index bda9321b6b6..974f90f8c4d 100644 --- a/src/main/fc/runtime_config.h +++ b/src/main/fc/runtime_config.h @@ -34,7 +34,7 @@ typedef enum { ARMING_DISABLED_ARM_SWITCH = (1 << 14), ARMING_DISABLED_HARDWARE_FAILURE = (1 << 15), ARMING_DISABLED_BOXFAILSAFE = (1 << 16), - ARMING_DISABLED_BOXKILLSWITCH = (1 << 17), + ARMING_DISABLED_RC_LINK = (1 << 18), ARMING_DISABLED_THROTTLE = (1 << 19), ARMING_DISABLED_CLI = (1 << 20), @@ -53,7 +53,7 @@ typedef enum { ARMING_DISABLED_SYSTEM_OVERLOADED | ARMING_DISABLED_NAVIGATION_UNSAFE | ARMING_DISABLED_COMPASS_NOT_CALIBRATED | ARMING_DISABLED_ACCELEROMETER_NOT_CALIBRATED | ARMING_DISABLED_ARM_SWITCH | ARMING_DISABLED_HARDWARE_FAILURE | ARMING_DISABLED_BOXFAILSAFE | - ARMING_DISABLED_BOXKILLSWITCH | ARMING_DISABLED_RC_LINK | ARMING_DISABLED_THROTTLE | ARMING_DISABLED_CLI | + ARMING_DISABLED_RC_LINK | ARMING_DISABLED_THROTTLE | ARMING_DISABLED_CLI | ARMING_DISABLED_CMS_MENU | ARMING_DISABLED_OSD_MENU | ARMING_DISABLED_ROLLPITCH_NOT_CENTERED | ARMING_DISABLED_SERVO_AUTOTRIM | ARMING_DISABLED_OOM | ARMING_DISABLED_INVALID_SETTING | ARMING_DISABLED_PWM_OUTPUT_ERROR | ARMING_DISABLED_NO_PREARM | ARMING_DISABLED_DSHOT_BEEPER | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index e3e69c7487f..abab04fbc5d 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1496,10 +1496,6 @@ groups: description: "Auto-arm fixed wing aircraft on throttle above min_check, and disarming with stick commands are disabled, so power cycle is required to disarm. Requires enabled motorstop and no arm switch configured." default_value: OFF type: bool - - name: disarm_kill_switch - description: "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." - default_value: ON - type: bool - name: switch_disarm_delay description: "Delay before disarming when requested by switch (ms) [0-1000]" default_value: 250 diff --git a/src/main/io/osd.c b/src/main/io/osd.c index f5f9e1f815b..df59d02228b 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -902,8 +902,6 @@ static const char * osdArmingDisabledReasonMessage(void) return OSD_MESSAGE_STR(OSD_MSG_HW_FAIL); case ARMING_DISABLED_BOXFAILSAFE: return OSD_MESSAGE_STR(OSD_MSG_FS_EN); - case ARMING_DISABLED_BOXKILLSWITCH: - return OSD_MESSAGE_STR(OSD_MSG_KILL_SW_EN); case ARMING_DISABLED_RC_LINK: return OSD_MESSAGE_STR(OSD_MSG_NO_RC_LINK); case ARMING_DISABLED_THROTTLE: @@ -4424,7 +4422,7 @@ static void osdUpdateStats(void) static void osdShowStats(bool isSinglePageStatsCompatible, uint8_t page) { - const char * disarmReasonStr[DISARM_REASON_COUNT] = { "UNKNOWN", "TIMEOUT", "STICKS", "SWITCH", "SWITCH", "KILLSW", "FAILSAFE", "NAV SYS", "LANDING"}; + const char * disarmReasonStr[DISARM_REASON_COUNT] = { "UNKNOWN", "TIMEOUT", "STICKS", "SWITCH", "SWITCH", "", "FAILSAFE", "NAV SYS", "LANDING"}; uint8_t top = 1; // Start one line down leaving space at the top of the screen. size_t multiValueLengthOffset = 0; diff --git a/src/main/io/osd.h b/src/main/io/osd.h index 503f7dd0e09..454b7160420 100644 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -75,7 +75,6 @@ #define OSD_MSG_PITOT_FAIL "PITOT METER FAILURE" #define OSD_MSG_HW_FAIL "HARDWARE FAILURE" #define OSD_MSG_FS_EN "FAILSAFE MODE ENABLED" -#define OSD_MSG_KILL_SW_EN "KILLSWITCH MODE ENABLED" #define OSD_MSG_NO_RC_LINK "NO RC LINK" #define OSD_MSG_THROTTLE_NOT_LOW "THROTTLE IS NOT LOW" #define OSD_MSG_ROLLPITCH_OFFCENTER "ROLLPITCH NOT CENTERED" diff --git a/src/main/io/osd_dji_hd.c b/src/main/io/osd_dji_hd.c index 78edf45370b..29dfe0b809e 100644 --- a/src/main/io/osd_dji_hd.c +++ b/src/main/io/osd_dji_hd.c @@ -505,8 +505,6 @@ static char * osdArmingDisabledReasonMessage(void) // return OSD_MESSAGE_STR("HARDWARE FAILURE"); case ARMING_DISABLED_BOXFAILSAFE: return OSD_MESSAGE_STR("FAILSAFE ENABLED"); - case ARMING_DISABLED_BOXKILLSWITCH: - return OSD_MESSAGE_STR("KILLSWITCH ENABLED"); case ARMING_DISABLED_RC_LINK: return OSD_MESSAGE_STR("NO RC LINK"); case ARMING_DISABLED_THROTTLE: diff --git a/src/main/msp/msp_protocol.h b/src/main/msp/msp_protocol.h index b44037f2f88..f3a925828e7 100644 --- a/src/main/msp/msp_protocol.h +++ b/src/main/msp/msp_protocol.h @@ -163,9 +163,6 @@ #define MSP_SONAR_ALTITUDE 58 //out message get surface altitude [cm] -#define MSP_ARMING_CONFIG 61 //out message Returns auto_disarm_delay and disarm_kill_switch parameters -#define MSP_SET_ARMING_CONFIG 62 //in message Sets auto_disarm_delay and disarm_kill_switch parameters - // // Baseflight MSP commands (if enabled they exist in Cleanflight) // diff --git a/src/test/unit/flight_failsafe_unittest.cc.txt b/src/test/unit/flight_failsafe_unittest.cc.txt index eb4aacef72c..895cbd15d76 100644 --- a/src/test/unit/flight_failsafe_unittest.cc.txt +++ b/src/test/unit/flight_failsafe_unittest.cc.txt @@ -297,62 +297,6 @@ TEST(FlightFailsafeTest, TestFailsafeDetectsRxLossAndJustDisarms) EXPECT_FALSE(ARMING_FLAG(PREVENT_ARMING)); } -/****************************************************************************************/ -TEST(FlightFailsafeTest, TestFailsafeDetectsKillswitchEvent) -{ - // given - ENABLE_ARMING_FLAG(ARMED); - resetCallCounters(); - failsafeStartMonitoring(); - - // and - throttleStatus = THROTTLE_HIGH; // throttle HIGH to go for a failsafe landing procedure - failsafeConfig.failsafe_kill_switch = 1; // configure AUX switch as kill switch - ACTIVATE_RC_MODE(BOXFAILSAFE); // and activate it - sysTickUptime = 0; // restart time from 0 - failsafeOnValidDataReceived(); // set last valid sample at current time - sysTickUptime = PERIOD_RXDATA_FAILURE + 1; // adjust time to point just past the failure time to - failsafeOnValidDataFailed(); // cause a lost link - - // when - failsafeUpdateState(); // kill switch handling should come first - - // then - EXPECT_EQ(true, failsafeIsActive()); - EXPECT_TRUE(ARMING_FLAG(PREVENT_ARMING)); - EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM)); - EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase()); - - // given - failsafeOnValidDataFailed(); // set last invalid sample at current time - sysTickUptime += PERIOD_RXDATA_RECOVERY + 1; // adjust time to point just past the recovery time to - failsafeOnValidDataReceived(); // cause a recovered link - - rcModeActivationMask = DE_ACTIVATE_ALL_BOXES; // BOXFAILSAFE must be off (kill switch) - - // when - failsafeUpdateState(); - - // then - EXPECT_EQ(true, failsafeIsActive()); - EXPECT_TRUE(ARMING_FLAG(PREVENT_ARMING)); - EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM)); - EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase()); - - // given - sysTickUptime += PERIOD_OF_1_SECONDS + 1; // adjust time to point just past the required additional recovery time - failsafeOnValidDataReceived(); - - // when - failsafeUpdateState(); - - // then - EXPECT_EQ(false, failsafeIsActive()); - EXPECT_EQ(FAILSAFE_IDLE, failsafePhase()); - EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM)); // disarm not called repeatedly. - EXPECT_FALSE(ARMING_FLAG(PREVENT_ARMING)); -} - /****************************************************************************************/ // // Additional non-stepwise tests From 048ad2b2734ec883b7a10a70a8e730867f008630 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 25 Mar 2024 21:38:36 +0100 Subject: [PATCH 2/5] Add a comment --- src/main/io/osd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index df59d02228b..11b0ac60608 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -4422,6 +4422,7 @@ static void osdUpdateStats(void) static void osdShowStats(bool isSinglePageStatsCompatible, uint8_t page) { + //We keep "" for backward compatibility with the Blackbox explorer and other potential usages const char * disarmReasonStr[DISARM_REASON_COUNT] = { "UNKNOWN", "TIMEOUT", "STICKS", "SWITCH", "SWITCH", "", "FAILSAFE", "NAV SYS", "LANDING"}; uint8_t top = 1; // Start one line down leaving space at the top of the screen. size_t multiValueLengthOffset = 0; From 1ebefcd67b28529ef633688a19e88375e203ea4c Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 25 Mar 2024 21:39:18 +0100 Subject: [PATCH 3/5] Docs update --- docs/Settings.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 61195109625..a157f56010e 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -672,16 +672,6 @@ Defines debug values exposed in debug variables (developer / debugging setting) --- -### disarm_kill_switch - -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. - -| Default | Min | Max | -| --- | --- | --- | -| ON | OFF | ON | - ---- - ### display_force_sw_blink OFF = OSD hardware blink / ON = OSD software blink. If OSD warning text/values are invisible, try setting this to ON From 22a6922297264abd4d439dc5079efa76f1721a64 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 29 Mar 2024 15:09:10 +0100 Subject: [PATCH 4/5] Bring back setting to disarm regardless of throttle position --- src/main/fc/rc_controls.c | 5 ++++- src/main/fc/rc_controls.h | 1 + src/main/fc/settings.yaml | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index b06b4bf51fe..d03bd466a49 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -91,6 +91,7 @@ PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, PG_RESET_TEMPLATE(armingConfig_t, armingConfig, .fixed_wing_auto_arm = SETTING_FIXED_WING_AUTO_ARM_DEFAULT, + .disarm_always = SETTING_DISARM_ALWAYS_DEFAULT, .switchDisarmDelayMs = SETTING_SWITCH_DISARM_DELAY_DEFAULT, .prearmTimeoutMs = SETTING_PREARM_TIMEOUT_DEFAULT, ); @@ -230,7 +231,9 @@ void processRcStickPositions(bool isThrottleLow) if (ARMING_FLAG(ARMED) && !IS_RC_MODE_ACTIVE(BOXFAILSAFE) && rxIsReceivingSignal() && !failsafeIsActive()) { const timeMs_t disarmDelay = currentTimeMs - rcDisarmTimeMs; if (disarmDelay > armingConfig()->switchDisarmDelayMs) { - disarm(DISARM_SWITCH); + if (armingConfig()->disarm_always || isThrottleLow) { + disarm(DISARM_SWITCH); + } } } else { diff --git a/src/main/fc/rc_controls.h b/src/main/fc/rc_controls.h index 4ea5b9f3f50..8d5ee66bd73 100644 --- a/src/main/fc/rc_controls.h +++ b/src/main/fc/rc_controls.h @@ -95,6 +95,7 @@ PG_DECLARE(rcControlsConfig_t, rcControlsConfig); typedef struct armingConfig_s { bool fixed_wing_auto_arm; // Auto-arm fixed wing aircraft on throttle up and never disarm + bool disarm_always; // Disarm motors regardless of throttle value uint16_t switchDisarmDelayMs; // additional delay between ARM box going off and actual disarm uint16_t prearmTimeoutMs; // duration for which Prearm being activated is valid. after this, Prearm needs to be reset. 0 means Prearm does not timeout. } armingConfig_t; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index abab04fbc5d..106a830decc 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1496,6 +1496,10 @@ groups: description: "Auto-arm fixed wing aircraft on throttle above min_check, and disarming with stick commands are disabled, so power cycle is required to disarm. Requires enabled motorstop and no arm switch configured." default_value: OFF type: bool + - name: disarm_always + description: "Disarms the motors independently of throttle value. Setting to OFF reverts to the old behaviour of disarming only when the throttle is low." + default_value: ON + type: bool - name: switch_disarm_delay description: "Delay before disarming when requested by switch (ms) [0-1000]" default_value: 250 From 68b88ccb97a0179ed9c9079af5902994648f8133 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 29 Mar 2024 16:45:05 +0100 Subject: [PATCH 5/5] Docs update --- docs/Settings.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/Settings.md b/docs/Settings.md index a157f56010e..fefcc927f20 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -672,6 +672,16 @@ Defines debug values exposed in debug variables (developer / debugging setting) --- +### disarm_always + +Disarms the motors independently of throttle value. Setting to OFF reverts to the old behaviour of disarming only when the throttle is low. + +| Default | Min | Max | +| --- | --- | --- | +| ON | OFF | ON | + +--- + ### display_force_sw_blink OFF = OSD hardware blink / ON = OSD software blink. If OSD warning text/values are invisible, try setting this to ON