1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-16 12:55:13 +03:00

implements progress bar fix #7

This commit is contained in:
cTn 2013-11-16 13:03:42 +01:00
parent f11a26ac90
commit 55de43255c
2 changed files with 31 additions and 0 deletions

View file

@ -145,6 +145,11 @@ STM32_protocol.prototype.initialize = function() {
self.steps_executed = 0;
self.steps_executed_last = 0;
// reset progress bar to initial state
self.progress_bar_e = $('.progress');
self.progress_bar_e.val(0);
self.progress_bar_e.removeClass('valid invalid');
GUI.interval_add('firmware_uploader_read', function() {
self.read();
@ -437,6 +442,8 @@ STM32_protocol.prototype.upload_procedure = function(step) {
}
});
// update progress bar
self.progress_bar_e.val(self.bytes_flashed / (self.hex.bytes * 2) * 100);
} else {
console.log('Writing: done');
console.log('Verifying data ...');
@ -485,6 +492,9 @@ STM32_protocol.prototype.upload_procedure = function(step) {
});
}
});
// update progress bar
self.progress_bar_e.val((self.bytes_flashed + self.bytes_verified) / (self.hex.bytes * 2) * 100);
} else {
var result = self.verify_flash(self.hex.data, self.verify_hex);
@ -493,6 +503,9 @@ STM32_protocol.prototype.upload_procedure = function(step) {
console.log('Programming: SUCCESSFUL');
STM32.GUI_status('Programming: <strong style="color: green">SUCCESSFUL</strong>');
// update progress bar
self.progress_bar_e.addClass('valid');
// proceed to next step
self.upload_procedure(7);
} else {
@ -500,6 +513,9 @@ STM32_protocol.prototype.upload_procedure = function(step) {
console.log('Programming: FAILED');
STM32.GUI_status('Programming: <strong style="color: red">FAILED</strong>');
// update progress bar
self.progress_bar_e.addClass('invalid');
// disconnect
self.upload_procedure(99);
}