Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom osd msg support from external device #4281

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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