Skip to content

Commit c4d72b6

Browse files
authored
Merge pull request #355 from mikeller/add_tbs_smartaudio
Added GUI support for TBS SmartAudio.
2 parents 4abf691 + 7d75601 commit c4d72b6

File tree

4 files changed

+44
-27
lines changed

4 files changed

+44
-27
lines changed

_locales/en/messages.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,8 @@
762762
"portsTelemetryOut": {
763763
"message": "Telemetry Output"
764764
},
765-
"portsLogging": {
766-
"message": "Logging"
765+
"portsPeripherals": {
766+
"message": "Peripherals"
767767
},
768768
"portsHelp": {
769769
"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 @@
811811
"message": "Serial RX"
812812
},
813813
"portsFunction_BLACKBOX": {
814-
"message": "Blackbox"
814+
"message": "Blackbox logging"
815+
},
816+
"portsFunction_TBS_SMARTAUDIO": {
817+
"message": "TBS SmartAudio"
815818
},
816-
817819
"pidTuningUpgradeFirmwareToChangePidController": {
818820
"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>."
819821
},

js/msp/MSPHelper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function MspHelper () {
2020
'RX_SERIAL': 6,
2121
'BLACKBOX': 7,
2222
'TELEMETRY_MAVLINK': 9,
23-
'ESC_SENSOR': 10
23+
'ESC_SENSOR': 10,
24+
'TBS_SMARTAUDIO': 11
2425
};
2526
}
2627

tabs/ports.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<td i18n="portsSerialRx">
2020
<td i18n="portsTelemetryOut">
2121
<td i18n="portsSensorIn">
22-
<td i18n="portsLogging">
22+
<td i18n="portsPeripherals">
2323
</tr>
2424
</thead>
2525
<tbody>
@@ -58,7 +58,7 @@
5858
<td class="functionsCell-sensors"><select class="gps_baudrate">
5959
<!-- list generated here -->
6060
</select></td>
61-
<td class="functionsCell-logging"><select class="blackbox_baudrate">
61+
<td class="functionsCell-peripherals"><select class="blackbox_baudrate">
6262
<!-- list generated here -->
6363
</select></td>
6464
</tr>

tabs/ports.js

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ TABS.ports.initialize = function (callback, scrollPosition) {
1010
var functionRules = [
1111
{name: 'MSP', groups: ['configuration', 'msp'], maxPorts: 2},
1212
{name: 'GPS', groups: ['sensors'], maxPorts: 1},
13-
{name: 'TELEMETRY_FRSKY', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1},
14-
{name: 'TELEMETRY_HOTT', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1},
13+
{name: 'TELEMETRY_FRSKY', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1},
14+
{name: 'TELEMETRY_HOTT', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1},
1515
{name: 'TELEMETRY_SMARTPORT', groups: ['telemetry'], maxPorts: 1},
1616
{name: 'RX_SERIAL', groups: ['rx'], maxPorts: 1},
17-
{name: 'BLACKBOX', groups: ['logging', 'blackbox'], sharableWith: ['msp'], notSharableWith: ['telemetry'], maxPorts: 1},
17+
{name: 'BLACKBOX', groups: ['peripherals'], sharableWith: ['msp'], notSharableWith: ['telemetry'], maxPorts: 1}
1818
];
1919

2020
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
21-
var ltmFunctionRule = {name: 'TELEMETRY_LTM', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1};
21+
var ltmFunctionRule = {name: 'TELEMETRY_LTM', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1};
2222
functionRules.push(ltmFunctionRule);
2323
} else {
24-
var mspFunctionRule = {name: 'TELEMETRY_MSP', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1};
24+
var mspFunctionRule = {name: 'TELEMETRY_MSP', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1};
2525
functionRules.push(mspFunctionRule);
2626
}
2727

2828
if (semver.gte(CONFIG.apiVersion, "1.18.0")) {
29-
var mavlinkFunctionRule = {name: 'TELEMETRY_MAVLINK', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1};
29+
var mavlinkFunctionRule = {name: 'TELEMETRY_MAVLINK', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['peripherals'], maxPorts: 1};
3030
functionRules.push(mavlinkFunctionRule);
3131
}
3232

3333
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
34-
var escTlmFunctionRule = {name: 'ESC_SENSOR', groups: ['sensors'], maxPorts: 1};
35-
functionRules.push(escTlmFunctionRule);
34+
functionRules.push({ name: 'ESC_SENSOR', groups: ['sensors'], maxPorts: 1 });
35+
functionRules.push({ name: 'TBS_SMARTAUDIO', groups: ['peripherals'], maxPorts: 1 });
3636
}
3737

3838
for (var i = 0; i < functionRules.length; i++) {
@@ -72,15 +72,16 @@ TABS.ports.initialize = function (callback, scrollPosition) {
7272
];
7373

7474
var blackboxBaudRates = [
75+
'AUTO',
7576
'19200',
7677
'38400',
7778
'57600',
7879
'115200',
7980
'230400',
80-
'250000',
81+
'250000'
8182
];
8283

83-
var columns = ['configuration', 'logging', 'sensors', 'telemetry', 'rx'];
84+
var columns = ['configuration', 'peripherals', 'sensors', 'telemetry', 'rx'];
8485

8586
if (GUI.active_tab != 'ports') {
8687
GUI.active_tab = 'ports';
@@ -166,14 +167,19 @@ TABS.ports.initialize = function (callback, scrollPosition) {
166167
} else {
167168
gpsBaudrate = 'AUTO';
168169
}
169-
170170
var gps_baudrate_e = port_configuration_e.find('select.gps_baudrate');
171171
gps_baudrate_e.val(gpsBaudrate);
172172

173+
var blackboxBaudrate;
174+
if (serialPort.functions.indexOf('BLACKBOX') >= 0) {
175+
blackboxBaudrate = serialPort.blackbox_baudrate;
176+
} else {
177+
blackboxBaudrate = 'AUTO';
178+
}
173179
var blackbox_baudrate_e = port_configuration_e.find('select.blackbox_baudrate');
174-
blackbox_baudrate_e.val(serialPort.blackbox_baudrate);
180+
blackbox_baudrate_e.val(blackboxBaudrate);
175181

176-
port_configuration_e.find('.identifier').text(portIdentifierToNameMapping[serialPort.identifier])
182+
port_configuration_e.find('.identifier').text(portIdentifierToNameMapping[serialPort.identifier]);
177183

178184
port_configuration_e.data('index', portIndex);
179185
port_configuration_e.data('port', serialPort);
@@ -193,7 +199,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
193199
}
194200

195201
var select_e;
196-
if (column !== 'telemetry' && column !== 'sensors') {
202+
if (column !== 'telemetry' && column !== 'sensors' && column !== 'peripherals') {
197203
var checkboxId = 'functionCheckbox-' + portIndex + '-' + columnIndex + '-' + i;
198204
functions_e.prepend('<span class="function"><input type="checkbox" class="togglemedium" id="' + checkboxId + '" value="' + functionName + '" /><label for="' + checkboxId + '"> ' + functionRule.displayName + '</label></span>');
199205

@@ -203,7 +209,6 @@ TABS.ports.initialize = function (callback, scrollPosition) {
203209
}
204210

205211
} else {
206-
207212
var selectElementName = 'function-' + column;
208213
var selectElementSelector = 'select[name=' + selectElementName + ']';
209214
select_e = functions_e.find(selectElementSelector);
@@ -244,7 +249,6 @@ TABS.ports.initialize = function (callback, scrollPosition) {
244249
}
245250

246251
function on_save_handler() {
247-
248252
// update configuration based on current ui state
249253
SERIAL_CONFIG.ports = [];
250254

@@ -263,22 +267,32 @@ TABS.ports.initialize = function (callback, scrollPosition) {
263267
functions.push(telemetryFunction);
264268
}
265269

266-
var sensorFunction = $(portConfiguration_e).find('select[name=function-sensors]').val();
270+
var sensorFunction = $(portConfiguration_e).find('select[name=function-sensors]').val();
267271
if (sensorFunction) {
268272
functions.push(sensorFunction);
269-
}
273+
}
274+
275+
var peripheralFunction = $(portConfiguration_e).find('select[name=function-peripherals]').val();
276+
if (peripheralFunction) {
277+
functions.push(peripheralFunction);
278+
}
270279

271280
var gpsBaudrate = $(portConfiguration_e).find('.gps_baudrate').val();
272281
if (gpsBaudrate === 'AUTO') {
273-
gpsBaudrate = '57600';
282+
gpsBaudrate = '57600';
283+
}
284+
285+
var blackboxBaudrate = $(portConfiguration_e).find('.blackbox_baudrate').val();
286+
if (blackboxBaudrate === 'AUTO') {
287+
blackboxBaudrate = '115200';
274288
}
275289

276290
var serialPort = {
277291
functions: functions,
278292
msp_baudrate: $(portConfiguration_e).find('.msp_baudrate').val(),
279293
telemetry_baudrate: $(portConfiguration_e).find('.telemetry_baudrate').val(),
280294
gps_baudrate: gpsBaudrate,
281-
blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(),
295+
blackbox_baudrate: blackboxBaudrate,
282296
identifier: oldSerialPort.identifier
283297
};
284298
SERIAL_CONFIG.ports.push(serialPort);

0 commit comments

Comments
 (0)