From dfd12cd90d09215abb781b248c5c85d64cfe0cef Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Tue, 18 Jul 2023 13:48:26 +0200 Subject: [PATCH] Fix missing GPS Laptimer OSD elements (#3506) --- locales/en/messages.json | 21 +++++++++++++++++++++ src/js/tabs/osd.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/locales/en/messages.json b/locales/en/messages.json index a603603a..4372c5e8 100755 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -5298,6 +5298,27 @@ "osdDescElementSysFanSpeed": { "message": "Goggle fan speed rendered by the goggles" }, + "osdTextElementLapTimeCurrent": { + "message": "GPS lap time current", + "description": "One of the elements of the OSD" + }, + "osdDescElementLapTimeCurrent": { + "message": "Current GPS lap time" + }, + "osdTextElementLapTimePrevious": { + "message": "GPS lap time previous", + "description": "One of the elements of the OSD" + }, + "osdDescElementLapTimePrevious": { + "message": "Previous GPS lap time" + }, + "osdTextElementLapTimeBest3": { + "message": "GPS lap time best 3", + "description": "One of the elements of the OSD" + }, + "osdDescElementLapTimeBest": { + "message": "Best GPS lap time" + }, "osdTextElementCraftName": { "message": "Craft name", "description": "One of the elements of the OSD" diff --git a/src/js/tabs/osd.js b/src/js/tabs/osd.js index b12c2d49..e374fad0 100644 --- a/src/js/tabs/osd.js +++ b/src/js/tabs/osd.js @@ -1508,6 +1508,33 @@ OSD.loadDisplayFields = function() { positionable: true, preview: `F${FONT.symbol(SYM.TEMPERATURE)}5`, }, + GPS_LAP_TIME_CURRENT: { + name: 'GPS_LAP_TIME_CURRENT', + text: 'osdTextElementLapTimeCurrent', + desc: 'osdDescElementLapTimeCurrent', + defaultPosition: -1, + draw_order: 540, + positionable: true, + preview: '1:23.456', + }, + GPS_LAP_TIME_PREVIOUS: { + name: 'GPS_LAP_TIME_PREVIOUS', + text: 'osdTextElementLapTimePrevious', + desc: 'osdDescElementLapTimePrevious', + defaultPosition: -1, + draw_order: 545, + positionable: true, + preview: '1:23.456', + }, + GPS_LAP_TIME_BEST3: { + name: 'GPS_LAP_TIME_BEST3', + text: 'osdTextElementLapTimeBest3', + desc: 'osdDescElementLapTimeBest3', + defaultPosition: -1, + draw_order: 550, + positionable: true, + preview: '1:23.456', + }, }; }; @@ -1937,6 +1964,14 @@ OSD.chooseFields = function() { ]); } + if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) { + OSD.constants.DISPLAY_FIELDS = OSD.constants.DISPLAY_FIELDS.concat([ + F.GPS_LAP_TIME_CURRENT, + F.GPS_LAP_TIME_PREVIOUS, + F.GPS_LAP_TIME_BEST3, + ]); + } + // Choose statistic fields // Nothing much to do here, I'm preempting there being new statistics F = OSD.constants.ALL_STATISTIC_FIELDS;