1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

Blackbox CRC error packet retry

This commit is contained in:
Bruce Luckcuck 2017-02-05 17:40:05 -05:00
parent a89220fb97
commit de2b9993a8
2 changed files with 13 additions and 8 deletions

View file

@ -52,6 +52,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
var data = dataHandler.dataView; // DataView (allowing us to view arrayBuffer as struct/union)
var code = dataHandler.code;
var crcError = dataHandler.crcError;
if (!dataHandler.unsupported) switch (code) {
case MSPCodes.MSP_STATUS:
CONFIG.cycleTime = data.readU16();
@ -957,7 +958,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
dataHandler.callbacks.splice(i, 1);
// fire callback
if (callback) callback({'command': code, 'data': data, 'length': data.byteLength});
if (callback) callback({'command': code, 'data': data, 'length': data.byteLength, 'crcError': crcError});
}
}
}
@ -1279,14 +1280,17 @@ MspHelper.prototype.dataflashRead = function(address, blockSize, onDataCallback)
dataCompressionType = response.data.readU8();
}
// Verify that the address of the memory returned matches what the caller asked for
if (chunkAddress == address) {
// Verify that the address of the memory returned matches what the caller asked for and there was not a CRC error
if ((chunkAddress == address) && !(response.crcError)) {
/* Strip that address off the front of the reply and deliver it separately so the caller doesn't have to
* figure out the reply format:
*/
onDataCallback(address, new DataView(response.data.buffer, response.data.byteOffset + headerSize, dataSize));
} else {
// Report error
if (response.crcError) {
console.log('CRC error for address ' + address + ' - retrying');
}
onDataCallback(address, null);
}
});