Skip to content

Commit

Permalink
Merge pull request #2229 from iNavFlight/MrD_Fix-OSD-preview-after-pr…
Browse files Browse the repository at this point in the history
…ecision-change

Fix OSD previews for diatance precision
  • Loading branch information
MrD-RC authored Nov 4, 2024
2 parents 0141e9d + 11cae6c commit d95cb83
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -500,6 +512,8 @@ function osdDecimalsDistancePreview() {
s += FONT.symbol(SYM.DIST_KM);
}

s = FONT.symbol(prependedSymbol) + s;

return s;
}

Expand Down Expand Up @@ -925,7 +939,7 @@ OSD.constants = {
{
name: 'REMAINING_FLIGHT_DISTANCE',
id: 49,
preview: osdDecimalsDistancePreview,
preview: osdDecimalsRemainingFlightDistancePreview,
},
{
name: 'THROTTLE_POSITION',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit d95cb83

Please sign in to comment.