mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
polishing across the board
This commit is contained in:
parent
93fed34799
commit
a06e37603f
3 changed files with 43 additions and 2 deletions
12
js/stm32.js
12
js/stm32.js
|
@ -42,6 +42,11 @@ var STM32_protocol = function() {
|
|||
// Erase (x043) and Extended Erase (0x44) are exclusive. A device may support either the Erase command or the Extended Erase command but not both.
|
||||
};
|
||||
|
||||
// string = string .. duh
|
||||
STM32_protocol.prototype.GUI_status = function(string) {
|
||||
$('span.status').html(string);
|
||||
};
|
||||
|
||||
// no input parameters
|
||||
STM32_protocol.prototype.connect = function() {
|
||||
var self = this;
|
||||
|
@ -97,6 +102,7 @@ STM32_protocol.prototype.initialize = function() {
|
|||
self.steps_executed_last = self.steps_executed;
|
||||
} else {
|
||||
console.log('STM32 - timed out, programming failed ...');
|
||||
STM32.GUI_status('STM32 - timed out, programming: <strong style="color: red">FAILED</strong>');
|
||||
|
||||
// protocol got stuck, clear timer and disconnect
|
||||
GUI.interval_remove('STM32_timeout');
|
||||
|
@ -243,6 +249,7 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
|||
case 0:
|
||||
// reboot into bootloader mode
|
||||
console.log('STM32 - Trying to jump into bootloader mode');
|
||||
STM32.GUI_status('Rebooting');
|
||||
self.send([0x52]);
|
||||
|
||||
GUI.timeout_add('reboot_into_bootloader', function() {
|
||||
|
@ -297,6 +304,7 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
|||
case 4:
|
||||
// erase memory
|
||||
console.log('Executing global chip erase');
|
||||
STM32.GUI_status('Erasing');
|
||||
|
||||
self.send([self.command.erase, 0xBC], 1, function(reply) { // 0x43 ^ 0xFF
|
||||
if (self.verify_response(self.status.ACK, reply)) {
|
||||
|
@ -304,6 +312,7 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
|||
if (self.verify_response(self.status.ACK, reply)) {
|
||||
console.log('Erasing: done');
|
||||
console.log('Writing data ...');
|
||||
STM32.GUI_status('<span style="color: green">Flashing ...</span>');
|
||||
|
||||
// proceed to next step
|
||||
self.upload_procedure(5);
|
||||
|
@ -359,6 +368,7 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
|||
} else {
|
||||
console.log('Writing: done');
|
||||
console.log('Verifying data ...');
|
||||
STM32.GUI_status('<span style="color: green">Verifying ...</span>');
|
||||
|
||||
// proceed to next step
|
||||
self.upload_procedure(6);
|
||||
|
@ -409,12 +419,14 @@ STM32_protocol.prototype.upload_procedure = function(step) {
|
|||
if (result) {
|
||||
console.log('Verifying: done');
|
||||
console.log('Programming: SUCCESSFUL');
|
||||
STM32.GUI_status('Programming: <strong style="color: green">SUCCESSFUL</strong>');
|
||||
|
||||
// proceed to next step
|
||||
self.upload_procedure(7);
|
||||
} else {
|
||||
console.log('Verifying: failed');
|
||||
console.log('Programming: FAILED');
|
||||
STM32.GUI_status('Programming: <strong style="color: red">FAILED</strong>');
|
||||
|
||||
// disconnect
|
||||
self.upload_procedure(99);
|
||||
|
|
|
@ -2,6 +2,23 @@
|
|||
.tab-firmware_flasher .info {
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
.tab-firmware_flasher .info strong {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.tab-firmware_flasher .note {
|
||||
float: left;
|
||||
|
||||
margin-bottom: 10px;
|
||||
padding: 5px;
|
||||
|
||||
border: 1px dotted silver;
|
||||
}
|
||||
.tab-firmware_flasher .note p {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.tab-firmware_flasher .note input {
|
||||
margin-top: 2px;
|
||||
}
|
||||
a.load_file {
|
||||
display: block;
|
||||
float: left;
|
||||
|
@ -40,9 +57,18 @@
|
|||
</style>
|
||||
<div class="tab-firmware_flasher">
|
||||
<div class="info">
|
||||
<span>Path:</span><span class="path"></span><br />
|
||||
<span>Size:</span><span class="size"></span>
|
||||
<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 />
|
||||
</div>
|
||||
<div class="note">
|
||||
<span style="font-weight: bold; margin-right: 10px;">Reboot sequence:</span><input class="updating" type="checkbox" checked="checked"/>
|
||||
<p>
|
||||
If you are flashing board with <strong>baseflight</strong> already flashed (updating), leave this checkbox checked.<br />
|
||||
If you are flashing "<strong>bare</strong>" board with no firmware preloaded or you have bootloader pins <strong>shorted</strong>, uncheck this checkbox.<br />
|
||||
</p>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
<a class="load_file" href="#">Load Firmware</a>
|
||||
<a class="flash_firmware" href="#">Flash Firmware</a>
|
||||
</div>
|
|
@ -28,6 +28,7 @@ function tab_initialize_firmware_flasher() {
|
|||
|
||||
reader.onloadend = function(e) {
|
||||
console.log('File loaded');
|
||||
STM32.GUI_status('<span style="color: green">Firmware loaded, ready for flashing</span>');
|
||||
|
||||
intel_hex = e.target.result;
|
||||
raw_hex = read_hex_file(intel_hex);
|
||||
|
@ -46,6 +47,8 @@ function tab_initialize_firmware_flasher() {
|
|||
STM32.hex_to_flash = raw_hex.slice(0);
|
||||
|
||||
STM32.connect();
|
||||
} else {
|
||||
STM32.GUI_status('<span style="color: red">Firmware not loaded</span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue