Use the CRC we generate for the image in the init packet.

This commit is contained in:
Michael Dietz
2016-02-26 11:17:03 +01:00
parent 03450d44b4
commit c551b074f3
4 changed files with 11 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
var dfu = require('./index').dfu;
var hex2bin = require('./index').hex2bin;
var crc16 = require('./index').crc16;
var fs = require('fs');
var log = console.log;
@@ -40,8 +41,9 @@ dfu.findDevice({ services: [0x180D] })
var hex = file.toString();
var buffer = hex2bin(hex);
log("file length: " + buffer.byteLength);
var crc = crc16(buffer);
return dfu.provision(device, buffer);
return dfu.provision(device, buffer, 4, crc);
})
.then(() => process.exit())
.catch(error => {