1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

Merge remote-tracking branch 'multiwii/master'

Conflicts:
	README.md
	_locales/en/messages.json
	changelog.html
	js/backup_restore.js
	js/data_storage.js
	js/msp.js
	js/protocols/stm32.js
	js/serial_backend.js
	main.css
	main.html
	main.js
	manifest.json
	tabs/auxiliary_configuration.css
	tabs/default.css
	tabs/firmware_flasher.js
	tabs/initial_setup.css
	tabs/initial_setup.html
	tabs/initial_setup.js
	tabs/modes.html
	tabs/modes.js
	tabs/motor_outputs.css
	tabs/motors.html
	tabs/receiver.css
	tabs/servos.js
This commit is contained in:
Dominic Clifton 2014-12-18 22:38:55 +00:00
commit a8cf910f51
108 changed files with 12813 additions and 4551 deletions

View file

@ -3,10 +3,9 @@
$(document).ready(function () {
$('div#port-picker a.connect').click(function () {
if (GUI.connect_lock != true) { // GUI control overrides the user control
var clicks = $(this).data('clicks');
var selected_port = String($('div#port-picker #port').val());
var selected_baud = parseInt($('div#port-picker #baud').val());
var clicks = $(this).data('clicks'),
selected_port = String($('div#port-picker #port').val()),
selected_baud = parseInt($('div#port-picker #baud').val());
if (selected_port != '0' && selected_port != 'DFU') {
if (!clicks) {
@ -27,31 +26,33 @@ $(document).ready(function () {
serial.disconnect(onClosed);
GUI.connected_to = false;
CONFIGURATOR.connectionValid = false;
MSP.disconnect_cleanup();
PortUsage.reset();
// Reset various UI elements
$('span.i2c-error').text(0);
$('span.cycle-time').text(0);
MSP.disconnect_cleanup();
PortUsage.reset();
CONFIGURATOR.connectionValid = false;
CONFIGURATOR.mspPassThrough = false;
// unlock port select & baud
$('div#port-picker #port').prop('disabled', false);
if (!GUI.auto_connect) $('div#port-picker #baud').prop('disabled', false);
// reset connect / disconnect button
$(this).text(chrome.i18n.getMessage('connect'));
$(this).removeClass('active');
sensor_status(0); // reset active sensor indicators
$('#tabs > ul li').removeClass('active'); // de-select any selected tabs
// reset active sensor indicators
sensor_status(0);
// de-select any selected tabs
$('#tabs > ul li').removeClass('active');
// detach listeners and remove element data
$('#content').empty();
// load default html
TABS.default.initialize();
TABS.landing.initialize();
}
$(this).data("clicks", !clicks);
@ -125,44 +126,43 @@ function onOpen(openInfo) {
serial.onReceive.addListener(read_serial);
if (!CONFIGURATOR.mspPassThrough) {
// disconnect after 10 seconds with error if we don't get IDENT data
GUI.timeout_add('connecting', function () {
if (!CONFIGURATOR.connectionValid) {
GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
// disconnect after 10 seconds with error if we don't get IDENT data
GUI.timeout_add('connecting', function () {
if (!CONFIGURATOR.connectionValid) {
GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
$('div#port-picker a.connect').click(); // disconnect
}
}, 10000);
$('div#port-picker a.connect').click(); // disconnect
}
}, 10000);
MSP.send_message(MSP_codes.MSP_API_VERSION, false, false, function () {
GUI.log(chrome.i18n.getMessage('apiVersionReceived', [CONFIG.apiVersion]));
});
// request configuration data
MSP.send_message(MSP_codes.MSP_UID, false, false, function () {
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
GUI.timeout_remove('connecting'); // kill connecting timer
MSP.send_message(MSP_codes.MSP_API_VERSION, false, false, function () {
GUI.log(chrome.i18n.getMessage('apiVersionReceived', [CONFIG.apiVersion]));
});
GUI.log(chrome.i18n.getMessage('firmwareVersion', [CONFIG.version]));
// request configuration data
MSP.send_message(MSP_codes.MSP_UID, false, false, function () {
GUI.timeout_remove('connecting'); // kill connecting timer
if (CONFIG.version >= CONFIGURATOR.firmwareVersionAccepted) {
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
if (CONFIG.version >= CONFIGURATOR.firmwareVersionAccepted) {
MSP.send_message(MSP_codes.MSP_BUILDINFO, false, false, function () {
googleAnalytics.sendEvent('Firmware', 'Using', CONFIG.buildInfo);
GUI.log('Running firmware released on: <strong>' + CONFIG.buildInfo + '</strong>');
// continue as usually
CONFIGURATOR.connectionValid = true;
$('div#port-picker a.connect').text(chrome.i18n.getMessage('disconnect')).addClass('active');
$('#tabs li a:first').click();
} else {
GUI.log(chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.firmwareVersionAccepted]));
$('div#port-picker a.connect').click(); // disconnect
}
});
});
} else {
GUI.log(chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.firmwareVersionAccepted]));
$('div#port-picker a.connect').click(); // disconnect
}
});
} 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'));
@ -187,12 +187,10 @@ function onClosed(result) {
}
function read_serial(info) {
if (!CONFIGURATOR.cliActive && !CONFIGURATOR.mspPassThrough) {
if (!CONFIGURATOR.cliActive) {
MSP.read(info);
} else if (CONFIGURATOR.cliActive) {
TABS.cli.read(info);
} else if (CONFIGURATOR.mspPassThrough) {
MSP.read(info);
}
}
@ -251,6 +249,10 @@ function lowByte(num) {
return 0x00FF & num;
}
function specificByte(num, pos) {
return 0x000000FF & (num >> (8 * pos));
}
function bit_check(num, bit) {
return ((num >> bit) % 2 != 0);
}