Skip to content

Commit a0dd26e

Browse files
authored
Merge pull request #346 from mikeller/reorganise_ports_tab
Reorganised ports tab in order of importance, separated sensors in / telemetry out.
2 parents e0b1393 + 2237696 commit a0dd26e

File tree

3 files changed

+60
-24
lines changed

3 files changed

+60
-24
lines changed

_locales/en/messages.json

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,24 @@
741741
"message": "Save and Reboot"
742742
},
743743

744+
"portsIdentifier": {
745+
"message": "Port Identifier"
746+
},
747+
"portsConfiguration": {
748+
"message": "Configuration"
749+
},
750+
"portsSerialRx": {
751+
"message": "Serial Rx"
752+
},
753+
"portsSensorIn": {
754+
"message": "Sensor Input"
755+
},
756+
"portsTelemetryOut": {
757+
"message": "Telemetry Output"
758+
},
759+
"portsLogging": {
760+
"message": "Logging"
761+
},
744762
"portsHelp": {
745763
"message": "<strong>Note:</strong> not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset."
746764
},
@@ -759,8 +777,8 @@
759777
"portsFunction_MSP": {
760778
"message": "MSP"
761779
},
762-
"portsFunction_GSP": {
763-
"message": "GSP"
780+
"portsFunction_GPS": {
781+
"message": "GPS"
764782
},
765783
"portsFunction_TELEMETRY_FRSKY": {
766784
"message": "FrSky"
@@ -781,7 +799,7 @@
781799
"message": "SmartPort"
782800
},
783801
"portsFunction_TELEMETRY_ESC": {
784-
"message": "ESC telemetry"
802+
"message": "ESC Telemetry"
785803
},
786804
"portsFunction_RX_SERIAL": {
787805
"message": "Serial RX"

tabs/ports.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<table class="ports spacebottom">
1515
<thead>
1616
<tr>
17-
<td>Identifier</td>
18-
<td>Data</td>
19-
<td>Logging</td>
20-
<td>Telemetry</td>
21-
<td>RX</td>
22-
<td>GPS</td>
17+
<td i18n="portsIdentifier"/>
18+
<td i18n="portsConfiguration">
19+
<td i18n="portsSerialRx">
20+
<td i18n="portsTelemetryOut">
21+
<td i18n="portsSensorIn">
22+
<td i18n="portsLogging">
2323
</tr>
2424
</thead>
2525
<tbody>
@@ -48,20 +48,20 @@
4848
<td class="identifierCell">
4949
<p class="identifier"></p>
5050
</td>
51-
<td class="functionsCell-data"><select class="msp_baudrate">
52-
<!-- list generated here -->
53-
</select></td>
54-
<td class="functionsCell-logging"><select class="blackbox_baudrate">
51+
<td class="functionsCell-configuration"><select class="msp_baudrate">
5552
<!-- list generated here -->
5653
</select></td>
54+
<td class="functionsCell-rx"></td>
5755
<td class="functionsCell-telemetry"><select class="telemetry_baudrate">
58-
<!-- list generated here -->
56+
<!-- list generated here -->
5957
</select></td>
60-
<td class="functionsCell-rx"></td>
61-
<td class="functionsCell-gps"><select class="gps_baudrate">
58+
<td class="functionsCell-sensors"><select class="gps_baudrate">
59+
<!-- list generated here -->
60+
</select></td>
61+
<td class="functionsCell-logging"><select class="blackbox_baudrate">
6262
<!-- list generated here -->
6363
</select></td>
64-
</tr>
64+
</tr>
6565
</tbody>
6666
</table>
6767
</div>

tabs/ports.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ TABS.ports.initialize = function (callback, scrollPosition) {
88
var board_definition = {};
99

1010
var functionRules = [
11-
{name: 'MSP', groups: ['data', 'msp'], maxPorts: 2},
12-
{name: 'GPS', groups: ['gps'], maxPorts: 1},
11+
{name: 'MSP', groups: ['configuration', 'msp'], maxPorts: 2},
12+
{name: 'GPS', groups: ['sensors'], maxPorts: 1},
1313
{name: 'TELEMETRY_FRSKY', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1},
1414
{name: 'TELEMETRY_HOTT', groups: ['telemetry'], sharableWith: ['msp'], notSharableWith: ['blackbox'], maxPorts: 1},
1515
{name: 'TELEMETRY_SMARTPORT', groups: ['telemetry'], maxPorts: 1},
@@ -31,7 +31,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
3131
}
3232

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

@@ -54,6 +54,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
5454
}
5555

5656
var gpsBaudRates = [
57+
'AUTO',
5758
'9600',
5859
'19200',
5960
'38400',
@@ -79,7 +80,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
7980
'250000',
8081
];
8182

82-
var columns = ['data', 'logging', 'gps', 'telemetry', 'rx'];
83+
var columns = ['configuration', 'logging', 'sensors', 'telemetry', 'rx'];
8384

8485
if (GUI.active_tab != 'ports') {
8586
GUI.active_tab = 'ports';
@@ -159,8 +160,15 @@ TABS.ports.initialize = function (callback, scrollPosition) {
159160
var telemetry_baudrate_e = port_configuration_e.find('select.telemetry_baudrate');
160161
telemetry_baudrate_e.val(serialPort.telemetry_baudrate);
161162

163+
var gpsBaudrate;
164+
if (serialPort.functions.indexOf('GPS') >= 0) {
165+
gpsBaudrate = serialPort.gps_baudrate;
166+
} else {
167+
gpsBaudrate = 'AUTO';
168+
}
169+
162170
var gps_baudrate_e = port_configuration_e.find('select.gps_baudrate');
163-
gps_baudrate_e.val(serialPort.gps_baudrate);
171+
gps_baudrate_e.val(gpsBaudrate);
164172

165173
var blackbox_baudrate_e = port_configuration_e.find('select.blackbox_baudrate');
166174
blackbox_baudrate_e.val(serialPort.blackbox_baudrate);
@@ -185,7 +193,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
185193
}
186194

187195
var select_e;
188-
if (column != 'telemetry') {
196+
if (column !== 'telemetry' && column !== 'sensors') {
189197
var checkboxId = 'functionCheckbox-' + portIndex + '-' + columnIndex + '-' + i;
190198
functions_e.prepend('<span class="function"><input type="checkbox" class="togglemedium" id="' + checkboxId + '" value="' + functionName + '" /><label for="' + checkboxId + '"> ' + functionRule.displayName + '</label></span>');
191199

@@ -255,11 +263,21 @@ TABS.ports.initialize = function (callback, scrollPosition) {
255263
functions.push(telemetryFunction);
256264
}
257265

266+
var sensorFunction = $(portConfiguration_e).find('select[name=function-sensors]').val();
267+
if (sensorFunction) {
268+
functions.push(sensorFunction);
269+
}
270+
271+
var gpsBaudrate = $(portConfiguration_e).find('.gps_baudrate').val();
272+
if (gpsBaudrate === 'AUTO') {
273+
gpsBaudrate = '57600';
274+
}
275+
258276
var serialPort = {
259277
functions: functions,
260278
msp_baudrate: $(portConfiguration_e).find('.msp_baudrate').val(),
261279
telemetry_baudrate: $(portConfiguration_e).find('.telemetry_baudrate').val(),
262-
gps_baudrate: $(portConfiguration_e).find('.gps_baudrate').val(),
280+
gps_baudrate: gpsBaudrate,
263281
blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(),
264282
identifier: oldSerialPort.identifier
265283
};

0 commit comments

Comments
 (0)