mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-26 17:55:21 +03:00
Merge pull request #214 from sherlockflight/dataflash-refresh
Update used flash size before dataflash save begins so that new data is not missed
This commit is contained in:
commit
3e7da266ab
1 changed files with 59 additions and 47 deletions
|
@ -146,11 +146,23 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
$(".dataflash-saving").addClass("done");
|
$(".dataflash-saving").addClass("done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function flash_update_summary(onDone) {
|
||||||
|
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
||||||
|
update_html();
|
||||||
|
|
||||||
|
if (onDone) {
|
||||||
|
onDone();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function flash_save_begin() {
|
function flash_save_begin() {
|
||||||
|
if (GUI.connected_to) {
|
||||||
|
// Begin by refreshing the occupied size in case it changed while the tab was open
|
||||||
|
flash_update_summary(function() {
|
||||||
var
|
var
|
||||||
maxBytes = DATAFLASH.usedSize;
|
maxBytes = DATAFLASH.usedSize;
|
||||||
|
|
||||||
if (GUI.connected_to) {
|
|
||||||
prepare_file(function(fileWriter) {
|
prepare_file(function(fileWriter) {
|
||||||
var
|
var
|
||||||
nextAddress = 0;
|
nextAddress = 0;
|
||||||
|
@ -194,6 +206,7 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
// Fetch the initial block
|
// Fetch the initial block
|
||||||
MSP.dataflashRead(nextAddress, onChunkRead);
|
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,8 +259,7 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function poll_for_erase_completion() {
|
function poll_for_erase_completion() {
|
||||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
flash_update_summary(function() {
|
||||||
update_html();
|
|
||||||
if (!eraseCancelled) {
|
if (!eraseCancelled) {
|
||||||
if (DATAFLASH.ready) {
|
if (DATAFLASH.ready) {
|
||||||
$(".dataflash-confirm-erase")[0].close();
|
$(".dataflash-confirm-erase")[0].close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue