1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-22 15:55:33 +03:00

Merge pull request #1247 from mikeller/clarify_chunk_handling

Clarify handling of compressed byte count when downloading uncompressed data flash.
This commit is contained in:
Michael Keller 2018-12-06 21:28:52 +13:00 committed by GitHub
commit 15743a9b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -395,11 +395,10 @@ TABS.onboard_logging.initialize = function (callback) {
var totalTime = (new Date().getTime() - startTime) / 1000;
console.log('Received ' + totalBytes + ' bytes in ' + totalTime.toFixed(2) + 's ('
+ (totalBytes / totalTime / 1024).toFixed(2) + 'kB / s) with block size ' + self.blockSize + '.');
if (totalBytesCompressed) {
if (!isNaN(totalBytesCompressed)) {
console.log('Compressed into', totalBytesCompressed, 'bytes with mean compression factor of', totalBytes / totalBytesCompressed);
}
$(".dataflash-saving").addClass("done");
}
@ -440,7 +439,11 @@ TABS.onboard_logging.initialize = function (callback) {
// Did we receive any data?
if (chunkDataView.byteLength > 0) {
nextAddress += chunkDataView.byteLength;
totalBytesCompressed += bytesCompressed;
if (isNaN(bytesCompressed) || isNaN(totalBytesCompressed)) {
totalBytesCompressed = null;
} else {
totalBytesCompressed += bytesCompressed;
}
$(".dataflash-saving progress").attr("value", nextAddress / maxBytes * 100);