From f786bdc42f7752e66595efb958b772411c1d6615 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Sun, 17 Nov 2024 21:45:51 +0100 Subject: [PATCH] Enforce OSD option --- locales/en/messages.json | 6 ++++++ src/js/tabs/firmware_flasher.js | 17 +++++++++++++++++ src/tabs/firmware_flasher.html | 20 ++++++++++++++++---- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 5436277292b..52a0c3a0b23 100755 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -7409,6 +7409,9 @@ "firmwareFlasherBuildMotorProtocols": { "message": "Motor Protocol" }, + "firmwareFlasherBuildOsdProtocols": { + "message": "OSD Protocol" + }, "firmwareFlasherConfigurationFile": { "message": "Configuration Filename:" }, @@ -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')." }, diff --git a/src/js/tabs/firmware_flasher.js b/src/js/tabs/firmware_flasher.js index 5410fd62bda..0198707d923 100644 --- a/src/js/tabs/firmware_flasher.js +++ b/src/js/tabs/firmware_flasher.js @@ -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); @@ -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(); @@ -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"]', @@ -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()); }); diff --git a/src/tabs/firmware_flasher.html b/src/tabs/firmware_flasher.html index db608481b84..a2bb7bc57e4 100644 --- a/src/tabs/firmware_flasher.html +++ b/src/tabs/firmware_flasher.html @@ -172,11 +172,11 @@
- -
- -
+
@@ -189,6 +189,18 @@
+
+
+
+ +
+ +
+
+
+
+