mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
initial code for reading local hex file
This commit is contained in:
parent
5033273773
commit
f15f749ed3
2 changed files with 39 additions and 1 deletions
|
@ -0,0 +1,7 @@
|
|||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
<div class="tab-firmware_flasher">
|
||||
<a class="load_file" href="#">Load Firmware</a>
|
||||
<a class="flash_firmware" href="#">Flash Firmware</a>
|
||||
</div>
|
|
@ -2,7 +2,38 @@ function tab_initialize_firmware_flasher() {
|
|||
ga_tracker.sendAppView('Firmware Flasher');
|
||||
GUI.active_tab = 'firmware_flasher';
|
||||
|
||||
var intel_hex = false;
|
||||
|
||||
$('#content').load("./tabs/firmware_flasher.html", function() {
|
||||
// empty for now
|
||||
// UI Hooks
|
||||
$('a.load_file').click(function() {
|
||||
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [{extensions: ['hex']}]}, function(fileEntry) {
|
||||
if (!fileEntry) {
|
||||
// no "valid" file selected/created, aborting
|
||||
console.log('No valid file selected, aborting');
|
||||
return;
|
||||
}
|
||||
|
||||
chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
|
||||
console.log('Loading file from: ' + path);
|
||||
|
||||
fileEntry.file(function(file) {
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onerror = function (e) {
|
||||
console.error(e);
|
||||
};
|
||||
|
||||
reader.onloadend = function(e) {
|
||||
console.log('File loaded');
|
||||
|
||||
intel_hex = e.target.result;
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue