@@ -2475,11 +2475,7 @@ MspHelper.prototype.dataflashRead = function(address, blockSize, onDataCallback)
24752475 if ( chunkAddress === address ) {
24762476 try {
24772477 if ( dataCompressionType === 0 ) {
2478- payloadView = new DataView (
2479- response . data . buffer ,
2480- response . data . byteOffset + headerSize ,
2481- dataSize
2482- ) ;
2478+ payloadView = new DataView ( response . data . buffer , response . data . byteOffset + headerSize , dataSize ) ;
24832479 } else if ( dataCompressionType === 1 ) {
24842480 const compressedCharCount = response . data . readU16 ( ) ;
24852481 const compressedArray = new Uint8Array (
@@ -2497,20 +2493,24 @@ MspHelper.prototype.dataflashRead = function(address, blockSize, onDataCallback)
24972493 }
24982494 } catch ( e ) {
24992495 console . warn ( 'Decompression or read failed, delivering raw data anyway' ) ;
2500- payloadView = new DataView (
2501- response . data . buffer ,
2502- response . data . byteOffset + headerSize ,
2503- dataSize
2504- ) ;
2496+ payloadView = new DataView ( response . data . buffer , response . data . byteOffset + headerSize , dataSize ) ;
25052497 }
25062498 } else {
25072499 console . log ( `Expected address ${ address } but received ${ chunkAddress } ` ) ;
25082500 }
25092501 }
25102502
25112503 // Deliver payloadView if defined, otherwise pass null
2512- }
2513- } ;
2504+ onDataCallback ( address , payloadView ) ;
2505+
2506+ if ( ! response || response . crcError ) {
2507+ console . log ( `CRC error or missing data at address ${ address } - delivering whatever we got` ) ;
2508+ } else if ( payloadView ) {
2509+ console . log ( `Block at ${ address } received (${ payloadView . byteLength } bytes)` ) ;
2510+ }
2511+ } , true ) ; // end of send_message
2512+ } ; // end of dataflashRead
2513+
25142514
25152515MspHelper . prototype . sendAdjustmentRanges = function ( onCompleteCallback ) {
25162516 let nextFunction = send_next_adjustment_range ;
0 commit comments