implements progress bar fix #7
parent
f11a26ac90
commit
55de43255c
16
js/stm32.js
16
js/stm32.js
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,20 @@
|
|||
.tab-firmware_flasher .info strong {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.tab-firmware_flasher .info .progress {
|
||||
width: 140px;
|
||||
|
||||
border: 1px solid silver;
|
||||
}
|
||||
.tab-firmware_flasher .info .progress::-webkit-progress-value {
|
||||
background-color: #f4af4d;
|
||||
}
|
||||
.tab-firmware_flasher .info .progress.valid::-webkit-progress-value {
|
||||
background-color: #43c232;
|
||||
}
|
||||
.tab-firmware_flasher .info .progress.invalid::-webkit-progress-value {
|
||||
background-color: #cf2222;
|
||||
}
|
||||
.tab-firmware_flasher .note {
|
||||
float: left;
|
||||
|
||||
|
@ -108,6 +122,7 @@
|
|||
<strong>Path:</strong><span class="path">empty</span><br />
|
||||
<strong>Size:</strong><span class="size">0.000 kb</span><br />
|
||||
<strong>Status:</strong><span class="status">Firmware not loaded</span><br />
|
||||
<strong>Progress:</strong><progress class="progress" value="0" min="0" max="100"></progress>
|
||||
</div>
|
||||
<div class="note">
|
||||
<p>
|
||||
|
|
Loading…
Reference in New Issue