diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 877e74cf..f935dc20 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -824,6 +824,9 @@ "portsFunction_IRC_TRAMP": { "message": "IRC Tramp" }, + "portsFunction_RUNCAM_SPLIT_CONTROL": { + "message": "RunCam Split" + }, "pidTuningUpgradeFirmwareToChangePidController": { "message": "Changing PID controller disabled - you can change it via the CLI. You have firmware with API version $1, but this functionality requires requires $2." }, diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index ab176852..e7acdb75 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -23,7 +23,8 @@ function MspHelper () { 'ESC_SENSOR': 10, 'TBS_SMARTAUDIO': 11, 'TELEMETRY_IBUS': 12, - 'IRC_TRAMP': 13 + 'IRC_TRAMP': 13, + 'RUNCAM_SPLIT_CONTROL': 14 // support communitate with RunCam Split }; } diff --git a/tabs/auxiliary.js b/tabs/auxiliary.js index 2dfcfc87..9585c241 100644 --- a/tabs/auxiliary.js +++ b/tabs/auxiliary.js @@ -24,11 +24,41 @@ TABS.auxiliary.initialize = function (callback) { MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges); + // return true if user has choose a special peripheral + function isPeripheralSelected(peripheralName) { + for (var portIndex = 0; portIndex < SERIAL_CONFIG.ports.length; portIndex++) { + var serialPort = SERIAL_CONFIG.ports[portIndex]; + if (serialPort.functions.indexOf(peripheralName) >= 0) { + return true; + } + } + + return false; + } + + function adjustRunCamSplitBoxNameWithModeID(modeId, originalModeName) { + switch (modeId) { + case 32: // BOXCAMERA1 + return "CAMERA WI-FI"; + case 33: // BOXCAMERA2 + return "CAMERA POWER"; + case 34: // BOXCAMERA3 + return "CAMERA CHANGE MODE" + default: + return originalModeName; + } + } + function createMode(modeIndex, modeId) { var modeTemplate = $('#tab-auxiliary-templates .mode'); var newMode = modeTemplate.clone(); var modeName = AUX_CONFIG[modeIndex]; + // if user choose the runcam split at peripheral column, then adjust the boxname(BOXCAMERA1, BOXCAMERA2, BOXCAMERA3) + if (isPeripheralSelected("RUNCAM_SPLIT_CONTROL")) { + modeName = adjustRunCamSplitBoxNameWithModeID(modeId, modeName); + } + $(newMode).attr('id', 'mode-' + modeIndex); $(newMode).find('.name').text(modeName); @@ -109,7 +139,7 @@ TABS.auxiliary.initialize = function (callback) { $(rangeElement).find('.channel').val(auxChannelIndex); } - + function process_html() { var auxChannelCount = RC.active_channels - 4; diff --git a/tabs/ports.js b/tabs/ports.js index 134249ad..c6ea8ad0 100644 --- a/tabs/ports.js +++ b/tabs/ports.js @@ -43,6 +43,10 @@ TABS.ports.initialize = function (callback, scrollPosition) { functionRules.push({ name: 'TELEMETRY_IBUS', groups: ['telemetry'], maxPorts: 1 }); } + if (semver.gte(CONFIG.apiVersion, "1.36.0")) { + functionRules.push({ name: 'RUNCAM_SPLIT_CONTROL', groups: ['peripherals'], maxPorts: 1 }); + } + for (var i = 0; i < functionRules.length; i++) { functionRules[i].displayName = chrome.i18n.getMessage('portsFunction_' + functionRules[i].name); }