Clean up get-left-firmware-version.js a bit.
This commit is contained in:
@@ -3,10 +3,10 @@ const uhk = require('./uhk');
|
||||
|
||||
const device = uhk.getUhkDevice();
|
||||
const sendData = new Buffer([uhk.usbCommands.getModuleProperty, uhk.moduleSlotToId.leftHalf, uhk.modulePropertyIds.protocolVersions]);
|
||||
console.log(sendData)
|
||||
//console.log(sendData)
|
||||
device.write(uhk.getTransferData(sendData));
|
||||
const response = Buffer.from(device.readSync());
|
||||
console.log(response)
|
||||
//console.log(response)
|
||||
const moduleProtocolMajorVersion = uhk.getUint16(response, 2);
|
||||
const moduleProtocolMinorVersion = uhk.getUint16(response, 4);
|
||||
const moduleProtocolPatchVersion = uhk.getUint16(response, 6);
|
||||
|
||||
@@ -3,13 +3,12 @@ const uhk = require('./uhk');
|
||||
|
||||
const device = uhk.getUhkDevice();
|
||||
const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.protocolVersions]);
|
||||
//console.log(sendData)
|
||||
device.write(uhk.getTransferData(sendData));
|
||||
const response = Buffer.from(device.readSync());
|
||||
//console.log(response)
|
||||
const firmwareMajorVersion = uhk.getUint16(response, 1);
|
||||
const firmwareMinorVersion = uhk.getUint16(response, 3);
|
||||
const firmwarePatchVersion = uhk.getUint16(response, 5);
|
||||
|
||||
const firmwareMajorVersion = response[1] + (response[2]<<8);
|
||||
const firmwareMinorVersion = response[3] + (response[4]<<8);
|
||||
const firmwarePatchVersion = response[5] + (response[6]<<8);
|
||||
|
||||
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
|
||||
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);
|
||||
console.log(`firmwarePatchVersion: ${firmwarePatchVersion}`);
|
||||
console.log(`firmwareVersion: ${firmwareMajorVersion}.${firmwareMinorVersion}.${firmwarePatchVersion}`);
|
||||
|
||||
Reference in New Issue
Block a user