mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
adding lockdown protection on flash button
This commit is contained in:
parent
fd50a72d0a
commit
d73ebb2614
2 changed files with 20 additions and 8 deletions
|
@ -55,6 +55,13 @@
|
|||
a.flash_firmware:hover {
|
||||
background-color: #dedcdc;
|
||||
}
|
||||
a.flash_firmware.locked {
|
||||
background-color: #b8b8b8;
|
||||
}
|
||||
a.flash_firmware.locked:hover {
|
||||
cursor: default;
|
||||
background-color: #b8b8b8;
|
||||
}
|
||||
a.back {
|
||||
display: block;
|
||||
position: absolute;
|
||||
|
@ -112,7 +119,7 @@
|
|||
<div class="clear-both"></div>
|
||||
<a class="load_file" href="#">Load Firmware [Local]</a>
|
||||
<a class="load_remote_file" href="#">Load Firmware [Online]</a>
|
||||
<a class="flash_firmware" href="#">Flash Firmware</a>
|
||||
<a class="flash_firmware locked" href="#">Flash Firmware</a>
|
||||
<div class="clear-both"></div>
|
||||
<div class="warning">
|
||||
<div class="title">Warning</div>
|
||||
|
|
|
@ -34,6 +34,7 @@ function tab_initialize_firmware_flasher() {
|
|||
raw_hex = read_hex_file(intel_hex);
|
||||
|
||||
$('span.size').html((raw_hex.length / 1000) + ' kB');
|
||||
$('a.flash_firmware').removeClass('locked');
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
|
@ -55,21 +56,25 @@ function tab_initialize_firmware_flasher() {
|
|||
|
||||
$('span.path').html('Using remote Firmware');
|
||||
$('span.size').html((raw_hex.length / 1000) + ' kB');
|
||||
$('a.flash_firmware').removeClass('locked');
|
||||
|
||||
STM32.GUI_status('<span style="color: green">Remote Firmware loaded, ready for flashing</span>');
|
||||
}).fail(function() {
|
||||
STM32.GUI_status('<span style="color: red">Failed to load remote firmware</span>');
|
||||
$('a.flash_firmware').addClass('locked');
|
||||
});
|
||||
});
|
||||
|
||||
$('a.flash_firmware').click(function() {
|
||||
if (!GUI.connect_lock) { // button disabled while flashing is in progress
|
||||
if (raw_hex != false) {
|
||||
STM32.hex_to_flash = raw_hex.slice(0);
|
||||
|
||||
STM32.connect();
|
||||
} else {
|
||||
STM32.GUI_status('<span style="color: red">Firmware not loaded</span>');
|
||||
if (!$(this).hasClass('locked')) {
|
||||
if (!GUI.connect_lock) { // button disabled while flashing is in progress
|
||||
if (raw_hex != false) {
|
||||
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