Skip to content

Commit

Permalink
Hide telemetry protocols for CRSF, FPORT and GHST
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Jan 2, 2024
1 parent adf380c commit e3e83ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ firmware_flasher.initialize = function (callback) {
});
}

function toggleTelemetryProtocolInfo() {
const radioProtocol = $('select[name="radioProtocols"] option:selected').val();
// hide telemetry protocol info if telemetry is enabled by default on load
const hasTelemetryEnabledByDefault = radioProtocol.val() === 'USE_SERIALRX_CRSF' || radioProtocol.val() === 'USE_SERIALRX_FPORT' || radioProtocol.val() === 'USE_SERIALRX_GHST';

$('div.telemetryProtocolInfo').toggle(!hasTelemetryEnabledByDefault);
}

function buildOptions(data) {
if (!navigator.onLine) {
return;
Expand All @@ -198,9 +206,11 @@ firmware_flasher.initialize = function (callback) {
buildOptionsList($('select[name="options"]'), data.generalOptions);
buildOptionsList($('select[name="motorProtocols"]'), data.motorProtocols);

if (!self.validateBuildKey()) {
if (!self.validateBuildKey() && semver.lte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
preselectRadioProtocolFromStorage();
}

toggleTelemetryProtocolInfo();
}

function preselectRadioProtocolFromStorage() {
Expand Down Expand Up @@ -426,10 +436,14 @@ firmware_flasher.initialize = function (callback) {
});

$('select[name="radioProtocols"]').on("select2:select", function() {
const selectedProtocol = $('select[name="radioProtocols"] option:selected').first().val();
if (selectedProtocol) {
setConfig({"ffRadioProtocol" : selectedProtocol});
if (semver.lte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
const selectedProtocol = $('select[name="radioProtocols"] option:selected').first().val();
if (selectedProtocol) {
setConfig({"ffRadioProtocol" : selectedProtocol});
}
}

toggleTelemetryProtocolInfo();
});

$('select[name="board"]').on('change', function() {
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/firmware_flasher.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<div class="helpicon cf_tip_wide" i18n_title="firmwareFlasherRadioProtocolDescription"></div>
</div>
</div>
<div style="width: 49%; float: right;">
<div style="width: 49%; float: right;" class="telemetryProtocolInfo">
<strong i18n="firmwareFlasherBuildTelemetryProtocols"></strong>
<div id="telemetryProtocolInfo" class="build-options-wrapper">
<select id="telemetryProtocols" name="telemetryProtocols" class="select2">
Expand Down

0 comments on commit e3e83ca

Please sign in to comment.