mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 19:40:22 +03:00
manual port override as chrome won't enumerate bluetooth serial ports on linux
This commit is contained in:
parent
d10023ec4b
commit
1bb63a597b
4 changed files with 44 additions and 13 deletions
16
js/port_handler.js
Normal file → Executable file
16
js/port_handler.js
Normal file → Executable file
|
@ -1,12 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
var PortHandler = new function () {
|
||||
this.main_timeout_reference;
|
||||
this.initial_ports = false;
|
||||
|
||||
this.port_detected_callbacks = [];
|
||||
this.port_removed_callbacks = [];
|
||||
}
|
||||
};
|
||||
|
||||
PortHandler.initialize = function () {
|
||||
// start listening, check after 250ms
|
||||
|
@ -137,7 +135,7 @@ PortHandler.check = function () {
|
|||
check_usb_devices();
|
||||
}
|
||||
|
||||
self.main_timeout_reference = setTimeout(function () {
|
||||
setTimeout(function () {
|
||||
self.check();
|
||||
}, 250);
|
||||
});
|
||||
|
@ -161,13 +159,11 @@ PortHandler.check = function () {
|
|||
PortHandler.update_port_select = function (ports) {
|
||||
$('div#port-picker #port').html(''); // drop previous one
|
||||
|
||||
if (ports.length > 0) {
|
||||
for (var i = 0; i < ports.length; i++) {
|
||||
$('div#port-picker #port').append($("<option/>", {value: ports[i], text: ports[i]}));
|
||||
}
|
||||
} else {
|
||||
$('div#port-picker #port').append($("<option/>", {value: 0, text: 'No Ports'}));
|
||||
for (var i = 0; i < ports.length; i++) {
|
||||
$('div#port-picker #port').append($("<option/>", {value: ports[i], text: ports[i], data: {isManual: false}}));
|
||||
}
|
||||
|
||||
$('div#port-picker #port').append($("<option/>", {value: 'manual', text: 'Manual Selection', data: {isManual: true}}));
|
||||
};
|
||||
|
||||
PortHandler.port_detected = function(name, code, timeout, ignore_timeout) {
|
||||
|
|
|
@ -1,11 +1,34 @@
|
|||
'use strict';
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#port-override-option').hide();
|
||||
|
||||
$('#port-override').change(function () {
|
||||
chrome.storage.local.set({'portOverride': $('#port-override').val()});
|
||||
});
|
||||
|
||||
chrome.storage.local.get('portOverride', function (data) {
|
||||
$('#port-override').val(data.portOverride);
|
||||
});
|
||||
|
||||
$('div#port-picker #port').change(function (target) {
|
||||
if ($('div#port-picker #port option:selected').data().isManual) {
|
||||
$('#port-override-option').show();
|
||||
}
|
||||
else {
|
||||
$('#port-override-option').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('div#port-picker a.connect').click(function () {
|
||||
if (GUI.connect_lock != true) { // GUI control overrides the user control
|
||||
var clicks = $(this).data('clicks'),
|
||||
selected_port = String($('div#port-picker #port').val()),
|
||||
selected_baud = parseInt($('div#port-picker #baud').val());
|
||||
|
||||
var clicks = $(this).data('clicks');
|
||||
var selected_baud = parseInt($('div#port-picker #baud').val());
|
||||
var selected_port = $('div#port-picker #port option:selected').data().isManual ?
|
||||
$('#port-override').val() :
|
||||
String($('div#port-picker #port').val());
|
||||
|
||||
if (selected_port != '0' && selected_port != 'DFU') {
|
||||
if (!clicks) {
|
||||
|
|
8
main.css
8
main.css
|
@ -95,6 +95,14 @@ input[type="number"]::-webkit-inner-spin-button {
|
|||
#port-picker #delay {
|
||||
width: 60px;
|
||||
}
|
||||
#port-picker #port-override{
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
margin-right: 5px;
|
||||
width: 120px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#port-picker a {
|
||||
float: left;
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<ul>
|
||||
<li class="port">
|
||||
<select id="port" title="Port">
|
||||
<option vlaue="manual">Manual</option>
|
||||
<!-- port list gets generated here -->
|
||||
</select>
|
||||
</li>
|
||||
|
@ -100,6 +101,9 @@
|
|||
<option value="1200">1200</option>
|
||||
</select>
|
||||
</li>
|
||||
<li id="port-override-option">
|
||||
<label for="port-override">Port: </label><input id="port-override" type="text" value="/dev/rfcomm0"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="connect" href="#" i18n="connect"></a>
|
||||
<label>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue