Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OSD previews for diatance precision #2229

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading