From 11cae6cdc2ace6fdfd9d14676d65860dcb332247 Mon Sep 17 00:00:00 2001 From: Mr D - RC Date: Mon, 4 Nov 2024 18:41:08 +0000 Subject: [PATCH] Fix OSD previews for diatance precision Fixed OSD previews for - Home distance - Remaining distance - Trip distance --- tabs/osd.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tabs/osd.js b/tabs/osd.js index 92e58ebb8..419095e74 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -482,7 +482,19 @@ function osdDecimalsAltitudePreview() { return s; } -function osdDecimalsDistancePreview() { +function osdDecimalsRemainingFlightDistancePreview() { + return osdDecimalsDistancePreview(SYM.FLIGHT_DIST_REMAINING); +} + +function osdDecimalsHomeDistancePreview() { + return osdDecimalsDistancePreview(SYM.HOME); +} + +function osdDecimalsTripDistancePreview() { + return osdDecimalsDistancePreview(SYM.TRIP_DIST); +} + +function osdDecimalsDistancePreview(prependedSymbol) { var s = '11.5'; if (Settings.getInputValue('osd_decimals_distance') == 4) { s+= '3'; @@ -500,6 +512,8 @@ function osdDecimalsDistancePreview() { s += FONT.symbol(SYM.DIST_KM); } + s = FONT.symbol(prependedSymbol) + s; + return s; } @@ -925,7 +939,7 @@ OSD.constants = { { name: 'REMAINING_FLIGHT_DISTANCE', id: 49, - preview: osdDecimalsDistancePreview, + preview: osdDecimalsRemainingFlightDistancePreview, }, { name: 'THROTTLE_POSITION', @@ -1628,13 +1642,13 @@ OSD.constants = { { name: 'DISTANCE_TO_HOME', id: 23, - preview: osdDecimalsDistancePreview, + preview: osdDecimalsHomeDistancePreview, }, { name: 'TRIP_DIST', id: 40, min_version: '1.9.1', - preview: osdDecimalsDistancePreview, + preview: osdDecimalsTripDistancePreview, }, { name: 'ODOMETER',