mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 21:05:30 +03:00
Display header elements depending on connection state
This commit is contained in:
parent
ae41a52c46
commit
d2be1715e5
4 changed files with 44 additions and 39 deletions
|
@ -627,7 +627,7 @@
|
|||
"message": "PID Controller"
|
||||
},
|
||||
"pidTuningLoadedProfile": {
|
||||
"message": "Loaded Profile: <strong>$1</strong>"
|
||||
"message": "<span style=\"color: #57a929\">Loaded Profile: <strong>$1</strong></span>"
|
||||
},
|
||||
"pidTuningDataRefreshed": {
|
||||
"message": "PID data <strong>refreshed</strong>"
|
||||
|
|
|
@ -25,7 +25,7 @@ $(document).ready(function () {
|
|||
GUI.updateManualPortVisibility();
|
||||
});
|
||||
|
||||
$('div#port-picker a.connect').click(function () {
|
||||
$('a.connect').click(function () {
|
||||
if (GUI.connect_lock != true) { // GUI control overrides the user control
|
||||
|
||||
var clicks = $(this).data('clicks');
|
||||
|
@ -41,7 +41,7 @@ $(document).ready(function () {
|
|||
|
||||
// lock port select & baud while we are connecting / connected
|
||||
$('div#port-picker #port, div#port-picker #baud, div#port-picker #delay').prop('disabled', true);
|
||||
$('div#port-picker a.connect_state').text(chrome.i18n.getMessage('connecting'));
|
||||
$('a.connect_state').text(chrome.i18n.getMessage('connecting'));
|
||||
|
||||
|
||||
serial.connect(selected_port, {bitrate: selected_baud}, onOpen);
|
||||
|
@ -70,8 +70,8 @@ $(document).ready(function () {
|
|||
if (!GUI.auto_connect) $('div#port-picker #baud').prop('disabled', false);
|
||||
|
||||
// reset connect / disconnect button
|
||||
$('div#port-picker a.connect').removeClass('active');
|
||||
$('div#port-picker a.connect_state').text(chrome.i18n.getMessage('connect'));
|
||||
$('a.connect').removeClass('active');
|
||||
$('a.connect_state').text(chrome.i18n.getMessage('connect'));
|
||||
|
||||
// reset active sensor indicators
|
||||
sensor_status(0);
|
||||
|
@ -186,7 +186,7 @@ function onOpen(openInfo) {
|
|||
if (!CONFIGURATOR.connectionValid) {
|
||||
GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
|
||||
|
||||
$('div#port-picker a.connect').click(); // disconnect
|
||||
$('a.connect').click(); // disconnect
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
|
@ -247,21 +247,21 @@ function onOpen(openInfo) {
|
|||
console.log('Failed to open serial port');
|
||||
GUI.log(chrome.i18n.getMessage('serialPortOpenFail'));
|
||||
|
||||
$('div#port-picker a.connect_state').text(chrome.i18n.getMessage('connect'));
|
||||
$('div#port-picker a.connect').removeClass('active');
|
||||
$('a.connect_state').text(chrome.i18n.getMessage('connect'));
|
||||
$('a.connect').removeClass('active');
|
||||
|
||||
// unlock port select & baud
|
||||
$('div#port-picker #port, div#port-picker #baud, div#port-picker #delay').prop('disabled', false);
|
||||
|
||||
// reset data
|
||||
$('div#port-picker a.connect').data("clicks", false);
|
||||
$('a.connect').data("clicks", false);
|
||||
}
|
||||
}
|
||||
|
||||
function onConnect() {
|
||||
GUI.timeout_remove('connecting'); // kill connecting timer
|
||||
$('a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
|
||||
$('div#port-picker a.connect').addClass('active');
|
||||
$('a.connect').addClass('active');
|
||||
$('#tabs ul.mode-disconnected').hide();
|
||||
$('#tabs ul.mode-connected').show();
|
||||
|
||||
|
@ -274,13 +274,12 @@ function onConnect() {
|
|||
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
|
||||
*/
|
||||
|
||||
/* just a thought
|
||||
var sensor_state = $('#sensor-status');
|
||||
/* */
|
||||
var sensor_state = $('#sensor-status');
|
||||
sensor_state.show();
|
||||
*/
|
||||
|
||||
var flashstate = $('#header_dataflash');
|
||||
flashstate.show();
|
||||
|
||||
var port_picker = $('#port-picker');
|
||||
port_picker.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,14 +293,13 @@ function onClosed(result) {
|
|||
$('#tabs ul.mode-connected').hide();
|
||||
$('#tabs ul.mode-disconnected').show();
|
||||
|
||||
|
||||
var flashstate = $('#header_dataflash');
|
||||
flashstate.hide();
|
||||
|
||||
/* just a thought
|
||||
var sensor_state = $('#sensor-status');
|
||||
var port_picker = $('#port-picker');
|
||||
port_picker.show();
|
||||
|
||||
/* */
|
||||
var sensor_state = $('#sensor-status');
|
||||
sensor_state.hide();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
function read_serial(info) {
|
||||
|
|
25
main.css
25
main.css
|
@ -134,9 +134,10 @@ input[type="number"]::-webkit-inner-spin-button {
|
|||
}
|
||||
|
||||
#port-picker {
|
||||
float: left;
|
||||
margin-top: 20px;
|
||||
width:240px;
|
||||
float: left;
|
||||
margin-top: 20px;
|
||||
margin-left:30px;
|
||||
width:180px;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -225,7 +226,7 @@ input[type="number"]::-webkit-inner-spin-button {
|
|||
color:#ddd;
|
||||
position:absolute;
|
||||
margin-top:-59px;
|
||||
margin-left:-183px;
|
||||
margin-left:187px;
|
||||
}
|
||||
|
||||
|
||||
|
@ -606,6 +607,10 @@ input[type="number"]::-webkit-inner-spin-button {
|
|||
}
|
||||
|
||||
|
||||
.header-wrapper .mode-connected {
|
||||
display:none;
|
||||
}
|
||||
|
||||
#tabs ul.mode-connected {
|
||||
display: none;
|
||||
}
|
||||
|
@ -1309,11 +1314,12 @@ dialog {
|
|||
|
||||
|
||||
.connect_controls {
|
||||
position: absolute;
|
||||
left: 620px;
|
||||
top: 19px;
|
||||
height: 70px;
|
||||
width: 60px;
|
||||
position: relative;
|
||||
float: left;
|
||||
left: 0px;
|
||||
top: 19px;
|
||||
height: 70px;
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1372,6 +1378,7 @@ dialog {
|
|||
font-size:12px;
|
||||
font-family: 'open_sansregular', Arial;
|
||||
text-shadow:0px 1px rgba(0, 0, 0, 0.25);
|
||||
margin-top: -1px;
|
||||
|
||||
|
||||
}
|
||||
|
|
14
main.html
14
main.html
|
@ -81,6 +81,12 @@
|
|||
<div id="main-wrapper">
|
||||
<div class="headerbar">
|
||||
<div id="logo"></div>
|
||||
<div class="connect_controls">
|
||||
<div class="connect_b">
|
||||
<a class="connect" href="#"></a>
|
||||
</div>
|
||||
<a class="connect_state" i18n="connect"></a>
|
||||
</div>
|
||||
<div id="port-picker">
|
||||
<div class="dropdown dropdown-dark" style="margin-bottom:3px;">
|
||||
<select class="dropdown-select" id="port" title="Port">
|
||||
|
@ -107,17 +113,11 @@
|
|||
</div>
|
||||
<div>
|
||||
<label><input class="auto_connect" type="checkbox" id="togglesmall" /><span class="auto_connect" i18n="autoConnect"></span></label>
|
||||
<div class="connect_controls">
|
||||
<div class="connect_b">
|
||||
<a class="connect" href="#"></a>
|
||||
</div>
|
||||
<a class="connect_state" i18n="connect"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a id="options" href="#" i18n_title="options_title"></a>
|
||||
<div class="header-wrapper">
|
||||
<div id="sensor-status" class="sensor_state">
|
||||
<div id="sensor-status" class="sensor_state mode-connected">
|
||||
<ul>
|
||||
<li class="gyro" title="Gyroscope">
|
||||
<div class="gyroicon">Gyro</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue