diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 1a7b7c2f..9aeeb7f0 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1675,6 +1675,24 @@ "failsafeKillSwitchHelp": { "message": "Set this option to make the failsafe switch, configured in the modes tab, act as a direct kill switch, bypassing the selected failsafe procedure. Note: Arming is blocked with the failsafe kill switch in the ON position" }, + "failsafeUseMinimumDistanceItem": { + "message": "Use alternate Minimum Distance Failsafe Procedure when close to Home" + }, + "failsafeUseMinimumDistanceHelp": { + "message": "Set this option if you need an alternate failsafe behavior when the craft is close to Home. For example the author of the feature has a plane that failsafes when the wings detach on landing, when the RTH failsafe behavior normally desired in flight is no longer wanted or needed." + }, + "failsafeMinDistanceItem": { + "message": "Failsafe Minimum Distance in centimeters" + }, + "failsafeMinDistanceHelp": { + "message": "The craft will use the alternate failsafe behavior when it is between 0 and this minimum distance in centimeters away from Home. For example if set to 2000 centimeters (20 meters), and the craft is at 13 meters, the Failsafe Minimum Distance Procedure will be followed. When the craft is at 25 meters, the normal failsafe procedure will be followed. If set to 0, the normal failsafe procedure will be used at all times. " + }, + "failsafeMinDistanceProcedureItem": { + "message": "Failsafe Minimum Distance Procedure" + }, + "failsafeMinDistanceProcedureHelp": { + "message": "This is the failsafe procedure that will be followed when the craft is closer than the Failsafe Minimum Distance from Home." + }, "mainHelpArmed": { "message": "Motor Arming" }, diff --git a/js/fc.js b/js/fc.js index 53769936..a969d593 100644 --- a/js/fc.js +++ b/js/fc.js @@ -376,7 +376,14 @@ var FC = { failsafe_throttle: 0, failsafe_kill_switch: 0, failsafe_throttle_low_delay: 0, - failsafe_procedure: 0 + failsafe_procedure: 0, + failsafe_recovery_delay: 0, + failsafe_fw_roll_angle: 0, + failsafe_fw_pitch_angle: 0, + failsafe_fw_yaw_rate: 0, + failsafe_stick_motion_threshold: 0, + failsafe_min_distance: 0, + failsafe_min_distance_procedure: 0 }; FW_CONFIG = { @@ -880,6 +887,14 @@ var FC = { getRthAltControlMode: function () { return ["Current", "Extra", "Fixed", "Max", "At Least"]; }, + getFailsafeProcedure: function () { + return { + 0: "Land", + 1: "Drop", + 2: "RTH", + 3: "Do Nothing", + } + }, getRcMapLetters: function () { return ['A', 'E', 'R', 'T', '5', '6', '7', '8']; } diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 29f5e98d..f41c986d 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -637,6 +637,24 @@ var mspHelper = (function (gui) { offset += 2; FAILSAFE_CONFIG.failsafe_procedure = data.getUint8(offset); offset++; + if (semver.gte(CONFIG.flightControllerVersion, "1.7.3")) { + FAILSAFE_CONFIG.failsafe_recovery_delay = data.getUint8(offset); + offset++; + FAILSAFE_CONFIG.failsafe_fw_roll_angle = data.getUint16(offset, true); + offset += 2; + FAILSAFE_CONFIG.failsafe_fw_pitch_angle = data.getUint16(offset, true); + offset += 2; + FAILSAFE_CONFIG.failsafe_fw_yaw_rate = data.getUint16(offset, true); + offset += 2; + FAILSAFE_CONFIG.failsafe_stick_motion_threshold = data.getUint16(offset, true); + offset += 2; + } + if (semver.gte(CONFIG.flightControllerVersion, "1.7.4")) { + FAILSAFE_CONFIG.failsafe_min_distance = data.getUint16(offset, true); + offset += 2; + FAILSAFE_CONFIG.failsafe_min_distance_procedure = data.getUint8(offset); + offset++; + } break; case MSPCodes.MSP_RXFAIL_CONFIG: @@ -1214,6 +1232,22 @@ var mspHelper = (function (gui) { buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_throttle_low_delay)); buffer.push(highByte(FAILSAFE_CONFIG.failsafe_throttle_low_delay)); buffer.push(FAILSAFE_CONFIG.failsafe_procedure); + if (semver.gte(CONFIG.flightControllerVersion, "1.7.3")) { + buffer.push(FAILSAFE_CONFIG.failsafe_recovery_delay); + buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_fw_roll_angle)); + buffer.push(highByte(FAILSAFE_CONFIG.failsafe_fw_roll_angle)); + buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_fw_pitch_angle)); + buffer.push(highByte(FAILSAFE_CONFIG.failsafe_fw_pitch_angle)); + buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_fw_yaw_rate)); + buffer.push(highByte(FAILSAFE_CONFIG.failsafe_fw_yaw_rate)); + buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_stick_motion_threshold)); + buffer.push(highByte(FAILSAFE_CONFIG.failsafe_stick_motion_threshold)); + } + if (semver.gte(CONFIG.flightControllerVersion, "1.7.4")) { + buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_min_distance)); + buffer.push(highByte(FAILSAFE_CONFIG.failsafe_min_distance)); + buffer.push(FAILSAFE_CONFIG.failsafe_min_distance_procedure); + } break; case MSPCodes.MSP_SET_TRANSPONDER_CONFIG: diff --git a/src/css/tabs/failsafe.css b/src/css/tabs/failsafe.css index 7b5ee035..ea96ec14 100644 --- a/src/css/tabs/failsafe.css +++ b/src/css/tabs/failsafe.css @@ -253,6 +253,12 @@ height: 90px; } +.tab-failsafe .minimumDistance { + width: 100px !important; + padding-left: 3px; + margin-right: 11px; +} + @media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) { } diff --git a/tabs/failsafe.html b/tabs/failsafe.html index 185d8065..274c63c9 100644 --- a/tabs/failsafe.html +++ b/tabs/failsafe.html @@ -109,6 +109,30 @@ + +