Watt Hours Consumed OSD element and post Flight Stat

A feature request was made to implement watt hour consumed on the osd.
This allows pilots who prefer reading Wh over other battery stats can
judge battery consumption.
10.9-maintenance
Jon Mahoney 2022-07-15 17:29:02 -04:00
parent b7d1ec0837
commit 8bc93fdd7e
2 changed files with 30 additions and 0 deletions

View File

@ -4925,6 +4925,13 @@
"osdDescElementMahDrawn": { "osdDescElementMahDrawn": {
"message": "Total battery capacity used" "message": "Total battery capacity used"
}, },
"osdTextElementWhDrawn": {
"message": "Battery current Wh drawn",
"description": "One of the elements of the OSD"
},
"osdDescElementWhDrawn": {
"message": "Total battery capacity used in Wh"
},
"osdTextElementCraftName": { "osdTextElementCraftName": {
"message": "Craft name", "message": "Craft name",
"description": "One of the elements of the OSD" "description": "One of the elements of the OSD"
@ -5400,6 +5407,13 @@
"osdDescStatUsedMah": { "osdDescStatUsedMah": {
"message": "Battery capacity used" "message": "Battery capacity used"
}, },
"osdTextStatUsedWh": {
"message": "Battery Wh used",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatUsedWh": {
"message": "Battery capacity used in Wh"
},
"osdTextStatMaxAltitude": { "osdTextStatMaxAltitude": {
"message": "Altitude maximum", "message": "Altitude maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD" "description": "One of the statistics that can be shown at the end of the flight in the OSD"

View File

@ -721,6 +721,15 @@ OSD.loadDisplayFields = function() {
return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36) ? ` 690${FONT.symbol(SYM.MAH)}` : `${FONT.symbol(SYM.MAH)}690`; return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36) ? ` 690${FONT.symbol(SYM.MAH)}` : `${FONT.symbol(SYM.MAH)}690`;
}, },
}, },
WH_DRAWN: {
name: 'WH_DRAWN',
text: 'osdTextElementWhDrawn',
desc: 'osdDescElementWhDrawn',
defaultPosition: -1,
draw_order: 145,
positionable: true,
preview: '1.10 WH',
},
CRAFT_NAME: { CRAFT_NAME: {
name: 'CRAFT_NAME', name: 'CRAFT_NAME',
text: 'osdTextElementCraftName', text: 'osdTextElementCraftName',
@ -1352,6 +1361,11 @@ OSD.constants = {
text: 'osdTextStatUsedMah', text: 'osdTextStatUsedMah',
desc: 'osdDescStatUsedMah', desc: 'osdDescStatUsedMah',
}, },
USED_WH: {
name: 'USED_WH',
text: 'osdTextStatUsedWh',
desc: 'osdDescStatUsedWh',
},
MAX_ALTITUDE: { MAX_ALTITUDE: {
name: 'MAX_ALTITUDE', name: 'MAX_ALTITUDE',
text: 'osdTextStatMaxAltitude', text: 'osdTextStatMaxAltitude',
@ -1624,6 +1638,7 @@ OSD.chooseFields = function() {
F.VTX_CHANNEL, F.VTX_CHANNEL,
F.CURRENT_DRAW, F.CURRENT_DRAW,
F.MAH_DRAWN, F.MAH_DRAWN,
F.WH_DRAWN,
F.GPS_SPEED, F.GPS_SPEED,
F.GPS_SATS, F.GPS_SATS,
F.ALTITUDE, F.ALTITUDE,
@ -1791,6 +1806,7 @@ OSD.chooseFields = function() {
F.MAX_ALTITUDE, F.MAX_ALTITUDE,
F.BLACKBOX, F.BLACKBOX,
F.BLACKBOX_LOG_NUMBER, F.BLACKBOX_LOG_NUMBER,
F.USED_WH,
]; ];
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
OSD.constants.STATISTIC_FIELDS = OSD.constants.STATISTIC_FIELDS.concat([ OSD.constants.STATISTIC_FIELDS = OSD.constants.STATISTIC_FIELDS.concat([