@@ -446,8 +446,6 @@ MspHelper.prototype.process_data = function(dataHandler) {
446446 '115200' ,
447447 '230400' ,
448448 '250000' ,
449- '500000' ,
450- '1000000'
451449 ] ;
452450 if ( semver . lt ( CONFIG . apiVersion , "1.6.0" ) ) {
453451 SERIAL_CONFIG . ports = [ ] ;
@@ -1048,8 +1046,6 @@ MspHelper.prototype.crunch = function(code) {
10481046 '115200' ,
10491047 '230400' ,
10501048 '250000' ,
1051- '500000' ,
1052- '1000000'
10531049 ] ; //TODO, instead of lookuptable, this should be sent as uint32
10541050 var serialPortFunctions = {
10551051 'MSP' : 0 ,
@@ -1209,29 +1205,17 @@ MspHelper.prototype.setRawRx = function(channels) {
12091205 * Send a request to read a block of data from the dataflash at the given address and pass that address and a dataview
12101206 * of the returned data to the given callback (or null for the data if an error occured).
12111207 */
1212- MspHelper . prototype . dataflashRead = function ( address , blockSize , onDataCallback ) {
1213- var outData = [ address & 0xFF , ( address >> 8 ) & 0xFF , ( address >> 16 ) & 0xFF , ( address >> 24 ) & 0xFF ] ;
1214-
1215- if ( semver . gte ( CONFIG . flightControllerVersion , "3.1.0" ) ) {
1216- outData = outData . concat ( [ blockSize & 0xFF , ( blockSize >> 8 ) & 0xFF ] ) ;
1217- }
1218-
1219- MSP . send_message ( MSPCodes . MSP_DATAFLASH_READ , outData , false , function ( response ) {
1208+ MspHelper . prototype . dataflashRead = function ( address , onDataCallback ) {
1209+ MSP . send_message ( MSPCodes . MSP_DATAFLASH_READ , [ address & 0xFF , ( address >> 8 ) & 0xFF , ( address >> 16 ) & 0xFF , ( address >> 24 ) & 0xFF ] ,
1210+ false , function ( response ) {
12201211 var chunkAddress = response . data . readU32 ( ) ;
1221-
1222- var headerSize = 4 ;
1223- var dataSize = response . data . buffer . byteLength - headerSize ;
1224- if ( semver . gte ( CONFIG . flightControllerVersion , "3.1.0" ) ) {
1225- headerSize = headerSize + 2 ;
1226- dataSize = response . data . readU16 ( ) ;
1227- }
1228-
1212+
12291213 // Verify that the address of the memory returned matches what the caller asked for
12301214 if ( chunkAddress == address ) {
12311215 /* Strip that address off the front of the reply and deliver it separately so the caller doesn't have to
12321216 * figure out the reply format:
12331217 */
1234- onDataCallback ( address , new DataView ( response . data . buffer , response . data . byteOffset + headerSize , dataSize ) ) ;
1218+ onDataCallback ( address , new DataView ( response . data . buffer , response . data . byteOffset + 4 , response . data . buffer . byteLength - 4 ) ) ;
12351219 } else {
12361220 // Report error
12371221 onDataCallback ( address , null ) ;
0 commit comments