mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-26 09:45:23 +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");
|
||||
}
|
||||
|
||||
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() {
|
||||
if (GUI.connected_to) {
|
||||
// Begin by refreshing the occupied size in case it changed while the tab was open
|
||||
flash_update_summary(function() {
|
||||
var
|
||||
maxBytes = DATAFLASH.usedSize;
|
||||
|
||||
if (GUI.connected_to) {
|
||||
prepare_file(function(fileWriter) {
|
||||
var
|
||||
nextAddress = 0;
|
||||
|
@ -194,6 +206,7 @@ TABS.dataflash.initialize = function (callback) {
|
|||
// Fetch the initial block
|
||||
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,8 +259,7 @@ TABS.dataflash.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function poll_for_erase_completion() {
|
||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
|
||||
update_html();
|
||||
flash_update_summary(function() {
|
||||
if (!eraseCancelled) {
|
||||
if (DATAFLASH.ready) {
|
||||
$(".dataflash-confirm-erase")[0].close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue