1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-26 09:45:28 +03:00

Merge pull request #346 from mikeller/reorganise_ports_tab

Reorganised ports tab in order of importance, separated sensors in / telemetry out.
This commit is contained in:
Michael Keller 2016-11-23 10:07:53 +13:00 committed by GitHub
commit a0dd26e0af
3 changed files with 61 additions and 25 deletions

View file

@ -741,6 +741,24 @@
"message": "Save and Reboot" "message": "Save and Reboot"
}, },
"portsIdentifier": {
"message": "Port Identifier"
},
"portsConfiguration": {
"message": "Configuration"
},
"portsSerialRx": {
"message": "Serial Rx"
},
"portsSensorIn": {
"message": "Sensor Input"
},
"portsTelemetryOut": {
"message": "Telemetry Output"
},
"portsLogging": {
"message": "Logging"
},
"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."
}, },
@ -759,8 +777,8 @@
"portsFunction_MSP": { "portsFunction_MSP": {
"message": "MSP" "message": "MSP"
}, },
"portsFunction_GSP": { "portsFunction_GPS": {
"message": "GSP" "message": "GPS"
}, },
"portsFunction_TELEMETRY_FRSKY": { "portsFunction_TELEMETRY_FRSKY": {
"message": "FrSky" "message": "FrSky"
@ -781,7 +799,7 @@
"message": "SmartPort" "message": "SmartPort"
}, },
"portsFunction_TELEMETRY_ESC": { "portsFunction_TELEMETRY_ESC": {
"message": "ESC telemetry" "message": "ESC Telemetry"
}, },
"portsFunction_RX_SERIAL": { "portsFunction_RX_SERIAL": {
"message": "Serial RX" "message": "Serial RX"

View file

@ -14,12 +14,12 @@
<table class="ports spacebottom"> <table class="ports spacebottom">
<thead> <thead>
<tr> <tr>
<td>Identifier</td> <td i18n="portsIdentifier"/>
<td>Data</td> <td i18n="portsConfiguration">
<td>Logging</td> <td i18n="portsSerialRx">
<td>Telemetry</td> <td i18n="portsTelemetryOut">
<td>RX</td> <td i18n="portsSensorIn">
<td>GPS</td> <td i18n="portsLogging">
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -48,17 +48,17 @@
<td class="identifierCell"> <td class="identifierCell">
<p class="identifier"></p> <p class="identifier"></p>
</td> </td>
<td class="functionsCell-data"><select class="msp_baudrate"> <td class="functionsCell-configuration"><select class="msp_baudrate">
<!-- list generated here -->
</select></td>
<td class="functionsCell-logging"><select class="blackbox_baudrate">
<!-- list generated here -->
</select></td>
<td class="functionsCell-telemetry"><select class="telemetry_baudrate">
<!-- list generated here --> <!-- list generated here -->
</select></td> </select></td>
<td class="functionsCell-rx"></td> <td class="functionsCell-rx"></td>
<td class="functionsCell-gps"><select class="gps_baudrate"> <td class="functionsCell-telemetry"><select class="telemetry_baudrate">
<!-- list generated here -->
</select></td>
<td class="functionsCell-sensors"><select class="gps_baudrate">
<!-- list generated here -->
</select></td>
<td class="functionsCell-logging"><select class="blackbox_baudrate">
<!-- list generated here --> <!-- list generated here -->
</select></td> </select></td>
</tr> </tr>

View file

@ -8,8 +8,8 @@ TABS.ports.initialize = function (callback, scrollPosition) {
var board_definition = {}; var board_definition = {};
var functionRules = [ var functionRules = [
{name: 'MSP', groups: ['data', 'msp'], maxPorts: 2}, {name: 'MSP', groups: ['configuration', 'msp'], maxPorts: 2},
{name: 'GPS', groups: ['gps'], 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: ['blackbox'], maxPorts: 1},
{name: 'TELEMETRY_HOTT', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1}, {name: 'TELEMETRY_HOTT', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1},
{name: 'TELEMETRY_SMARTPORT', groups: ['telemetry'], maxPorts: 1}, {name: 'TELEMETRY_SMARTPORT', groups: ['telemetry'], maxPorts: 1},
@ -31,7 +31,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
} }
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) { if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
var escTlmFunctionRule = {name: 'TELEMETRY_ESC', groups: ['telemetry'], maxPorts: 1}; var escTlmFunctionRule = {name: 'TELEMETRY_ESC', groups: ['sensors'], maxPorts: 1};
functionRules.push(escTlmFunctionRule); functionRules.push(escTlmFunctionRule);
} }
@ -54,6 +54,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
} }
var gpsBaudRates = [ var gpsBaudRates = [
'AUTO',
'9600', '9600',
'19200', '19200',
'38400', '38400',
@ -79,7 +80,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
'250000', '250000',
]; ];
var columns = ['data', 'logging', 'gps', 'telemetry', 'rx']; var columns = ['configuration', 'logging', 'sensors', 'telemetry', 'rx'];
if (GUI.active_tab != 'ports') { if (GUI.active_tab != 'ports') {
GUI.active_tab = 'ports'; GUI.active_tab = 'ports';
@ -159,8 +160,15 @@ TABS.ports.initialize = function (callback, scrollPosition) {
var telemetry_baudrate_e = port_configuration_e.find('select.telemetry_baudrate'); var telemetry_baudrate_e = port_configuration_e.find('select.telemetry_baudrate');
telemetry_baudrate_e.val(serialPort.telemetry_baudrate); telemetry_baudrate_e.val(serialPort.telemetry_baudrate);
var gpsBaudrate;
if (serialPort.functions.indexOf('GPS') >= 0) {
gpsBaudrate = serialPort.gps_baudrate;
} else {
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(serialPort.gps_baudrate); gps_baudrate_e.val(gpsBaudrate);
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(serialPort.blackbox_baudrate);
@ -185,7 +193,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
} }
var select_e; var select_e;
if (column != 'telemetry') { if (column !== 'telemetry' && column !== 'sensors') {
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>');
@ -255,11 +263,21 @@ TABS.ports.initialize = function (callback, scrollPosition) {
functions.push(telemetryFunction); functions.push(telemetryFunction);
} }
var sensorFunction = $(portConfiguration_e).find('select[name=function-sensors]').val();
if (sensorFunction) {
functions.push(sensorFunction);
}
var gpsBaudrate = $(portConfiguration_e).find('.gps_baudrate').val();
if (gpsBaudrate === 'AUTO') {
gpsBaudrate = '57600';
}
var serialPort = { var serialPort = {
functions: functions, functions: functions,
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: $(portConfiguration_e).find('.gps_baudrate').val(), gps_baudrate: gpsBaudrate,
blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(), blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(),
identifier: oldSerialPort.identifier identifier: oldSerialPort.identifier
}; };