flashing protocol changes

10.3.x-maintenance
cTn 2014-01-27 21:37:42 +01:00
parent 2402c1b49b
commit c2a4223868
1 changed files with 6 additions and 5 deletions

View File

@ -198,8 +198,6 @@ STM32_protocol.prototype.retrieve = function(n_bytes, callback) {
// bytes_to_read = received bytes necessary to trigger read_callback
// callback = function that will be executed after received bytes = bytes_to_read
STM32_protocol.prototype.send = function(Array, bytes_to_read, callback) {
var self = this;
var bufferOut = new ArrayBuffer(Array.length);
var bufferView = new Uint8Array(bufferOut);
@ -210,6 +208,9 @@ STM32_protocol.prototype.send = function(Array, bytes_to_read, callback) {
this.bytes_to_read = bytes_to_read;
this.read_callback = callback;
// empty receive buffer before next command is out
this.receive_buffer = [];
// send over the actual data
serial.send(bufferOut, function(writeInfo) {});
};
@ -359,7 +360,7 @@ STM32_protocol.prototype.upload_procedure = function(step) {
self.send([self.command.get, 0xFF], 2, function(data) { // 0x00 ^ 0xFF
if (self.verify_response(self.status.ACK, data)) {
self.retrieve(data[1] + 2, function(data) { // data[1] = number of bytes that will follow (should be 12 + ack)
console.log('STM32 - Bootloader version: ' + (parseInt(data[0].toString(16)) / 10).toFixed(1)); // convert dec to hex, hex to dec and add floating point
console.log('STM32 - Bootloader version: ' + (parseInt(data[1].toString(16)) / 10).toFixed(1)); // convert dec to hex, hex to dec and add floating point
// proceed to next step
self.upload_procedure(3);