mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 01:05:21 +03:00
Remove failsafe_kill_switch setting; Replace with new KILLSWITCH box mode
This commit is contained in:
parent
87fb5ee1c5
commit
c9b161593b
9 changed files with 41 additions and 51 deletions
|
@ -245,7 +245,6 @@ Re-apply any new defaults as desired.
|
|||
| failsafe_recovery_delay | 5 | Time in deciseconds to wait before aborting failsafe when signal is recovered. See [Failsafe documentation](Failsafe.md#failsafe_recovery_delay). |
|
||||
| failsafe_off_delay | 200 | Time in deciseconds to wait before turning off motors when failsafe is activated. 0 = No timeout. See [Failsafe documentation](Failsafe.md#failsafe_off_delay). |
|
||||
| failsafe_throttle | 1000 | Throttle level used for landing when failsafe is enabled. See [Failsafe documentation](Failsafe.md#failsafe_throttle). |
|
||||
| failsafe_kill_switch | OFF | Set to ON to use an AUX channel as a failsafe kill switch. |
|
||||
| failsafe_throttle_low_delay | 100 | If failsafe activated when throttle is low for this much time - bypass failsafe and disarm, in 10th of seconds. 0 = No timeout |
|
||||
| failsafe_procedure | SET-THR | What failsafe procedure to initiate in Stage 2. See [Failsafe documentation](Failsafe.md#failsafe_throttle). |
|
||||
| failsafe_stick_threshold | 0 | Threshold for stick motion to consider failsafe condition resolved. If non-zero failsafe won't clear even if RC link is restored - you have to move sticks to exit failsafe. |
|
||||
|
|
|
@ -28,13 +28,10 @@ __Stage 2__ is not activated until 5 seconds after the flight controller boots u
|
|||
__Stage 2__ will be aborted when it was due to:
|
||||
|
||||
* a lost RC signal and the RC signal has recovered.
|
||||
* a transmitter failsafe switch was set to ON position and the switch is set to OFF position (and `failsafe_kill_switch` is set to OFF).
|
||||
|
||||
Note that:
|
||||
* At the end of the stage 2 procedure, the flight controller will be disarmed and re-arming will be locked until the signal from the receiver is restored for 30 seconds AND the arming switch is in the OFF position (when an arm switch is in use).
|
||||
|
||||
* When `failsafe_kill_switch` is set to ON and the rc switch configured for failsafe is set to ON, the craft is instantly disarmed. Re-arming is possible when the signal from the receiver has restored for at least 3 seconds AND the arming switch is in the OFF position (when one is in use). Similar effect can be achieved by setting 'failsafe_throttle' to 1000 and 'failsafe_off_delay' to 0. This is not the prefered method, since the reaction is slower and re-arming will be locked.
|
||||
|
||||
* Prior to starting a stage 2 intervention it is checked if the throttle position was below `min_throttle` level for the last `failsafe_throttle_low_delay` seconds. If it was, the craft is assumed to be on the ground and is only disarmed. It may be re-armed without a power cycle. This feature can be disabled completely by
|
||||
setting `failsafe_throttle_low_delay` to zero. This is useful for gliders that may fly long with zero throttle.
|
||||
|
||||
|
@ -92,10 +89,6 @@ Delay after failsafe activates before motors finally turn off. This is the amou
|
|||
|
||||
Throttle level used for landing. Specify a value that causes the aircraft to descend at about 1M/sec. Default is set to 1000 which should correspond to throttle off.
|
||||
|
||||
### `failsafe_kill_switch`
|
||||
|
||||
Configure the rc switched failsafe action: the same action as when the rc link is lost (set to OFF) or disarms instantly (set to ON). Also see above.
|
||||
|
||||
### `failsafe_throttle_low_delay`
|
||||
|
||||
Time throttle level must have been below 'min_throttle' to _only disarm_ instead of _full failsafe procedure_. Set to zero to disable.
|
||||
|
|
|
@ -615,7 +615,6 @@ static const clivalue_t valueTable[] = {
|
|||
{ "failsafe_delay", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 200 }, PG_FAILSAFE_CONFIG, offsetof(failsafeConfig_t, failsafe_delay) },
|
||||
{ "failsafe_recovery_delay", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 200 }, PG_FAILSAFE_CONFIG, offsetof(failsafeConfig_t, failsafe_recovery_delay) },
|
||||
{ "failsafe_off_delay", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 200 }, PG_FAILSAFE_CONFIG, offsetof(failsafeConfig_t, failsafe_off_delay) },
|
||||
{ "failsafe_kill_switch", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_FAILSAFE_CONFIG, offsetof(failsafeConfig_t, failsafe_kill_switch) },
|
||||
{ "failsafe_throttle", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 1000, 2000 }, PG_FAILSAFE_CONFIG, offsetof(failsafeConfig_t, failsafe_throttle) },
|
||||
{ "failsafe_throttle_low_delay",VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 300 }, PG_FAILSAFE_CONFIG, offsetof(failsafeConfig_t, failsafe_throttle_low_delay) },
|
||||
{ "failsafe_procedure", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_FAILSAFE_PROCEDURE }, PG_FAILSAFE_CONFIG, offsetof(failsafeConfig_t, failsafe_procedure) },
|
||||
|
|
|
@ -253,7 +253,7 @@ void mwArm(void)
|
|||
if (ARMING_FLAG(ARMED)) {
|
||||
return;
|
||||
}
|
||||
if (IS_RC_MODE_ACTIVE(BOXFAILSAFE)) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXFAILSAFE) || IS_RC_MODE_ACTIVE(BOXKILLSWITCH)) {
|
||||
return;
|
||||
}
|
||||
if (!ARMING_FLAG(PREVENT_ARMING)) {
|
||||
|
|
|
@ -140,6 +140,7 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = {
|
|||
{ BOXTURNASSIST, "TURN ASSIST;", 35 },
|
||||
{ BOXNAVLAUNCH, "NAV LAUNCH;", 36 },
|
||||
{ BOXAUTOTRIM, "SERVO AUTOTRIM;", 37 },
|
||||
{ BOXKILLSWITCH, "KILLSWITCH;", 38 },
|
||||
{ CHECKBOX_ITEM_COUNT, NULL, 0xFF }
|
||||
};
|
||||
|
||||
|
@ -322,6 +323,7 @@ static void initActiveBoxIds(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
activeBoxIds[activeBoxIdCount++] = BOXKILLSWITCH;
|
||||
activeBoxIds[activeBoxIdCount++] = BOXFAILSAFE;
|
||||
}
|
||||
|
||||
|
@ -362,6 +364,7 @@ static uint32_t packFlightModeFlags(void)
|
|||
#endif
|
||||
IS_ENABLED(FLIGHT_MODE(NAV_LAUNCH_MODE)) << BOXNAVLAUNCH |
|
||||
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXAUTOTRIM)) << BOXAUTOTRIM |
|
||||
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXKILLSWITCH)) << BOXKILLSWITCH |
|
||||
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXHOMERESET)) << BOXHOMERESET;
|
||||
|
||||
uint32_t ret = 0;
|
||||
|
@ -895,7 +898,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
sbufWriteU8(dst, failsafeConfig()->failsafe_delay);
|
||||
sbufWriteU8(dst, failsafeConfig()->failsafe_off_delay);
|
||||
sbufWriteU16(dst, failsafeConfig()->failsafe_throttle);
|
||||
sbufWriteU8(dst, failsafeConfig()->failsafe_kill_switch);
|
||||
sbufWriteU8(dst, 0); // was failsafe_kill_switch
|
||||
sbufWriteU16(dst, failsafeConfig()->failsafe_throttle_low_delay);
|
||||
sbufWriteU8(dst, failsafeConfig()->failsafe_procedure);
|
||||
sbufWriteU8(dst, failsafeConfig()->failsafe_recovery_delay);
|
||||
|
@ -1871,7 +1874,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
failsafeConfigMutable()->failsafe_delay = sbufReadU8(src);
|
||||
failsafeConfigMutable()->failsafe_off_delay = sbufReadU8(src);
|
||||
failsafeConfigMutable()->failsafe_throttle = sbufReadU16(src);
|
||||
failsafeConfigMutable()->failsafe_kill_switch = sbufReadU8(src);
|
||||
sbufReadU8(src); // was failsafe_kill_switch
|
||||
failsafeConfigMutable()->failsafe_throttle_low_delay = sbufReadU16(src);
|
||||
failsafeConfigMutable()->failsafe_procedure = sbufReadU8(src);
|
||||
if (dataSize > 8) {
|
||||
|
|
|
@ -183,6 +183,11 @@ void processRcStickPositions(throttleStatus_e throttleStatus, bool disarm_kill_s
|
|||
}
|
||||
}
|
||||
|
||||
// KILLSWITCH disarms instantly
|
||||
if (IS_RC_MODE_ACTIVE(BOXKILLSWITCH)) {
|
||||
mwDisarm();
|
||||
}
|
||||
|
||||
if (rcDelayCommand != 20) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,33 +21,33 @@
|
|||
|
||||
typedef enum {
|
||||
BOXARM = 0,
|
||||
BOXANGLE,
|
||||
BOXHORIZON,
|
||||
BOXNAVALTHOLD, // old BOXBARO
|
||||
BOXHEADINGHOLD, // old MAG
|
||||
BOXHEADFREE,
|
||||
BOXHEADADJ,
|
||||
BOXCAMSTAB,
|
||||
BOXNAVRTH, // old GPSHOME
|
||||
BOXNAVPOSHOLD, // old GPSHOLD
|
||||
BOXPASSTHRU,
|
||||
BOXBEEPERON,
|
||||
BOXLEDLOW,
|
||||
BOXLLIGHTS,
|
||||
BOXNAVLAUNCH,
|
||||
BOXOSD,
|
||||
BOXTELEMETRY,
|
||||
BOXBLACKBOX,
|
||||
BOXFAILSAFE,
|
||||
BOXNAVWP,
|
||||
BOXAIRMODE,
|
||||
BOXHOMERESET,
|
||||
BOXGCSNAV,
|
||||
BOXUNUSED, // old HEADING LOCK
|
||||
BOXSURFACE,
|
||||
BOXFLAPERON,
|
||||
BOXTURNASSIST,
|
||||
BOXAUTOTRIM,
|
||||
BOXANGLE = 1,
|
||||
BOXHORIZON = 2,
|
||||
BOXNAVALTHOLD = 3, // old BOXBARO
|
||||
BOXHEADINGHOLD = 4, // old MAG
|
||||
BOXHEADFREE = 5,
|
||||
BOXHEADADJ = 6,
|
||||
BOXCAMSTAB = 7,
|
||||
BOXNAVRTH = 8, // old GPSHOME
|
||||
BOXNAVPOSHOLD = 9, // old GPSHOLD
|
||||
BOXPASSTHRU = 10,
|
||||
BOXBEEPERON = 11,
|
||||
BOXLEDLOW = 12,
|
||||
BOXLLIGHTS = 13,
|
||||
BOXNAVLAUNCH = 14,
|
||||
BOXOSD = 15,
|
||||
BOXTELEMETRY = 16,
|
||||
BOXBLACKBOX = 17,
|
||||
BOXFAILSAFE = 18,
|
||||
BOXNAVWP = 19,
|
||||
BOXAIRMODE = 20,
|
||||
BOXHOMERESET = 21,
|
||||
BOXGCSNAV = 22,
|
||||
BOXKILLSWITCH = 23, // old HEADING LOCK
|
||||
BOXSURFACE = 24,
|
||||
BOXFLAPERON = 25,
|
||||
BOXTURNASSIST = 26,
|
||||
BOXAUTOTRIM = 27,
|
||||
CHECKBOX_ITEM_COUNT
|
||||
} boxId_e;
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ PG_RESET_TEMPLATE(failsafeConfig_t, failsafeConfig,
|
|||
.failsafe_recovery_delay = 5, // 0.5 seconds (plus 200ms explicit delay)
|
||||
.failsafe_off_delay = 200, // 20sec
|
||||
.failsafe_throttle = 1000, // default throttle off.
|
||||
.failsafe_kill_switch = 0, // default failsafe switch action is identical to rc link loss
|
||||
.failsafe_throttle_low_delay = 100, // default throttle low delay for "just disarm" on failsafe condition
|
||||
.failsafe_procedure = 0, // default full failsafe procedure is 0: auto-landing, 1: drop, 2 : RTH
|
||||
.failsafe_fw_roll_angle = -200, // 20 deg left
|
||||
|
@ -324,7 +323,6 @@ void failsafeUpdateState(void)
|
|||
|
||||
const bool receivingRxData = failsafeIsReceivingRxData();
|
||||
const bool armed = ARMING_FLAG(ARMED);
|
||||
const bool failsafeSwitchIsOn = IS_RC_MODE_ACTIVE(BOXFAILSAFE);
|
||||
const bool sticksAreMoving = failsafeCheckStickMotion();
|
||||
beeperMode_e beeperMode = BEEPER_SILENCE;
|
||||
|
||||
|
@ -345,13 +343,7 @@ void failsafeUpdateState(void)
|
|||
if (THROTTLE_HIGH == calculateThrottleStatus()) {
|
||||
failsafeState.throttleLowPeriod = millis() + failsafeConfig()->failsafe_throttle_low_delay * MILLIS_PER_TENTH_SECOND;
|
||||
}
|
||||
// Kill switch logic (must be independent of receivingRxData to skip PERIOD_RXDATA_FAILURE delay before disarming)
|
||||
if (failsafeSwitchIsOn && failsafeConfig()->failsafe_kill_switch) {
|
||||
// KillswitchEvent: failsafe switch is configured as KILL switch and is switched ON
|
||||
failsafeActivate(FAILSAFE_LANDED); // skip auto-landing procedure
|
||||
failsafeState.receivingRxDataPeriodPreset = PERIOD_OF_1_SECONDS; // require 1 seconds of valid rxData
|
||||
reprocessState = true;
|
||||
} else if (!receivingRxData) {
|
||||
if (!receivingRxData) {
|
||||
if ((failsafeConfig()->failsafe_throttle_low_delay && (millis() > failsafeState.throttleLowPeriod)) || STATE(NAV_MOTOR_STOP_OR_IDLE)) {
|
||||
// JustDisarm: throttle was LOW for at least 'failsafe_throttle_low_delay' seconds or waiting for launch
|
||||
// Don't disarm at all if `failsafe_throttle_low_delay` is set to zero
|
||||
|
@ -364,7 +356,7 @@ void failsafeUpdateState(void)
|
|||
}
|
||||
} else {
|
||||
// When NOT armed, show rxLinkState of failsafe switch in GUI (failsafe mode)
|
||||
if (failsafeSwitchIsOn || !receivingRxData) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXFAILSAFE) || !receivingRxData) {
|
||||
ENABLE_FLIGHT_MODE(FAILSAFE_MODE);
|
||||
} else {
|
||||
DISABLE_FLIGHT_MODE(FAILSAFE_MODE);
|
||||
|
|
|
@ -35,7 +35,6 @@ typedef struct failsafeConfig_s {
|
|||
uint8_t failsafe_delay; // Guard time for failsafe activation after signal lost. 1 step = 0.1sec - 1sec in example (10)
|
||||
uint8_t failsafe_recovery_delay; // Time from RC link recovery to failsafe abort. 1 step = 0.1sec - 1sec in example (10)
|
||||
uint8_t failsafe_off_delay; // Time for Landing before motors stop in 0.1sec. 1 step = 0.1sec - 20sec in example (200)
|
||||
uint8_t failsafe_kill_switch; // failsafe switch action is 0: identical to rc link loss, 1: disarms instantly
|
||||
uint8_t failsafe_procedure; // selected full failsafe procedure is 0: auto-landing, 1: Drop it, 2: Return To Home (RTH)
|
||||
|
||||
int16_t failsafe_fw_roll_angle; // Settings to be applies during "LAND" procedure on a fixed-wing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue