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

Merge pull request #1017 from etracer65/osd_stats_reorder

Reorder OSD stats selections to match on-screen display order
This commit is contained in:
Michael Keller 2018-05-12 12:00:11 +12:00 committed by GitHub
commit cf6d8bf706
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -835,7 +835,7 @@ OSD.constants = {
desc: 'osdDescStatRtcDateTime'
},
STAT_BATTERY: {
name: 'STAT_BATTERY',
name: 'BATTERY_VOLTAGE',
desc: 'osdDescStatBattery'
}
},
@ -1002,9 +1002,19 @@ OSD.chooseFields = function () {
];
}
// Choose ststistic fields
// Choose statistic fields
// Nothing much to do here, I'm preempting there being new statistics
F = OSD.constants.ALL_STATISTIC_FIELDS;
// ** IMPORTANT **
//
// Starting with 1.39.0 (Betaflight 3.4) the OSD stats selection options
// are ordered in the same sequence as displayed on-screen in the OSD.
// If future versions of the firmware implement changes to the on-screen ordering,
// that needs to be implemented here as well. Simply appending new stats does not
// require a completely new section for the version - only reordering.
if (semver.lt(CONFIG.apiVersion, "1.39.0")) {
OSD.constants.STATISTIC_FIELDS = [
F.MAX_SPEED,
F.MIN_BATTERY,
@ -1023,11 +1033,24 @@ OSD.chooseFields = function () {
OSD.constants.STATISTIC_FIELDS = OSD.constants.STATISTIC_FIELDS.concat([
F.RTC_DATE_TIME
]);
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
OSD.constants.STATISTIC_FIELDS = OSD.constants.STATISTIC_FIELDS.concat([
F.STAT_BATTERY
]);
}
} else { // Starting with 1.39.0 OSD stats are reordered to match how they're presented on screen
OSD.constants.STATISTIC_FIELDS = [
F.RTC_DATE_TIME,
F.TIMER_1,
F.TIMER_2,
F.MAX_SPEED,
F.MAX_DISTANCE,
F.MIN_BATTERY,
F.END_BATTERY,
F.STAT_BATTERY,
F.MIN_RSSI,
F.MAX_CURRENT,
F.USED_MAH,
F.MAX_ALTITUDE,
F.BLACKBOX,
F.BLACKBOX_LOG_NUMBER
];
}
// Choose warnings