mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
initial work on pass through mode for ReadError
This commit is contained in:
parent
f649418fdf
commit
cb5bcf9c0a
3 changed files with 71 additions and 45 deletions
|
@ -36,6 +36,7 @@ $(document).ready(function() {
|
|||
MSP.disconnect_cleanup();
|
||||
PortUsage.reset();
|
||||
configuration_received = false; // reset valid config received variable (used to block tabs while not connected properly)
|
||||
MSP_pass_through = false;
|
||||
|
||||
// unlock port select & baud
|
||||
$('div#port-picker #port').prop('disabled', false);
|
||||
|
@ -125,6 +126,7 @@ function onOpen(openInfo) {
|
|||
|
||||
serial.onReceive.addListener(read_serial);
|
||||
|
||||
if (!MSP_pass_through) {
|
||||
// disconnect after 10 seconds with error if we don't get IDENT data
|
||||
GUI.timeout_add('connecting', function() {
|
||||
if (!configuration_received) {
|
||||
|
@ -153,6 +155,10 @@ function onOpen(openInfo) {
|
|||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$('div#port-picker a.connect').text(chrome.i18n.getMessage('disconnect')).addClass('active');
|
||||
GUI.log('Connection opened in <strong>pass-through</strong> mode');
|
||||
}
|
||||
} else {
|
||||
console.log('Failed to open serial port');
|
||||
GUI.log(chrome.i18n.getMessage('serialPortOpenFail'));
|
||||
|
@ -177,10 +183,12 @@ function onClosed(result) {
|
|||
}
|
||||
|
||||
function read_serial(info) {
|
||||
if (!CLI_active) {
|
||||
if (!CLI_active && !MSP_pass_through) {
|
||||
MSP.read(info);
|
||||
} else {
|
||||
} else if (CLI_active) {
|
||||
handle_CLI(info);
|
||||
} else if (MSP_pass_through) { // needs to be verified, might be removed after pass_through is 100% deployed
|
||||
MSP.read(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
8
main.js
8
main.js
|
@ -54,10 +54,11 @@ $(document).ready(function() {
|
|||
if ($(this).parent().hasClass('active') == false) { // only initialize when the tab isn't already active
|
||||
var self = this;
|
||||
var index = $(self).parent().index();
|
||||
var tab = $(self).parent().prop('class');
|
||||
|
||||
// if there is no active connection, return
|
||||
if (configuration_received == false) {
|
||||
GUI.log('You need to connect before you can view any of the tabs', 'red');
|
||||
if (!configuration_received && tab != 'tab_logging') {
|
||||
GUI.log('You need to <strong>connect</strong> before you can view any of the tabs');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -65,9 +66,6 @@ $(document).ready(function() {
|
|||
// disable previously active tab highlight
|
||||
$('li', tabs).removeClass('active');
|
||||
|
||||
// get tab class name (there should be only one class listed)
|
||||
var tab = $(self).parent().prop('class');
|
||||
|
||||
// Highlight selected tab
|
||||
$(self).parent().addClass('active');
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
var MSP_pass_through = false;
|
||||
|
||||
function tab_initialize_logging() {
|
||||
ga_tracker.sendAppView('Logging');
|
||||
GUI.active_tab = 'logging';
|
||||
|
||||
var requested_properties = [];
|
||||
|
||||
if (configuration_received) {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false, get_motor_data);
|
||||
|
||||
function get_motor_data() {
|
||||
|
@ -13,6 +16,21 @@ function tab_initialize_logging() {
|
|||
function load_html() {
|
||||
$('#content').load("./tabs/logging.html", process_html);
|
||||
}
|
||||
} else {
|
||||
MSP_pass_through = true;
|
||||
|
||||
// we will initialize RC.channels array and MOTOR_DATA array manually
|
||||
RC.active_channels = 8;
|
||||
for (var i = 0; i < RC.active_channels; i++) {
|
||||
RC.channels[i] = 0;
|
||||
}
|
||||
|
||||
for (var i = 0; i < 8; i++) {
|
||||
MOTOR_DATA[i] = 0;
|
||||
}
|
||||
|
||||
$('#content').load("./tabs/logging.html", process_html);
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
|
@ -36,7 +54,7 @@ function tab_initialize_logging() {
|
|||
});
|
||||
|
||||
if (requested_properties.length) {
|
||||
// print header for the
|
||||
// print header for the csv file
|
||||
print_head();
|
||||
|
||||
function poll_data() {
|
||||
|
@ -44,6 +62,7 @@ function tab_initialize_logging() {
|
|||
crunch_data();
|
||||
|
||||
// request new
|
||||
if (!MSP_pass_through) {
|
||||
for (var i = 0; i < requested_properties.length; i++) {
|
||||
MSP.send_message(MSP_codes[requested_properties[i]]);
|
||||
|
||||
|
@ -56,6 +75,7 @@ function tab_initialize_logging() {
|
|||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI.interval_add('log_data_pull', poll_data, parseInt($('select.speed').val()), true); // refresh rate goes here
|
||||
GUI.interval_add('flush_data', function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue