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

Revert "Blackbox download crc error packet retry - version 2"

This commit is contained in:
Michael Keller 2017-02-07 07:59:30 +13:00 committed by GitHub
parent 88d91a78a3
commit 70a172f9e0
2 changed files with 8 additions and 13 deletions

View file

@ -11,7 +11,6 @@ var MSP = {
message_buffer_uint8_view: null, message_buffer_uint8_view: null,
message_checksum: 0, message_checksum: 0,
messageIsJumboFrame: false, messageIsJumboFrame: false,
crcError: false,
callbacks: [], callbacks: [],
packet_error: 0, packet_error: 0,
@ -110,19 +109,19 @@ var MSP = {
} }
break; break;
case 9: case 9:
if (this.message_checksum != data[i]) { if (this.message_checksum == data[i]) {
console.log('code: ' + this.code + ' - crc failed');
this.packet_error++;
this.crcError = true;
}
// message received, store dataview // message received, store dataview
this.dataView = new DataView(this.message_buffer, 0, this.message_length_expected); this.dataView = new DataView(this.message_buffer, 0, this.message_length_expected);
} else {
console.log('code: ' + this.code + ' - crc failed');
this.dataView = null;
this.packet_error++;
}
// Reset variables // Reset variables
this.message_length_received = 0; this.message_length_received = 0;
this.state = 0; this.state = 0;
this.messageIsJumboFrame = false; this.messageIsJumboFrame = false;
this.notify(); this.notify();
this.crcError = false;
break; break;
default: default:

View file

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