1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-25 17:25:16 +03:00

Merge pull request #2146 from haslinghuis/feature-osd-unit-british

This commit is contained in:
Michael Keller 2020-08-25 01:26:06 +12:00 committed by GitHub
commit 6370a0153c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View file

@ -4291,6 +4291,10 @@
"message": "Metric", "message": "Metric",
"description": "Option for the units system used in the OSD" "description": "Option for the units system used in the OSD"
}, },
"osdSetupUnitsOptionBritish": {
"message": "British",
"description": "Option for the units system used in the OSD"
},
"osdSetupTimersTitle": { "osdSetupTimersTitle": {
"message": "Timers" "message": "Timers"
}, },

View file

@ -339,6 +339,7 @@ OSD.generateTemperaturePreview = function (osd_data, temperature) {
preview += Math.floor(temperature) + FONT.symbol(SYM.TEMP_F); preview += Math.floor(temperature) + FONT.symbol(SYM.TEMP_F);
break; break;
case 1: case 1:
case 2:
preview += temperature + FONT.symbol(SYM.TEMP_C); preview += temperature + FONT.symbol(SYM.TEMP_C);
break; break;
} }
@ -650,7 +651,8 @@ OSD.loadDisplayFields = function() {
draw_order: 160, draw_order: 160,
positionable: true, positionable: true,
preview: function (osd_data) { preview: function (osd_data) {
return FONT.symbol(SYM.ALTITUDE) + '399.7' + FONT.symbol(osd_data.unit_mode === 0 ? SYM.FEET : SYM.METRE); const unit = FONT.symbol(osd_data.unit_mode === 0 ? SYM.FEET : SYM.METRE);
return `${FONT.symbol(SYM.ALTITUDE)}399.7${unit}`;
} }
}, },
ONTIME: { ONTIME: {
@ -686,7 +688,8 @@ OSD.loadDisplayFields = function() {
draw_order: 810, draw_order: 810,
positionable: true, positionable: true,
preview: function (osd_data) { preview: function (osd_data) {
return FONT.symbol(SYM.SPEED) + ' 40' + (osd_data.unit_mode === 0 ? FONT.symbol(SYM.MPH) : FONT.symbol(SYM.KPH)); const unit = FONT.symbol(osd_data.unit_mode === 0 || osd_data.unit_mode === 1 ? SYM.MPH : SYM.KPH);
return `${FONT.symbol(SYM.SPEED)}40${unit}`;
} }
}, },
GPS_SATS: { GPS_SATS: {
@ -841,7 +844,8 @@ OSD.loadDisplayFields = function() {
draw_order: 840, draw_order: 840,
positionable: true, positionable: true,
preview: function (osd_data) { preview: function (osd_data) {
return FONT.symbol(SYM.HOMEFLAG) + '432' + FONT.symbol(osd_data.unit_mode === 0 ? SYM.FEET : SYM.METRE); const unit = FONT.symbol(osd_data.unit_mode === 0 ? SYM.FEET : SYM.METRE);
return `${FONT.symbol(SYM.HOMEFLAG)}432${unit}`;
} }
}, },
NUMERICAL_HEADING: { NUMERICAL_HEADING: {
@ -861,7 +865,8 @@ OSD.loadDisplayFields = function() {
draw_order: 300, draw_order: 300,
positionable: true, positionable: true,
preview: function (osd_data) { preview: function (osd_data) {
return FONT.symbol(SYM.ARROW_SMALL_UP) + '8.7' + (osd_data.unit_mode === 0 ? FONT.symbol(SYM.FTPS) : FONT.symbol(SYM.MPS)); const unit = FONT.symbol(osd_data.unit_mode === 0 ? SYM.FTPS : SYM.MPS);
return `${FONT.symbol(SYM.ARROW_SMALL_UP)}8.7${unit}`;
} }
}, },
COMPASS_BAR: { COMPASS_BAR: {
@ -1031,7 +1036,8 @@ OSD.loadDisplayFields = function() {
draw_order: 860, draw_order: 860,
positionable: true, positionable: true,
preview: function (osd_data) { preview: function (osd_data) {
return FONT.symbol(SYM.TOTAL_DIST) + '653' + FONT.symbol(osd_data.unit_mode === 0 ? SYM.FEET : SYM.METRE); const unit = FONT.symbol(osd_data.unit_mode === 0 ? SYM.FEET : SYM.METRE);
return `${FONT.symbol(SYM.TOTAL_DIST)}653${unit}`;
} }
}, },
STICK_OVERLAY_LEFT: { STICK_OVERLAY_LEFT: {
@ -1134,7 +1140,8 @@ OSD.loadDisplayFields = function() {
draw_order: 455, draw_order: 455,
positionable: true, positionable: true,
preview: function (osdData) { preview: function (osdData) {
return `1234${FONT.symbol(SYM.MAH)}/${FONT.symbol(osdData.unit_mode === 0 ? SYM.MILES : SYM.KM)}`; const unit = FONT.symbol(osdData.unit_mode === 0 ? SYM.MILES : SYM.KM);
return `1234${FONT.symbol(SYM.MAH)}/${unit}`;
}, },
}, },
@ -1158,7 +1165,8 @@ OSD.constants = {
}, },
UNIT_TYPES: [ UNIT_TYPES: [
'IMPERIAL', 'IMPERIAL',
'METRIC' 'METRIC',
'BRITISH',
], ],
TIMER_PRECISION: [ TIMER_PRECISION: [
'SECOND', 'SECOND',