mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 12:55:13 +03:00
global serial statistics, remove obsolete code
This commit is contained in:
parent
c51e6eb2fb
commit
2402c1b49b
2 changed files with 3 additions and 16 deletions
|
@ -42,6 +42,8 @@ var serial = {
|
||||||
console.log('SERIAL: Failed to close connection with ID: ' + self.connectionId + ' closed');
|
console.log('SERIAL: Failed to close connection with ID: ' + self.connectionId + ' closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('SERIAL: Statistics - Sent: ' + self.bytes_sent + ' bytes, Received: ' + self.bytes_received + ' bytes');
|
||||||
|
|
||||||
self.connectionId = -1;
|
self.connectionId = -1;
|
||||||
|
|
||||||
callback(result);
|
callback(result);
|
||||||
|
|
17
js/stm32.js
17
js/stm32.js
|
@ -40,10 +40,6 @@ var STM32_protocol = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Erase (x043) and Extended Erase (0x44) are exclusive. A device may support either the Erase command or the Extended Erase command but not both.
|
// Erase (x043) and Extended Erase (0x44) are exclusive. A device may support either the Erase command or the Extended Erase command but not both.
|
||||||
|
|
||||||
// debug variables
|
|
||||||
this.serial_bytes_send;
|
|
||||||
this.serial_bytes_received;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// string = string .. duh
|
// string = string .. duh
|
||||||
|
@ -136,9 +132,6 @@ STM32_protocol.prototype.initialize = function() {
|
||||||
|
|
||||||
self.verify_hex = [];
|
self.verify_hex = [];
|
||||||
|
|
||||||
self.serial_bytes_send = 0;
|
|
||||||
self.serial_bytes_received = 0;
|
|
||||||
|
|
||||||
self.upload_time_start = microtime();
|
self.upload_time_start = microtime();
|
||||||
|
|
||||||
self.steps_executed = 0;
|
self.steps_executed = 0;
|
||||||
|
@ -183,8 +176,6 @@ STM32_protocol.prototype.read = function(readInfo) {
|
||||||
self.receive_buffer.push(data[i]);
|
self.receive_buffer.push(data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.serial_bytes_received += data.length;
|
|
||||||
|
|
||||||
// routine that fetches data from buffer if statement is true
|
// routine that fetches data from buffer if statement is true
|
||||||
if (self.receive_buffer.length >= self.bytes_to_read && self.bytes_to_read != 0) {
|
if (self.receive_buffer.length >= self.bytes_to_read && self.bytes_to_read != 0) {
|
||||||
var data = self.receive_buffer.slice(0, self.bytes_to_read); // bytes requested
|
var data = self.receive_buffer.slice(0, self.bytes_to_read); // bytes requested
|
||||||
|
@ -220,11 +211,7 @@ STM32_protocol.prototype.send = function(Array, bytes_to_read, callback) {
|
||||||
this.read_callback = callback;
|
this.read_callback = callback;
|
||||||
|
|
||||||
// send over the actual data
|
// send over the actual data
|
||||||
serial.send(bufferOut, function(writeInfo) {
|
serial.send(bufferOut, function(writeInfo) {});
|
||||||
if (writeInfo.bytesSent > 0) {
|
|
||||||
self.serial_bytes_send += writeInfo.bytesSent;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// val = single byte to be verified
|
// val = single byte to be verified
|
||||||
|
@ -568,10 +555,8 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
||||||
break;
|
break;
|
||||||
case 99:
|
case 99:
|
||||||
// disconnect
|
// disconnect
|
||||||
|
|
||||||
GUI.interval_remove('STM32_timeout'); // stop STM32 timeout timer (everything is finished now)
|
GUI.interval_remove('STM32_timeout'); // stop STM32 timeout timer (everything is finished now)
|
||||||
|
|
||||||
console.log('Transfered: ' + self.serial_bytes_send + ' bytes, Received: ' + self.serial_bytes_received + ' bytes');
|
|
||||||
console.log('Script finished after: ' + (microtime() - self.upload_time_start).toFixed(4) + ' seconds, ' + self.steps_executed + ' steps');
|
console.log('Script finished after: ' + (microtime() - self.upload_time_start).toFixed(4) + ' seconds, ' + self.steps_executed + ' steps');
|
||||||
|
|
||||||
// close connection
|
// close connection
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue