Skip to content

Commit

Permalink
Add custom osd msg support from external device (#4281)
Browse files Browse the repository at this point in the history
Add custom osd msg support
  • Loading branch information
haslinghuis authored Dec 22, 2024
1 parent 486b382 commit ad73674
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
33 changes: 32 additions & 1 deletion locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5596,7 +5596,38 @@
"message": "ASL without decimals",
"description": "One of the variants of the altitude element of the OSD"
},

"osdTextElementCustomMsg0": {
"message": "Custom message 1",
"description": "One of the elements of the OSD"
},
"osdTextElementCustomMsg1": {
"message": "Custom message 2",
"description": "One of the elements of the OSD"
},
"osdTextElementCustomMsg2": {
"message": "Custom message 3",
"description": "One of the elements of the OSD"
},
"osdTextElementCustomMsg3": {
"message": "Custom message 4",
"description": "One of the elements of the OSD"
},
"osdDescElementCustomMsg0": {
"message": "Custom message 1 from external device",
"description": "Description of the custom message 1 element of the OSD"
},
"osdDescElementCustomMsg1": {
"message": "Custom message 2 from external device",
"description": "Description of the custom message 2 element of the OSD"
},
"osdDescElementCustomMsg2": {
"message": "Custom message 3 from external device",
"description": "Description of the custom message 3 element of the OSD"
},
"osdDescElementCustomMsg3": {
"message": "Custom message 4 from external device",
"description": "Description of the custom message 4 element of the OSD"
},
"osdTextElementOnTime": {
"message": "On time",
"description": "One of the elements of the OSD"
Expand Down
40 changes: 40 additions & 0 deletions src/js/tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,42 @@ OSD.loadDisplayFields = function() {
positionable: true,
preview: 'DBG2 0 0 0 0',
},
CUSTOM_MSG0: {
name: 'CUSTOM_MSG1',
text: 'osdTextElementCustomMsg0',
desc: 'osdDescElementCustomMsg0',
defaultPosition: -1,
draw_order: 570,
positionable: true,
preview: 'CUSTOM MSG1',
},
CUSTOM_MSG1: {
name: 'CUSTOM_MSG2',
text: 'osdTextElementCustomMsg1',
desc: 'osdDescElementCustomMsg1',
defaultPosition: -1,
draw_order: 580,
positionable: true,
preview: 'CUSTOM MSG2',
},
CUSTOM_MSG2: {
name: 'CUSTOM_MSG3',
text: 'osdTextElementCustomMsg2',
desc: 'osdDescElementCustomMsg2',
defaultPosition: -1,
draw_order: 590,
positionable: true,
preview: 'CUSTOM MSG3',
},
CUSTOM_MSG3: {
name: 'CUSTOM_MSG4',
text: 'osdTextElementCustomMsg3',
desc: 'osdDescElementCustomMsg3',
defaultPosition: -1,
draw_order: 600,
positionable: true,
preview: 'CUSTOM MSG4',
},
};

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47) && have_sensor(FC.CONFIG.activeSensors, 'gps')) {
Expand Down Expand Up @@ -1972,6 +2008,10 @@ OSD.chooseFields = function() {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
OSD.constants.DISPLAY_FIELDS = OSD.constants.DISPLAY_FIELDS.concat([
F.DEBUG2,
F.CUSTOM_MSG0,
F.CUSTOM_MSG1,
F.CUSTOM_MSG2,
F.CUSTOM_MSG3,
]);
}
// Choose statistic fields
Expand Down

0 comments on commit ad73674

Please sign in to comment.