1
0
Fork 0
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:
Dominic Clifton 2015-07-13 18:12:18 +01:00
commit 3e7da266ab

View file

@ -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();