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

Hide telemetry protocols for CRSF, FPORT and GHST #3726

Merged
merged 4 commits into from
Jan 5, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7338,6 +7338,9 @@
"firmwareFlasherTelemetryProtocolDescription": {
"message": "Select the telemetry protocol you would like included in this build. Note this is a drop down, but only one item maybe selected. There are also some telemetry protocols that will be enabled, regardless of your selection here based on the radio protocol selected, e.g. CRSF."
},
"firmwareFlasherOptionLabelTelemetryProtocolIncluded": {
"message": "Automatically Included"
},
"firmwareFlasherOptionsDescription": {
"message": "Select the generic options you would like included in this build. Note this is a drop down, and multiple items maybe selected. Such items as fixes, e.g. AKK VTX, are included here."
},
Expand Down
29 changes: 29 additions & 0 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,31 @@ firmware_flasher.initialize = function (callback) {
});
}

function toggleTelemetryProtocolInfo() {
const radioProtocol = $('select[name="radioProtocols"] option:selected').val();
const hasTelemetryEnabledByDefault = [
'USE_SERIALRX_CRSF',
'USE_SERIALRX_FPORT',
'USE_SERIALRX_GHST',
].includes(radioProtocol);

$('select[name="telemetryProtocols"]').attr('disabled', hasTelemetryEnabledByDefault);

if (hasTelemetryEnabledByDefault) {
if ($('select[name="telemetryProtocols"] option[value="-1"]').length === 0) {
$('select[name="telemetryProtocols"]').prepend($('<option>', {
value: '-1',
selected: 'selected',
text: i18n.getMessage('firmwareFlasherOptionLabelTelemetryProtocolIncluded'),
}));
} else {
$('select[name="telemetryProtocols"] option:first').attr('selected', 'selected').text(i18n.getMessage('firmwareFlasherOptionLabelTelemetryProtocolIncluded'));
}
} else if ($('select[name="telemetryProtocols"] option[value="-1"]').length) {
$('select[name="telemetryProtocols"] option:first').remove();
}
}

function buildOptions(data) {
if (!navigator.onLine) {
return;
Expand All @@ -208,6 +233,8 @@ firmware_flasher.initialize = function (callback) {
if (!self.validateBuildKey()) {
preselectRadioProtocolFromStorage();
}

toggleTelemetryProtocolInfo();
}

function preselectRadioProtocolFromStorage() {
Expand Down Expand Up @@ -435,6 +462,8 @@ firmware_flasher.initialize = function (callback) {
if (selectedProtocol) {
setConfig({"ffRadioProtocol" : selectedProtocol});
}

toggleTelemetryProtocolInfo();
});

$('select[name="board"]').on('change', function() {
Expand Down