Merge pull request #355 from mikeller/add_tbs_smartaudio

Added GUI support for TBS SmartAudio.
10.3.x-maintenance
borisbstyle 2017-01-03 09:40:56 +01:00 committed by GitHub
commit c4d72b620c
4 changed files with 44 additions and 27 deletions

View File

@ -762,8 +762,8 @@
"portsTelemetryOut": { "portsTelemetryOut": {
"message": "Telemetry Output" "message": "Telemetry Output"
}, },
"portsLogging": { "portsPeripherals": {
"message": "Logging" "message": "Peripherals"
}, },
"portsHelp": { "portsHelp": {
"message": "<strong>Note:</strong> not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset." "message": "<strong>Note:</strong> not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset."
@ -811,9 +811,11 @@
"message": "Serial RX" "message": "Serial RX"
}, },
"portsFunction_BLACKBOX": { "portsFunction_BLACKBOX": {
"message": "Blackbox" "message": "Blackbox logging"
},
"portsFunction_TBS_SMARTAUDIO": {
"message": "TBS SmartAudio"
}, },
"pidTuningUpgradeFirmwareToChangePidController": { "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>." "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

@ -20,7 +20,8 @@ function MspHelper () {
'RX_SERIAL': 6, 'RX_SERIAL': 6,
'BLACKBOX': 7, 'BLACKBOX': 7,
'TELEMETRY_MAVLINK': 9, 'TELEMETRY_MAVLINK': 9,
'ESC_SENSOR': 10 'ESC_SENSOR': 10,
'TBS_SMARTAUDIO': 11
}; };
} }

View File

@ -19,7 +19,7 @@
<td i18n="portsSerialRx"> <td i18n="portsSerialRx">
<td i18n="portsTelemetryOut"> <td i18n="portsTelemetryOut">
<td i18n="portsSensorIn"> <td i18n="portsSensorIn">
<td i18n="portsLogging"> <td i18n="portsPeripherals">
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -58,7 +58,7 @@
<td class="functionsCell-sensors"><select class="gps_baudrate"> <td class="functionsCell-sensors"><select class="gps_baudrate">
<!-- list generated here --> <!-- list generated here -->
</select></td> </select></td>
<td class="functionsCell-logging"><select class="blackbox_baudrate"> <td class="functionsCell-peripherals"><select class="blackbox_baudrate">
<!-- list generated here --> <!-- list generated here -->
</select></td> </select></td>
</tr> </tr>

View File

@ -10,29 +10,29 @@ TABS.ports.initialize = function (callback, scrollPosition) {
var functionRules = [ var functionRules = [
{name: 'MSP', groups: ['configuration', 'msp'], maxPorts: 2}, {name: 'MSP', groups: ['configuration', 'msp'], maxPorts: 2},
{name: 'GPS', groups: ['sensors'], maxPorts: 1}, {name: 'GPS', groups: ['sensors'], maxPorts: 1},
{name: 'TELEMETRY_FRSKY', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1}, {name: 'TELEMETRY_FRSKY', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1},
{name: 'TELEMETRY_HOTT', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1}, {name: 'TELEMETRY_HOTT', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1},
{name: 'TELEMETRY_SMARTPORT', groups: ['telemetry'], maxPorts: 1}, {name: 'TELEMETRY_SMARTPORT', groups: ['telemetry'], maxPorts: 1},
{name: 'RX_SERIAL', groups: ['rx'], maxPorts: 1}, {name: 'RX_SERIAL', groups: ['rx'], maxPorts: 1},
{name: 'BLACKBOX', groups: ['logging', 'blackbox'], sharableWith: ['msp'], notSharableWith: ['telemetry'], maxPorts: 1}, {name: 'BLACKBOX', groups: ['peripherals'], sharableWith: ['msp'], notSharableWith: ['telemetry'], maxPorts: 1}
]; ];
if (semver.gte(CONFIG.apiVersion, "1.15.0")) { if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
var ltmFunctionRule = {name: 'TELEMETRY_LTM', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1}; var ltmFunctionRule = {name: 'TELEMETRY_LTM', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1};
functionRules.push(ltmFunctionRule); functionRules.push(ltmFunctionRule);
} else { } else {
var mspFunctionRule = {name: 'TELEMETRY_MSP', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1}; var mspFunctionRule = {name: 'TELEMETRY_MSP', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1};
functionRules.push(mspFunctionRule); functionRules.push(mspFunctionRule);
} }
if (semver.gte(CONFIG.apiVersion, "1.18.0")) { if (semver.gte(CONFIG.apiVersion, "1.18.0")) {
var mavlinkFunctionRule = {name: 'TELEMETRY_MAVLINK', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1}; var mavlinkFunctionRule = {name: 'TELEMETRY_MAVLINK', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1};
functionRules.push(mavlinkFunctionRule); functionRules.push(mavlinkFunctionRule);
} }
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) { if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
var escTlmFunctionRule = {name: 'ESC_SENSOR', groups: ['sensors'], maxPorts: 1}; functionRules.push({ name: 'ESC_SENSOR', groups: ['sensors'], maxPorts: 1 });
functionRules.push(escTlmFunctionRule); functionRules.push({ name: 'TBS_SMARTAUDIO', groups: ['peripherals'], maxPorts: 1 });
} }
for (var i = 0; i < functionRules.length; i++) { for (var i = 0; i < functionRules.length; i++) {
@ -72,15 +72,16 @@ TABS.ports.initialize = function (callback, scrollPosition) {
]; ];
var blackboxBaudRates = [ var blackboxBaudRates = [
'AUTO',
'19200', '19200',
'38400', '38400',
'57600', '57600',
'115200', '115200',
'230400', '230400',
'250000', '250000'
]; ];
var columns = ['configuration', 'logging', 'sensors', 'telemetry', 'rx']; var columns = ['configuration', 'peripherals', 'sensors', 'telemetry', 'rx'];
if (GUI.active_tab != 'ports') { if (GUI.active_tab != 'ports') {
GUI.active_tab = 'ports'; GUI.active_tab = 'ports';
@ -166,14 +167,19 @@ TABS.ports.initialize = function (callback, scrollPosition) {
} else { } else {
gpsBaudrate = 'AUTO'; gpsBaudrate = 'AUTO';
} }
var gps_baudrate_e = port_configuration_e.find('select.gps_baudrate'); var gps_baudrate_e = port_configuration_e.find('select.gps_baudrate');
gps_baudrate_e.val(gpsBaudrate); gps_baudrate_e.val(gpsBaudrate);
var blackboxBaudrate;
if (serialPort.functions.indexOf('BLACKBOX') >= 0) {
blackboxBaudrate = serialPort.blackbox_baudrate;
} else {
blackboxBaudrate = 'AUTO';
}
var blackbox_baudrate_e = port_configuration_e.find('select.blackbox_baudrate'); var blackbox_baudrate_e = port_configuration_e.find('select.blackbox_baudrate');
blackbox_baudrate_e.val(serialPort.blackbox_baudrate); blackbox_baudrate_e.val(blackboxBaudrate);
port_configuration_e.find('.identifier').text(portIdentifierToNameMapping[serialPort.identifier]) port_configuration_e.find('.identifier').text(portIdentifierToNameMapping[serialPort.identifier]);
port_configuration_e.data('index', portIndex); port_configuration_e.data('index', portIndex);
port_configuration_e.data('port', serialPort); port_configuration_e.data('port', serialPort);
@ -193,7 +199,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
} }
var select_e; var select_e;
if (column !== 'telemetry' && column !== 'sensors') { if (column !== 'telemetry' && column !== 'sensors' && column !== 'peripherals') {
var checkboxId = 'functionCheckbox-' + portIndex + '-' + columnIndex + '-' + i; var checkboxId = 'functionCheckbox-' + portIndex + '-' + columnIndex + '-' + i;
functions_e.prepend('<span class="function"><input type="checkbox" class="togglemedium" id="' + checkboxId + '" value="' + functionName + '" /><label for="' + checkboxId + '"> ' + functionRule.displayName + '</label></span>'); functions_e.prepend('<span class="function"><input type="checkbox" class="togglemedium" id="' + checkboxId + '" value="' + functionName + '" /><label for="' + checkboxId + '"> ' + functionRule.displayName + '</label></span>');
@ -203,7 +209,6 @@ TABS.ports.initialize = function (callback, scrollPosition) {
} }
} else { } else {
var selectElementName = 'function-' + column; var selectElementName = 'function-' + column;
var selectElementSelector = 'select[name=' + selectElementName + ']'; var selectElementSelector = 'select[name=' + selectElementName + ']';
select_e = functions_e.find(selectElementSelector); select_e = functions_e.find(selectElementSelector);
@ -244,7 +249,6 @@ TABS.ports.initialize = function (callback, scrollPosition) {
} }
function on_save_handler() { function on_save_handler() {
// update configuration based on current ui state // update configuration based on current ui state
SERIAL_CONFIG.ports = []; SERIAL_CONFIG.ports = [];
@ -263,14 +267,24 @@ TABS.ports.initialize = function (callback, scrollPosition) {
functions.push(telemetryFunction); functions.push(telemetryFunction);
} }
var sensorFunction = $(portConfiguration_e).find('select[name=function-sensors]').val(); var sensorFunction = $(portConfiguration_e).find('select[name=function-sensors]').val();
if (sensorFunction) { if (sensorFunction) {
functions.push(sensorFunction); functions.push(sensorFunction);
} }
var peripheralFunction = $(portConfiguration_e).find('select[name=function-peripherals]').val();
if (peripheralFunction) {
functions.push(peripheralFunction);
}
var gpsBaudrate = $(portConfiguration_e).find('.gps_baudrate').val(); var gpsBaudrate = $(portConfiguration_e).find('.gps_baudrate').val();
if (gpsBaudrate === 'AUTO') { if (gpsBaudrate === 'AUTO') {
gpsBaudrate = '57600'; gpsBaudrate = '57600';
}
var blackboxBaudrate = $(portConfiguration_e).find('.blackbox_baudrate').val();
if (blackboxBaudrate === 'AUTO') {
blackboxBaudrate = '115200';
} }
var serialPort = { var serialPort = {
@ -278,7 +292,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
msp_baudrate: $(portConfiguration_e).find('.msp_baudrate').val(), msp_baudrate: $(portConfiguration_e).find('.msp_baudrate').val(),
telemetry_baudrate: $(portConfiguration_e).find('.telemetry_baudrate').val(), telemetry_baudrate: $(portConfiguration_e).find('.telemetry_baudrate').val(),
gps_baudrate: gpsBaudrate, gps_baudrate: gpsBaudrate,
blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(), blackbox_baudrate: blackboxBaudrate,
identifier: oldSerialPort.identifier identifier: oldSerialPort.identifier
}; };
SERIAL_CONFIG.ports.push(serialPort); SERIAL_CONFIG.ports.push(serialPort);