Skip to content

Commit

Permalink
Use groupedName and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Nov 18, 2024
1 parent 79a6519 commit 2eb1e48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,17 @@ firmware_flasher.initialize = function (callback) {
}

// extract osd protocols from general options and add to osdProtocols
data.osdProtocols = data.generalOptions.filter(option => option.group === 'OSD');
data.osdProtocols = data.generalOptions
.filter(option => option.group === 'OSD')
.map(option => {
option.name = option.groupedName;
option.default = self.cloudBuildOptions.includes(option.value);
return option;
});

// add None option to osdProtocols as first option
data.osdProtocols.unshift({name: 'None', value: ''});
// pre select osd option when found in general options after auto detect
if (self.cloudBuildOptions) {
data.osdProtocols.forEach((option) => {
option.default = self.cloudBuildOptions.includes(option.value);
});
}
console.log(data.osdProtocols);

// remove osdProtocols from generalOptions
data.generalOptions = data.generalOptions.filter(option => !option.group);
Expand Down

0 comments on commit 2eb1e48

Please sign in to comment.