mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 20:10:11 +03:00
removing MSP pass through mode
This commit is contained in:
parent
78b282f458
commit
a96e804359
4 changed files with 32 additions and 74 deletions
|
@ -4,7 +4,6 @@ var CONFIGURATOR = {
|
||||||
'releaseDate': 1409496670288, // 08.31.2014 - new Date().getTime()
|
'releaseDate': 1409496670288, // 08.31.2014 - new Date().getTime()
|
||||||
'firmwareVersionAccepted': 2.3,
|
'firmwareVersionAccepted': 2.3,
|
||||||
'connectionValid': false,
|
'connectionValid': false,
|
||||||
'mspPassThrough': false,
|
|
||||||
'cliActive': false,
|
'cliActive': false,
|
||||||
'cliValid': false
|
'cliValid': false
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,6 @@ $(document).ready(function () {
|
||||||
MSP.disconnect_cleanup();
|
MSP.disconnect_cleanup();
|
||||||
PortUsage.reset();
|
PortUsage.reset();
|
||||||
CONFIGURATOR.connectionValid = false;
|
CONFIGURATOR.connectionValid = false;
|
||||||
CONFIGURATOR.mspPassThrough = false;
|
|
||||||
|
|
||||||
// unlock port select & baud
|
// unlock port select & baud
|
||||||
$('div#port-picker #port').prop('disabled', false);
|
$('div#port-picker #port').prop('disabled', false);
|
||||||
|
@ -125,7 +124,6 @@ function onOpen(openInfo) {
|
||||||
|
|
||||||
serial.onReceive.addListener(read_serial);
|
serial.onReceive.addListener(read_serial);
|
||||||
|
|
||||||
if (!CONFIGURATOR.mspPassThrough) {
|
|
||||||
// disconnect after 10 seconds with error if we don't get IDENT data
|
// disconnect after 10 seconds with error if we don't get IDENT data
|
||||||
GUI.timeout_add('connecting', function () {
|
GUI.timeout_add('connecting', function () {
|
||||||
if (!CONFIGURATOR.connectionValid) {
|
if (!CONFIGURATOR.connectionValid) {
|
||||||
|
@ -154,10 +152,6 @@ 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 {
|
} else {
|
||||||
console.log('Failed to open serial port');
|
console.log('Failed to open serial port');
|
||||||
GUI.log(chrome.i18n.getMessage('serialPortOpenFail'));
|
GUI.log(chrome.i18n.getMessage('serialPortOpenFail'));
|
||||||
|
@ -182,12 +176,10 @@ function onClosed(result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_serial(info) {
|
function read_serial(info) {
|
||||||
if (!CONFIGURATOR.cliActive && !CONFIGURATOR.mspPassThrough) {
|
if (!CONFIGURATOR.cliActive) {
|
||||||
MSP.read(info);
|
MSP.read(info);
|
||||||
} else if (CONFIGURATOR.cliActive) {
|
} else if (CONFIGURATOR.cliActive) {
|
||||||
TABS.cli.read(info);
|
TABS.cli.read(info);
|
||||||
} else if (CONFIGURATOR.mspPassThrough) {
|
|
||||||
MSP.read(info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
main.js
2
main.js
|
@ -56,7 +56,7 @@ $(document).ready(function () {
|
||||||
tab = $(self).parent().prop('class');
|
tab = $(self).parent().prop('class');
|
||||||
|
|
||||||
// if there is no active connection, return
|
// if there is no active connection, return
|
||||||
if (!CONFIGURATOR.connectionValid && tab != 'tab_logging') {
|
if (!CONFIGURATOR.connectionValid) {
|
||||||
GUI.log('You need to <strong>connect</strong> before you can view any of the tabs');
|
GUI.log('You need to <strong>connect</strong> before you can view any of the tabs');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,10 @@ TABS.logging.initialize = function (callback) {
|
||||||
GUI.active_tab = 'logging';
|
GUI.active_tab = 'logging';
|
||||||
googleAnalytics.sendAppView('Logging');
|
googleAnalytics.sendAppView('Logging');
|
||||||
|
|
||||||
var requested_properties = [];
|
var requested_properties = [],
|
||||||
|
samples = 0,
|
||||||
|
requests = 0,
|
||||||
|
log_buffer = [];
|
||||||
|
|
||||||
if (CONFIGURATOR.connectionValid) {
|
if (CONFIGURATOR.connectionValid) {
|
||||||
var get_motor_data = function () {
|
var get_motor_data = function () {
|
||||||
|
@ -18,20 +21,6 @@ TABS.logging.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_RC, false, false, get_motor_data);
|
MSP.send_message(MSP_codes.MSP_RC, false, false, get_motor_data);
|
||||||
} else {
|
|
||||||
CONFIGURATOR.mspPassThrough = 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() {
|
function process_html() {
|
||||||
|
@ -68,12 +57,10 @@ TABS.logging.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// request new
|
// request new
|
||||||
if (!CONFIGURATOR.mspPassThrough) {
|
|
||||||
for (var i = 0; i < requested_properties.length; i++, requests++) {
|
for (var i = 0; i < requested_properties.length; i++, requests++) {
|
||||||
MSP.send_message(MSP_codes[requested_properties[i]]);
|
MSP.send_message(MSP_codes[requested_properties[i]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GUI.interval_add('log_data_poll', log_data_poll, parseInt($('select.speed').val()), true); // refresh rate goes here
|
GUI.interval_add('log_data_poll', log_data_poll, parseInt($('select.speed').val()), true); // refresh rate goes here
|
||||||
GUI.interval_add('write_data', function write_data() {
|
GUI.interval_add('write_data', function write_data() {
|
||||||
|
@ -111,22 +98,6 @@ TABS.logging.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CONFIGURATOR.mspPassThrough) {
|
|
||||||
$('a.back').show();
|
|
||||||
|
|
||||||
$('a.back').click(function() {
|
|
||||||
if (GUI.connected_to) {
|
|
||||||
$('a.connect').click();
|
|
||||||
} else {
|
|
||||||
GUI.tab_switch_cleanup(function () {
|
|
||||||
CONFIGURATOR.mspPassThrough = false;
|
|
||||||
$('#tabs > ul li').removeClass('active');
|
|
||||||
TABS.default.initialize();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
chrome.storage.local.get('logging_file_entry', function (result) {
|
chrome.storage.local.get('logging_file_entry', function (result) {
|
||||||
if (result.logging_file_entry) {
|
if (result.logging_file_entry) {
|
||||||
chrome.fileSystem.restoreEntry(result.logging_file_entry, function (entry) {
|
chrome.fileSystem.restoreEntry(result.logging_file_entry, function (entry) {
|
||||||
|
@ -201,10 +172,6 @@ TABS.logging.initialize = function (callback) {
|
||||||
append_to_file(head);
|
append_to_file(head);
|
||||||
}
|
}
|
||||||
|
|
||||||
var samples = 0,
|
|
||||||
requests = 0,
|
|
||||||
log_buffer = [];
|
|
||||||
|
|
||||||
function crunch_data() {
|
function crunch_data() {
|
||||||
var sample = millitime();
|
var sample = millitime();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue