1
0
Fork 0
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:
cTn 2013-11-14 19:02:32 +01:00
parent fd50a72d0a
commit d73ebb2614
2 changed files with 20 additions and 8 deletions

View file

@ -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>

View file

@ -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,14 +56,17 @@ 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 (!$(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);
@ -72,6 +76,7 @@ function tab_initialize_firmware_flasher() {
STM32.GUI_status('<span style="color: red">Firmware not loaded</span>');
}
}
}
});
$('a.back').click(function() {