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

Enforce OSD option #4251

Merged
merged 6 commits into from
Nov 18, 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
6 changes: 6 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7409,6 +7409,9 @@
"firmwareFlasherBuildMotorProtocols": {
"message": "Motor Protocol"
},
"firmwareFlasherBuildOsdProtocols": {
"message": "OSD Protocol"
},
"firmwareFlasherConfigurationFile": {
"message": "Configuration Filename:"
},
Expand All @@ -7427,6 +7430,9 @@
"firmwareFlasherMotorProtocolDescription": {
"message": "Select the motor (ESC) protocol you would like included in this build. Note this is a drop down, but only one item may be selected."
},
"firmwareFlasherOsdProtocolDescription": {
"message": "Select the OSD protocol you would like included in this build. Note this is a drop down, but only one item may be selected."
},
"firmwareFlasherBranchDescription": {
"message": "Especially useful for developers, you can select a merged PR, specify a commit sha, or specify a 'yet to be merged' PR by typing in a # followed by the PR number e.g. #1234 (this is shorthand for the branch 'pull/1234/head')."
},
Expand Down
22 changes: 22 additions & 0 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,24 @@ firmware_flasher.initialize = function (callback) {
return;
}

// extract osd protocols from general options and add to osdProtocols
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: ''});

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

buildOptionsList($('select[name="radioProtocols"]'), data.radioProtocols);
buildOptionsList($('select[name="telemetryProtocols"]'), data.telemetryProtocols);
buildOptionsList($('select[name="osdProtocols"]'), data.osdProtocols);
buildOptionsList($('select[name="options"]'), data.generalOptions);
buildOptionsList($('select[name="motorProtocols"]'), data.motorProtocols);

Expand Down Expand Up @@ -440,6 +456,7 @@ firmware_flasher.initialize = function (callback) {
}

$('select[name="board"]').select2();
$('select[name="osdProtocols"]').select2();
$('select[name="radioProtocols"]').select2();
$('select[name="telemetryProtocols"]').select2();
$('select[name="motorProtocols"]').select2();
Expand Down Expand Up @@ -522,6 +539,7 @@ firmware_flasher.initialize = function (callback) {
'select[name="board"]',
'select[name="radioProtocols"]',
'select[name="telemetryProtocols"]',
'select[name="osdProtocols"]',
'select[name="motorProtocols"]',
'select[name="options"]',
'select[name="commits"]',
Expand Down Expand Up @@ -837,6 +855,10 @@ firmware_flasher.initialize = function (callback) {
request.options.push($(this).val());
});

$('select[name="osdProtocols"] option:selected').each(function () {
request.options.push($(this).val());
});

$('select[name="motorProtocols"] option:selected').each(function () {
request.options.push($(this).val());
});
Expand Down
20 changes: 16 additions & 4 deletions src/tabs/firmware_flasher.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@
<div class="spacer hide-in-core-build-mode">
<div class="grid-box col2">
<div class="select-group">
<strong i18n="firmwareFlasherBuildOptions"></strong>
<div id="optionsInfo" class="build-options-wrapper">
<select id="options" name="options" multiple="multiple" class="select2">
<strong i18n="firmwareFlasherBuildOsdProtocols"></strong>
<div id="osdProtocolInfo" class="build-options-wrapper">
<select id="osdProtocols" name="osdProtocols" class="select2">
</select>
<div class="helpicon cf_tip_wide" i18n_title="firmwareFlasherOptionsDescription"></div>
<div class="helpicon cf_tip_wide" i18n_title="firmwareFlasherOsdProtocolDescription"></div>
</div>
</div>
<div class="select-group">
Expand All @@ -189,6 +189,18 @@
</div>
</div>
</div>
<div class="spacer hide-in-core-build-mode">
<div class="grid-box col2">
<div class="select-group">
<strong i18n="firmwareFlasherBuildOptions"></strong>
<div id="optionsInfo" class="build-options-wrapper">
<select id="options" name="options" multiple="multiple" class="select2">
</select>
<div class="helpicon cf_tip_wide" i18n_title="firmwareFlasherOptionsDescription"></div>
</div>
</div>
</div>
</div>
<div class="expertOptions spacer hide-in-core-build-mode">
<div class="grid-box col2">
<div class="select-group">
Expand Down