Fix script to display the correct firmware version.

This commit is contained in:
László Monda
2018-01-15 00:02:57 +01:00
parent 7c065f4368
commit 96b9226adb

View File

@@ -2,14 +2,14 @@
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getModuleProperty, uhk.modulePropertyIds.protocolVersions]);
const sendData = new Buffer([uhk.usbCommands.getModuleProperty, uhk.moduleSlotToId.leftHalf, uhk.modulePropertyIds.protocolVersions]);
console.log(sendData)
device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync());
console.log(response)
const firmwareMajorVersion = response[7] + (response[8]<<8);
const firmwareMinorVersion = response[9] + (response[10]<<8);
const firmwarePatchVersion = response[11] + (response[12]<<8);
const firmwareMajorVersion = uhk.getUint16(response, 8);
const firmwareMinorVersion = uhk.getUint16(response, 10);
const firmwarePatchVersion = uhk.getUint16(response, 12);
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);