Skip to content

Commit 172cb0b

Browse files
Fix GPS Rescue parameters confusion (#3554)
* Fix GPS Rescue parameters * Use uint16_t for initialClimbM * change return altitude to 5 - 1000 * Attribute fixes * Do not mix semver code * Fix order * Change tooltip * Rearrange sequence of settings * update gps rescue max pitch angle text * Update return ground speed message * Update helpicon * update tooltips --------- Co-authored-by: ctzsnooze <[email protected]> Co-authored-by: ctzsnooze <[email protected]>
1 parent 5bb8207 commit 172cb0b

File tree

6 files changed

+152
-93
lines changed

6 files changed

+152
-93
lines changed

locales/en/messages.json

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -830,14 +830,6 @@
830830
"message": "Heading:",
831831
"description": "Heading shown on Setup tab"
832832
},
833-
"initialSetupPitch": {
834-
"message": "Pitch:",
835-
"description": "Pitch shown on Setup tab"
836-
},
837-
"initialSetupRoll": {
838-
"message": "Roll:",
839-
"description": "Roll shown on Setup tab"
840-
},
841833
"initialSetupMixerHead": {
842834
"message": "Mixer Type"
843835
},
@@ -2783,7 +2775,8 @@
27832775
"description": "Show GPS position - Latitude / Longitude"
27842776
},
27852777
"gpsHeading": {
2786-
"message": "Heading:"
2778+
"message": "Heading Mag / GPS:",
2779+
"description": "Show GPS heading - Magnetic / GPS course over ground"
27872780
},
27882781
"gpsSpeed": {
27892782
"message": "Speed:"
@@ -4612,56 +4605,81 @@
46124605
"message": "GPS Rescue"
46134606
},
46144607

4608+
"failsafeGpsRescueItemAltitudeMode": {
4609+
"message": "Altitude mode"
4610+
},
4611+
"failsafeGpsRescueItemAltitudeModeMaxAlt": {
4612+
"message": "Maximum altitude"
4613+
},
4614+
"failsafeGpsRescueItemAltitudeModeFixedAlt": {
4615+
"message": "Fixed altitude"
4616+
},
4617+
"failsafeGpsRescueItemAltitudeModeCurrentAlt": {
4618+
"message": "Current altitude"
4619+
},
4620+
"failsafeGpsRescueInitialClimb": {
4621+
"message": "Initial climb (meters)"
4622+
},
4623+
"failsafeGpsRescueInitialClimbHelp": {
4624+
"message": "The distance the quad will climb, above the current altitude, when a rescue is initiated and the altitude mode is set to CURRENT Altitude; also added when in MAX Altitude mode."
4625+
},
4626+
"failsafeGpsRescueItemReturnAltitude": {
4627+
"message": "Return altitude (meters) - <strong>only applies in Fixed Altitude mode</strong>"
4628+
},
4629+
"failsafeGpsRescueItemAscendRate": {
4630+
"message": "Ascend rate (meters/second)"
4631+
},
4632+
"failsafeGpsRescueItemGroundSpeed": {
4633+
"message": "Return ground speed (meters/second)"
4634+
},
46154635
"failsafeGpsRescueItemAngle": {
4616-
"message": "Angle"
4636+
"message": "Maximum pitch angle"
46174637
},
4618-
"failsafeGpsRescueItemInitialAltitude": {
4619-
"message": "Initial altitude (meters)"
4638+
"failsafeGpsRescueAngleHelp": {
4639+
"message": "Higher maximum angles lead to more aggressive returns and higher forward speeds. May be useful for heavier, high-drag or low authority craft, or for use in stronger winds. WARNING: Rescue throttle usually needs to be increased if the max angle is increased! Otherwise the quad may lose altitude and crash!"
46204640
},
46214641
"failsafeGpsRescueItemDescentDistance": {
46224642
"message": "Descent distance (meters)"
46234643
},
4624-
"failsafeGpsRescueItemMinDth": {
4625-
"message": "Minimum distance to home (meters)"
4644+
"failsafeGpsRescueItemDescendRate": {
4645+
"message": "Descend rate (meters/second)"
46264646
},
4627-
"failsafeGpsRescueItemMinDthHelp": {
4628-
"message": "The minimum distance to home needed for GPS rescue to activate"
4647+
"failsafeGpsRescueDescendRateHelp": {
4648+
"message": "The initial descent rate is set to 3 times this value, decreasing to the set value at the landing altitude."
46294649
},
4630-
"failsafeGpsRescueItemGroundSpeed": {
4631-
"message": "Ground speed (meters/second)"
4650+
"failsafeGpsRescueItemMinStartDistHelp" : {
4651+
"message": "If the rescue starts too close to home (within this minimum distance), the craft will fly away, on its current heading, until at least this distance from home, and then start normal rescue behaviour",
4652+
"description": "Updated help text for the minimum start distance needed for GPS rescue to activate"
46324653
},
46334654
"failsafeGpsRescueItemThrottleMin": {
46344655
"message": "Throttle minimum"
46354656
},
46364657
"failsafeGpsRescueItemThrottleMax": {
46374658
"message": "Throttle maximum"
46384659
},
4660+
"failsafeGpsRescueThrottleMaxHelp": {
4661+
"message": "Should be increased for heavier, high-drag or low authority craft, if a return against strong winds is likely, or if the maximum pitch angle is increased."
4662+
},
46394663
"failsafeGpsRescueItemThrottleHover": {
4640-
"message": "Throttle hover"
4664+
"message": "Throttle hover - <span class=\"message-negative\">IMPORTANT: set this value accurately</span>"
46414665
},
4642-
"failsafeGpsRescueItemAscendRate": {
4643-
"message": "Ascend rate (meters/second)"
4666+
"failsafeGpsRescueThrottleHoverHelp": {
4667+
"message": "To find the right value, set the Failsafe switch action to Stage 2, set the Stage 2 Failsafe Procedure to Land, and adjust the Throttle value used while landing until the quad hovers or descends slowly. Then set GPS Rescue Throttle Hover, and the Stage 1 Channel Fallback value for Throttle to this value."
46444668
},
4645-
"failsafeGpsRescueItemDescendRate": {
4646-
"message": "Descend rate (meters/second)"
4669+
"failsafeGpsRescueItemMinDth": {
4670+
"message": "Minimum distance to home (meters)"
4671+
},
4672+
"failsafeGpsRescueItemMinDthHelp": {
4673+
"message": "The minimum distance to home needed for GPS rescue to activate"
46474674
},
46484675
"failsafeGpsRescueItemMinSats": {
46494676
"message": "Minimum satellites"
46504677
},
46514678
"failsafeGpsRescueItemAllowArmingWithoutFix": {
4652-
"message": "Allow arming without fix - <span class=\"message-negative\">WARNING: the GPS Rescue will not be available</span>"
4679+
"message": "Allow arming without fix - <span class=\"message-negative\">WARNING: No fix = disarm on failsafe!</span>"
46534680
},
4654-
"failsafeGpsRescueItemAltitudeMode": {
4655-
"message": "Altitude mode"
4656-
},
4657-
"failsafeGpsRescueItemAltitudeModeMaxAlt": {
4658-
"message": "Maximum altitude"
4659-
},
4660-
"failsafeGpsRescueItemAltitudeModeFixedAlt": {
4661-
"message": "Fixed altitude"
4662-
},
4663-
"failsafeGpsRescueItemAltitudeModeCurrentAlt": {
4664-
"message": "Current altitude"
4681+
"failsafeGpsRescueArmWithoutFixHelp": {
4682+
"message": "Not recommended. Permits arming without a Home point being set, but the quad will disarm and crash with a true Rx loss failsafe. If tested with a switch, there is a short Do Nothing period before the disarm."
46654683
},
46664684
"failsafeGpsRescueItemSanityChecks": {
46674685
"message": "Sanity checks"
@@ -5107,7 +5125,7 @@
51075125
"message": "Custom image:"
51085126
},
51095127
"osdSetupCustomLogoInfoImageSize": {
5110-
"message": "Size must be $t(logoWidthPx)×$t(logoHeightPx) pixels"
5128+
"message": "Size must be $t(logoWidthPx)x$t(logoHeightPx) pixels"
51115129
},
51125130
"osdSetupCustomLogoInfoColorMap": {
51135131
"message": "Must contain green, black and white pixels"
@@ -5116,7 +5134,7 @@
51165134
"message": "Click <b>$t(osdSetupUploadFont.message)</b> to persist custom logo"
51175135
},
51185136
"osdSetupCustomLogoImageSizeError": {
5119-
"message": "Invalid image size: {{width}}×{{height}} (expected $t(logoWidthPx)×$t(logoHeightPx))"
5137+
"message": "Invalid image size: {{width}}x{{height}} (expected $t(logoWidthPx)×$t(logoHeightPx))"
51205138
},
51215139
"osdSetupCustomLogoColorMapError": {
51225140
"message": "The image contains an invalid pixel: rgb({{valueR}}, {{valueG}}, {{valueB}}) at coordinates {{posX}}×{{posY}}"

src/js/fc.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,9 @@ const FC = {
578578

579579
this.GPS_RESCUE = {
580580
angle: 0,
581-
initialAltitudeM: 0,
581+
returnAltitudeM: 0,
582582
descentDistanceM: 0,
583-
rescueGroundspeed: 0,
583+
groundSpeed: 0,
584584
throttleMin: 0,
585585
throttleMax: 0,
586586
throttleHover: 0,
@@ -590,7 +590,8 @@ const FC = {
590590
descendRate: 0,
591591
allowArmingWithoutFix: 0,
592592
altitudeMode: 0,
593-
minRescueDth: 0,
593+
minStartDistM: 0,
594+
initialClimbM: 0,
594595
};
595596

596597
this.RXFAIL_CONFIG = [];

src/js/msp/MSPHelper.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
514514
break;
515515
case MSPCodes.MSP_GPS_RESCUE:
516516
FC.GPS_RESCUE.angle = data.readU16();
517-
FC.GPS_RESCUE.initialAltitudeM = data.readU16();
517+
FC.GPS_RESCUE.returnAltitudeM = data.readU16();
518518
FC.GPS_RESCUE.descentDistanceM = data.readU16();
519-
FC.GPS_RESCUE.rescueGroundspeed = data.readU16();
519+
FC.GPS_RESCUE.groundSpeed = data.readU16();
520520
FC.GPS_RESCUE.throttleMin = data.readU16();
521521
FC.GPS_RESCUE.throttleMax = data.readU16();
522522
FC.GPS_RESCUE.throttleHover = data.readU16();
@@ -529,7 +529,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
529529
FC.GPS_RESCUE.altitudeMode = data.readU8();
530530
}
531531
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
532-
FC.GPS_RESCUE.minRescueDth = data.readU16();
532+
FC.GPS_RESCUE.minStartDistM = data.readU16();
533+
}
534+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
535+
FC.GPS_RESCUE.initialClimbM = data.readU16();
533536
}
534537
break;
535538
case MSPCodes.MSP_RSSI_CONFIG:
@@ -1797,9 +1800,9 @@ MspHelper.prototype.crunch = function(code, modifierCode = undefined) {
17971800
break;
17981801
case MSPCodes.MSP_SET_GPS_RESCUE:
17991802
buffer.push16(FC.GPS_RESCUE.angle)
1800-
.push16(FC.GPS_RESCUE.initialAltitudeM)
1803+
.push16(FC.GPS_RESCUE.returnAltitudeM)
18011804
.push16(FC.GPS_RESCUE.descentDistanceM)
1802-
.push16(FC.GPS_RESCUE.rescueGroundspeed)
1805+
.push16(FC.GPS_RESCUE.groundSpeed)
18031806
.push16(FC.GPS_RESCUE.throttleMin)
18041807
.push16(FC.GPS_RESCUE.throttleMax)
18051808
.push16(FC.GPS_RESCUE.throttleHover)
@@ -1813,7 +1816,10 @@ MspHelper.prototype.crunch = function(code, modifierCode = undefined) {
18131816
.push8(FC.GPS_RESCUE.altitudeMode);
18141817
}
18151818
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
1816-
buffer.push16(FC.GPS_RESCUE.minRescueDth);
1819+
buffer.push16(FC.GPS_RESCUE.minStartDistM);
1820+
}
1821+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
1822+
buffer.push16(FC.GPS_RESCUE.initialClimbM);
18171823
}
18181824
break;
18191825
case MSPCodes.MSP_SET_RSSI_CONFIG:

src/js/tabs/failsafe.js

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ failsafe.initialize = function (callback) {
269269

270270
// Load GPS Rescue parameters
271271
$('input[name="gps_rescue_angle"]').val(FC.GPS_RESCUE.angle);
272-
$('input[name="gps_rescue_initial_altitude"]').val(FC.GPS_RESCUE.initialAltitudeM);
272+
$('input[name="gps_rescue_return_altitude"]').val(FC.GPS_RESCUE.returnAltitudeM);
273273
$('input[name="gps_rescue_descent_distance"]').val(FC.GPS_RESCUE.descentDistanceM);
274-
$('input[name="gps_rescue_ground_speed"]').val((FC.GPS_RESCUE.rescueGroundspeed / 100).toFixed(2));
274+
$('input[name="gps_rescue_ground_speed"]').val((FC.GPS_RESCUE.groundSpeed / 100).toFixed(1));
275275
$('input[name="gps_rescue_throttle_min"]').val(FC.GPS_RESCUE.throttleMin);
276276
$('input[name="gps_rescue_throttle_max"]').val(FC.GPS_RESCUE.throttleMax);
277277
$('input[name="gps_rescue_throttle_hover"]').val(FC.GPS_RESCUE.throttleHover);
@@ -284,8 +284,8 @@ failsafe.initialize = function (callback) {
284284
$('#failsafeGpsRescueItemAltitudeSelect').sortSelect();
285285

286286
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
287-
$('input[name="gps_rescue_ascend_rate"]').val((FC.GPS_RESCUE.ascendRate / 100).toFixed(2));
288-
$('input[name="gps_rescue_descend_rate"]').val((FC.GPS_RESCUE.descendRate / 100).toFixed(2));
287+
$('input[name="gps_rescue_ascend_rate"]').val((FC.GPS_RESCUE.ascendRate / 100).toFixed(1));
288+
$('input[name="gps_rescue_descend_rate"]').val((FC.GPS_RESCUE.descendRate / 100).toFixed(1));
289289
$('input[name="gps_rescue_allow_arming_without_fix"]').prop('checked', FC.GPS_RESCUE.allowArmingWithoutFix > 0);
290290
$('select[name="gps_rescue_altitude_mode"]').val(FC.GPS_RESCUE.altitudeMode);
291291
} else {
@@ -296,18 +296,36 @@ failsafe.initialize = function (callback) {
296296
}
297297

298298
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
299-
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
300-
$('input[name="gps_rescue_min_dth"]').attr("min", 10);
301-
} else if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
302-
$('input[name="gps_rescue_min_dth"]').attr("min", 20);
303-
}
304-
305-
$('input[name="gps_rescue_min_dth"]').val(FC.GPS_RESCUE.minRescueDth);
299+
$('input[name="gps_rescue_min_start_dist"]').val(FC.GPS_RESCUE.minStartDistM);
306300
} else {
307-
$('input[name="gps_rescue_min_dth"]').closest('.number').hide();
301+
$('input[name="gps_rescue_min_start_dist"]').closest('.number').hide();
308302
}
309303

304+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
305+
$('input[name="gps_rescue_angle"]').attr("max", 80);
306+
$('input[name="gps_rescue_return_altitude"]').attr({"min": 2, "max": 255});
307+
$('input[name="gps_rescue_descent_distance"]').attr("min", 5);
308+
$('input[name="gps_rescue_min_start_dist"]').attr("min", 20);
309+
$('input[name="gps_rescue_ground_speed"]').attr("min", 0.0);
310+
$('input[name="gps_rescue_ascend_rate"]').attr("min", 0.5);
311+
$('input[name="gps_rescue_descend_rate"]').attr("min", 0.3);
312+
}
310313

314+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
315+
$('input[name="gps_rescue_initial_climb"]').val(FC.GPS_RESCUE.initialClimbM);
316+
} else {
317+
$('input[name="gps_rescue_initial_climb"]').closest('.number').hide();
318+
}
319+
320+
// Update attributes for API version 4.5
321+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
322+
$('input[name="gps_rescue_angle"]').attr({"min": 30, "max": 60});
323+
$('input[name="gps_rescue_return_altitude"]').attr({"min": 5, "max": 1000});
324+
$('input[name="gps_rescue_descent_distance"]').attr("min", 10);
325+
$('input[name="gps_rescue_min_start_dist"]').attr({"min": 10, "max": 30})
326+
.closest('.number').children('.helpicon').attr("i18n_title", i18n.getMessage("failsafeGpsRescueItemMinStartDistHelp"));
327+
$('input[name="gps_rescue_descend_rate"]').attr({"min": 0.2, "max": 50.0});
328+
}
311329

312330
$('a.save').click(function () {
313331
// gather data that doesn't have automatic change event bound
@@ -334,9 +352,9 @@ failsafe.initialize = function (callback) {
334352

335353
// Load GPS Rescue parameters
336354
FC.GPS_RESCUE.angle = $('input[name="gps_rescue_angle"]').val();
337-
FC.GPS_RESCUE.initialAltitudeM = $('input[name="gps_rescue_initial_altitude"]').val();
355+
FC.GPS_RESCUE.returnAltitudeM = $('input[name="gps_rescue_return_altitude"]').val();
338356
FC.GPS_RESCUE.descentDistanceM = $('input[name="gps_rescue_descent_distance"]').val();
339-
FC.GPS_RESCUE.rescueGroundspeed = $('input[name="gps_rescue_ground_speed"]').val() * 100;
357+
FC.GPS_RESCUE.groundSpeed = $('input[name="gps_rescue_ground_speed"]').val() * 100;
340358
FC.GPS_RESCUE.throttleMin = $('input[name="gps_rescue_throttle_min"]').val();
341359
FC.GPS_RESCUE.throttleMax = $('input[name="gps_rescue_throttle_max"]').val();
342360
FC.GPS_RESCUE.throttleHover = $('input[name="gps_rescue_throttle_hover"]').val();
@@ -351,7 +369,11 @@ failsafe.initialize = function (callback) {
351369
}
352370

353371
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
354-
FC.GPS_RESCUE.minRescueDth = $('input[name="gps_rescue_min_dth"]').val();
372+
FC.GPS_RESCUE.minStartDistM = $('input[name="gps_rescue_min_start_dist"]').val();
373+
}
374+
375+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
376+
FC.GPS_RESCUE.initialClimbM = $('input[name="gps_rescue_initial_climb"]').val();
355377
}
356378

357379
function save_failssafe_config() {

src/js/tabs/gps.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ gps.initialize = async function (callback) {
185185
const lat = FC.GPS_DATA.lat / 10000000;
186186
const lon = FC.GPS_DATA.lon / 10000000;
187187
const url = `https://maps.google.com/?q=${lat},${lon}`;
188-
const heading = hasMag ? Math.atan2(FC.SENSOR_DATA.magnetometer[1], FC.SENSOR_DATA.magnetometer[0]) : undefined;
189-
const headingDeg = heading === undefined ? 0 : heading * 180 / Math.PI;
188+
const magHeading = hasMag ? Math.atan2(FC.SENSOR_DATA.magnetometer[1], FC.SENSOR_DATA.magnetometer[0]) : undefined;
189+
const magHeadingDeg = magHeading === undefined ? 0 : magHeading * 180 / Math.PI;
190+
const gpsHeading = FC.GPS_DATA.ground_course / 100;
190191
const gnssArray = ['GPS', 'SBAS', 'Galileo', 'BeiDou', 'IMES', 'QZSS', 'Glonass'];
191192
const qualityArray = ['gnssQualityNoSignal', 'gnssQualitySearching', 'gnssQualityAcquired', 'gnssQualityUnusable', 'gnssQualityLocked',
192193
'gnssQualityFullyLocked', 'gnssQualityFullyLocked', 'gnssQualityFullyLocked'];
@@ -199,8 +200,8 @@ gps.initialize = async function (callback) {
199200

200201
const gspUnitText = i18n.getMessage('gpsPositionUnit');
201202
$('.GPS_info td.alt').text(`${alt} m`);
202-
$('.GPS_info td.latLon a').prop('href', url).text(`${lat.toFixed(4)} deg / ${lon.toFixed(4)} deg`);
203-
$('.GPS_info td.heading').text(`${headingDeg.toFixed(4)} ${gspUnitText}`);
203+
$('.GPS_info td.latLon a').prop('href', url).text(`${lat.toFixed(4)} / ${lon.toFixed(4)} ${gspUnitText}`);
204+
$('.GPS_info td.heading').text(`${magHeadingDeg.toFixed(4)} / ${gpsHeading.toFixed(4)} ${gspUnitText}`);
204205
$('.GPS_info td.speed').text(`${FC.GPS_DATA.speed} cm/s`);
205206
$('.GPS_info td.sats').text(FC.GPS_DATA.numSat);
206207
$('.GPS_info td.distToHome').text(`${FC.GPS_DATA.distanceToHome} m`);
@@ -296,7 +297,7 @@ gps.initialize = async function (callback) {
296297
action: 'center',
297298
lat: lat,
298299
lon: lon,
299-
heading: heading,
300+
heading: magHeading,
300301
};
301302

302303
frame = document.getElementById('map');

0 commit comments

Comments
 (0)