Merge pull request #558 from DieHertz/add-runcam-split-support

Add RunCam Split support
10.3.x-maintenance
Andrey Mironov 2017-07-19 17:20:01 +03:00 committed by GitHub
commit fbffdb2d31
4 changed files with 40 additions and 2 deletions

View File

@ -824,6 +824,9 @@
"portsFunction_IRC_TRAMP": {
"message": "IRC Tramp"
},
"portsFunction_RUNCAM_SPLIT_CONTROL": {
"message": "RunCam Split"
},
"pidTuningUpgradeFirmwareToChangePidController": {
"message": "<span style=\"color: red\">Changing PID controller disabled - you can change it via the CLI.</span> You have firmware with API version <span style=\"color: red\">$1</span>, but this functionality requires requires <span style=\"color: #ffbb00\">$2</span>."
},

View File

@ -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
};
}

View File

@ -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;

View File

@ -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);
}