mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
polishing flashing protocol
This commit is contained in:
parent
1e89ffd808
commit
49317da015
1 changed files with 11 additions and 11 deletions
22
js/stm32.js
22
js/stm32.js
|
@ -75,9 +75,9 @@ STM32_protocol.prototype.connect = function() {
|
||||||
|
|
||||||
if (!$('input.updating').is(':checked')) {
|
if (!$('input.updating').is(':checked')) {
|
||||||
chrome.serial.open(selected_port, {bitrate: baud}, function(openInfo) {
|
chrome.serial.open(selected_port, {bitrate: baud}, function(openInfo) {
|
||||||
connectionId = openInfo.connectionId;
|
if (openInfo.connectionId > 0) {
|
||||||
|
connectionId = openInfo.connectionId;
|
||||||
if (connectionId != -1) {
|
|
||||||
console.log('Connection was opened with ID: ' + connectionId + ' Baud: ' + baud);
|
console.log('Connection was opened with ID: ' + connectionId + ' Baud: ' + baud);
|
||||||
console.log('Sending ascii "R" to reboot');
|
console.log('Sending ascii "R" to reboot');
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@ STM32_protocol.prototype.connect = function() {
|
||||||
console.log('Connection closed successfully.');
|
console.log('Connection closed successfully.');
|
||||||
|
|
||||||
chrome.serial.open(selected_port, {bitrate: flashing_bitrate, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
chrome.serial.open(selected_port, {bitrate: flashing_bitrate, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
||||||
connectionId = openInfo.connectionId;
|
if (openInfo.connectionId > 0) {
|
||||||
|
connectionId = openInfo.connectionId;
|
||||||
if (connectionId != -1) {
|
|
||||||
console.log('Connection was opened with ID: ' + connectionId + ' Baud: ' + flashing_bitrate);
|
console.log('Connection was opened with ID: ' + connectionId + ' Baud: ' + flashing_bitrate);
|
||||||
|
|
||||||
self.initialize();
|
self.initialize();
|
||||||
|
@ -111,9 +111,9 @@ STM32_protocol.prototype.connect = function() {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
chrome.serial.open(selected_port, {bitrate: flashing_bitrate, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
chrome.serial.open(selected_port, {bitrate: flashing_bitrate, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
||||||
connectionId = openInfo.connectionId;
|
if (openInfo.connectionId > 0) {
|
||||||
|
connectionId = openInfo.connectionId;
|
||||||
if (connectionId != -1) {
|
|
||||||
console.log('Connection was opened with ID: ' + connectionId + ' Baud: ' + flashing_bitrate);
|
console.log('Connection was opened with ID: ' + connectionId + ' Baud: ' + flashing_bitrate);
|
||||||
|
|
||||||
// we are connected, disabling connect button in the UI
|
// we are connected, disabling connect button in the UI
|
||||||
|
@ -569,10 +569,10 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
||||||
|
|
||||||
// close connection
|
// close connection
|
||||||
chrome.serial.close(connectionId, function(result) {
|
chrome.serial.close(connectionId, function(result) {
|
||||||
|
connectionId = -1; // reset connection id
|
||||||
|
|
||||||
if (result) { // All went as expected
|
if (result) { // All went as expected
|
||||||
console.log('Connection closed successfully.');
|
console.log('Connection closed successfully.');
|
||||||
|
|
||||||
connectionId = -1; // reset connection id
|
|
||||||
} else { // Something went wrong
|
} else { // Something went wrong
|
||||||
console.log('There was an error that happened during "connection-close" procedure');
|
console.log('There was an error that happened during "connection-close" procedure');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue