Skip to content

Commit

Permalink
Enforce OSD option
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Nov 17, 2024
1 parent 4fa100f commit f786bdc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
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
17 changes: 17 additions & 0 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,19 @@ firmware_flasher.initialize = function (callback) {
return;
}

data.osdProtocols = [
{ name: 'None', value: 'No OSD' },
{ name: 'FrSky', value: 'USE_FRSKYOSD' },
{ name: 'High Definition', value: 'USE_OSD_HD' },
{ name: 'MAX7456', value: 'USE_OSD_SD' },
];

// remove osdProtocols from generalOptions
data.generalOptions = data.generalOptions.filter(option => option.value !== 'USE_FRSKYOSD' && option.value !== 'USE_OSD_SD' && option.value !== 'USE_OSD_HD');

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 +451,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 +534,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 @@ -836,6 +849,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

0 comments on commit f786bdc

Please sign in to comment.