1
0
Fork 0
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:
nathan 2016-09-19 23:43:35 -07:00
parent 5965bc7e1f
commit 6ee14fb848

View file

@ -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);
}
}
};