Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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": "This Radio Protocol has Telemetry 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
31 changes: 31 additions & 0 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,33 @@ 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 +235,8 @@ firmware_flasher.initialize = function (callback) {
if (!self.validateBuildKey()) {
preselectRadioProtocolFromStorage();
}

toggleTelemetryProtocolInfo();
}

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

toggleTelemetryProtocolInfo();
});

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