Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Populate the list of OSD elements based on API response.
Browse files Browse the repository at this point in the history
This allows new elements to be added to the firmware and OSD and
supports users that upgrade from older firmware releases.
  • Loading branch information
hydra committed Oct 23, 2016
1 parent 0a49c14 commit f7d4188
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions tabs/osd_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ OSD.constants = {
{
id: 14,
name: 'callsign',
example_value: ':::CALLSIGN:::'
example_value: ':::CALLSIGN:::'
},

// motors
Expand Down Expand Up @@ -537,11 +537,34 @@ TABS.osd_layout.initialize = function (callback) {

FONT.initData();

for (let element of OSD_LAYOUT.elements) {
var element_defaults = find_element_defaults(element.id);
for (let element_id of OSD_ELEMENT_SUMMARY.supported_element_ids) {
var element_defaults = find_element_defaults(element_id);
if (!element_defaults) {
continue;
}

var element = null;

for (let candidate of OSD_LAYOUT.elements) {
if (candidate.id != element_id) {
continue;
}
element = candidate;
break;
}

if (!element) {
element = {
id: element_id,
initial_flag_mask: 0,
enabled: false,
positionable: true,
x: 0,
y: 0,
};
}

console.log(element);

var text_key = 'osdElement_' + element_defaults.name;

Expand Down

0 comments on commit f7d4188

Please sign in to comment.