Replace pushUint32() with uint32ToArray() and don't use it where not needed.

This commit is contained in:
László Monda
2018-01-30 05:30:32 +01:00
parent 67346b4cda
commit 2310320b8a
5 changed files with 8 additions and 12 deletions

View File

@@ -51,13 +51,13 @@ function convertMs(milliseconds) {
const device = uhk.getUhkDevice();
device.write(uhk.getTransferData(new Buffer(uhk.pushUint32([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.uptime]))));
device.write(uhk.getTransferData(new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.uptime])));
let response = device.readSync();
let uptimeMs = uhk.getUint32(response, 1);
let uptime = convertMs(uptimeMs);
console.log(`uptime: ${uptime.days}d ${String(uptime.hours).padStart(2, '0')}:${String(uptime.minutes).padStart(2, '0')}:${String(uptime.seconds).padStart(2, '0')}`)
device.write(uhk.getTransferData(new Buffer(uhk.pushUint32([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.i2cBaudRate]))));
device.write(uhk.getTransferData(new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.i2cBaudRate])));
response = device.readSync();
let requestedBaudRate = uhk.getUint32(response, 2);
let actualBaudRate = uhk.getUint32(response, 6);