mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
implements progress bar fix #7
This commit is contained in:
parent
f11a26ac90
commit
55de43255c
2 changed files with 31 additions and 0 deletions
16
js/stm32.js
16
js/stm32.js
|
@ -146,6 +146,11 @@ STM32_protocol.prototype.initialize = function() {
|
||||||
self.steps_executed = 0;
|
self.steps_executed = 0;
|
||||||
self.steps_executed_last = 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() {
|
GUI.interval_add('firmware_uploader_read', function() {
|
||||||
self.read();
|
self.read();
|
||||||
}, 1, true);
|
}, 1, true);
|
||||||
|
@ -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 {
|
} else {
|
||||||
console.log('Writing: done');
|
console.log('Writing: done');
|
||||||
console.log('Verifying data ...');
|
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 {
|
} else {
|
||||||
var result = self.verify_flash(self.hex.data, self.verify_hex);
|
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');
|
console.log('Programming: SUCCESSFUL');
|
||||||
STM32.GUI_status('Programming: <strong style="color: green">SUCCESSFUL</strong>');
|
STM32.GUI_status('Programming: <strong style="color: green">SUCCESSFUL</strong>');
|
||||||
|
|
||||||
|
// update progress bar
|
||||||
|
self.progress_bar_e.addClass('valid');
|
||||||
|
|
||||||
// proceed to next step
|
// proceed to next step
|
||||||
self.upload_procedure(7);
|
self.upload_procedure(7);
|
||||||
} else {
|
} else {
|
||||||
|
@ -500,6 +513,9 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
||||||
console.log('Programming: FAILED');
|
console.log('Programming: FAILED');
|
||||||
STM32.GUI_status('Programming: <strong style="color: red">FAILED</strong>');
|
STM32.GUI_status('Programming: <strong style="color: red">FAILED</strong>');
|
||||||
|
|
||||||
|
// update progress bar
|
||||||
|
self.progress_bar_e.addClass('invalid');
|
||||||
|
|
||||||
// disconnect
|
// disconnect
|
||||||
self.upload_procedure(99);
|
self.upload_procedure(99);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,20 @@
|
||||||
.tab-firmware_flasher .info strong {
|
.tab-firmware_flasher .info strong {
|
||||||
margin-right: 5px;
|
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 {
|
.tab-firmware_flasher .note {
|
||||||
float: left;
|
float: left;
|
||||||
|
|
||||||
|
@ -108,6 +122,7 @@
|
||||||
<strong>Path:</strong><span class="path">empty</span><br />
|
<strong>Path:</strong><span class="path">empty</span><br />
|
||||||
<strong>Size:</strong><span class="size">0.000 kb</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>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>
|
||||||
<div class="note">
|
<div class="note">
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue