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

add callback to flashing protocols (no status yet)

This commit is contained in:
cTn 2014-10-01 15:55:11 +02:00
parent 3312bf5df2
commit 8fb24b3fa4
2 changed files with 26 additions and 10 deletions

View file

@ -13,6 +13,7 @@
'use strict';
var STM32DFU_protocol = function () {
this.callback; // ref
this.hex; // ref
this.verify_hex;
@ -62,12 +63,13 @@ var STM32DFU_protocol = function () {
};
};
STM32DFU_protocol.prototype.connect = function (device, hex) {
STM32DFU_protocol.prototype.connect = function (device, hex, callback) {
var self = this;
self.hex = hex;
self.callback = callback;
// reset and set some variables before we start
self.upload_time_start = millitime();
self.upload_time_start = new Date().getTime();
self.verify_hex = [];
// reset progress bar to initial state
@ -466,9 +468,13 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
break;
case 99:
// cleanup
console.log('Script finished after: ' + ((millitime() - self.upload_time_start) / 1000) + ' seconds');
self.releaseInterface(0);
var timeSpent = new Date().getTime() - self.upload_time_start;
console.log('Script finished after: ' + (timeSpent / 1000) + ' seconds');
if (self.callback) callback();
break;
}
};