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