Merge pull request #115 from sherlockflight/development
Fix endianness of board version read10.3.x-maintenance
commit
84e88e17bf
|
@ -887,6 +887,9 @@
|
||||||
"dataflashButtonEraseCancel": {
|
"dataflashButtonEraseCancel": {
|
||||||
"message": "Cancel"
|
"message": "Cancel"
|
||||||
},
|
},
|
||||||
|
"dataflashFileWriteFailed": {
|
||||||
|
"message": "Failed to write to the file you selected, are the permissions on that folder okay?"
|
||||||
|
},
|
||||||
"firmwareFlasherReleaseSummaryHead": {
|
"firmwareFlasherReleaseSummaryHead": {
|
||||||
"message": "Release info"
|
"message": "Release info"
|
||||||
},
|
},
|
||||||
|
|
|
@ -548,7 +548,7 @@ var MSP = {
|
||||||
identifier += String.fromCharCode(data.getUint8(offset));
|
identifier += String.fromCharCode(data.getUint8(offset));
|
||||||
}
|
}
|
||||||
CONFIG.boardIdentifier = identifier;
|
CONFIG.boardIdentifier = identifier;
|
||||||
CONFIG.boardVersion = data.getUint16(offset);
|
CONFIG.boardVersion = data.getUint16(offset, 1);
|
||||||
offset+=2;
|
offset+=2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,8 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
show_saving_dialog();
|
show_saving_dialog();
|
||||||
|
|
||||||
function onChunkRead(chunkAddress, chunkDataView) {
|
function onChunkRead(chunkAddress, chunkDataView) {
|
||||||
// If we didn't get a zero-byte chunk (indicating end-of-file), request more
|
if (chunkDataView != null) {
|
||||||
|
// Did we receive any data?
|
||||||
if (chunkDataView.byteLength > 0) {
|
if (chunkDataView.byteLength > 0) {
|
||||||
nextAddress += chunkDataView.byteLength;
|
nextAddress += chunkDataView.byteLength;
|
||||||
|
|
||||||
|
@ -148,8 +149,7 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
var
|
var
|
||||||
blob = new Blob([chunkDataView]);
|
blob = new Blob([chunkDataView]);
|
||||||
|
|
||||||
fileWriter.write(blob);
|
fileWriter.onwriteend = function(e) {
|
||||||
|
|
||||||
if (saveCancelled || nextAddress >= maxBytes) {
|
if (saveCancelled || nextAddress >= maxBytes) {
|
||||||
if (saveCancelled) {
|
if (saveCancelled) {
|
||||||
dismiss_saving_dialog();
|
dismiss_saving_dialog();
|
||||||
|
@ -159,11 +159,20 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
} else {
|
} else {
|
||||||
MSP.dataflashRead(nextAddress, onChunkRead);
|
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fileWriter.write(blob);
|
||||||
} else {
|
} else {
|
||||||
|
// A zero-byte block indicates end-of-file, so we're done
|
||||||
mark_saving_dialog_done();
|
mark_saving_dialog_done();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// There was an error with the received block (address didn't match the one we asked for), retry
|
||||||
|
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch the initial block
|
||||||
MSP.dataflashRead(nextAddress, onChunkRead);
|
MSP.dataflashRead(nextAddress, onChunkRead);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -178,8 +187,14 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
|
|
||||||
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename,
|
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename,
|
||||||
accepts: [{extensions: ['TXT']}]}, function(fileEntry) {
|
accepts: [{extensions: ['TXT']}]}, function(fileEntry) {
|
||||||
if (!fileEntry) {
|
var error = chrome.runtime.lastError;
|
||||||
console.log('No file selected');
|
|
||||||
|
if (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
|
||||||
|
if (error.message != "User cancelled") {
|
||||||
|
GUI.log(chrome.i18n.getMessage('dataflashFileWriteFailed'));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +214,7 @@ TABS.dataflash.initialize = function (callback) {
|
||||||
}, function (e) {
|
}, function (e) {
|
||||||
// File is not readable or does not exist!
|
// File is not readable or does not exist!
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
GUI.log(chrome.i18n.getMessage('dataflashFileWriteFailed'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue