mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
update unit preview on every change
This commit is contained in:
parent
5965bc7e1f
commit
6ee14fb848
1 changed files with 4 additions and 8 deletions
12
tabs/osd.js
12
tabs/osd.js
|
@ -319,7 +319,9 @@ OSD.constants = {
|
|||
name: 'ALTITUDE',
|
||||
default_position: 62,
|
||||
positionable: true,
|
||||
preview: '13.7' + FONT.symbol(SYM.METRE)
|
||||
preview: function(osd_data) {
|
||||
return '13.7' + FONT.symbol(osd_data.unit_mode === 0 ? SYM.FEET : SYM.METRE)
|
||||
}
|
||||
}
|
||||
],
|
||||
};
|
||||
|
@ -374,16 +376,10 @@ OSD.msp = {
|
|||
index: j,
|
||||
position: v,
|
||||
positionable: c.positionable,
|
||||
preview: c.preview
|
||||
preview: typeof(c.preview) === 'function' ? c.preview(d) : c.preview
|
||||
});
|
||||
}
|
||||
OSD.updateDisplaySize();
|
||||
|
||||
// Update the altitude preview to reflect the unit system
|
||||
var altitude_index = OSD.constants.DISPLAY_FIELDS.map(function(item) { return item.name; }).indexOf('ALTITUDE');
|
||||
if (altitude_index >= 0) {
|
||||
OSD.constants.DISPLAY_FIELDS[altitude_index].preview = '13.7' + FONT.symbol(d.unit_mode == 0 ? SYM.FEET : SYM.METRE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue