Dump individual debug values in an easy to read fashion.
This commit is contained in:
@@ -2,12 +2,21 @@
|
|||||||
const uhk = require('./uhk');
|
const uhk = require('./uhk');
|
||||||
const device = uhk.getUhkDevice();
|
const device = uhk.getUhkDevice();
|
||||||
|
|
||||||
|
function getUint32(buffer, offset) {
|
||||||
|
return (buffer[offset]) + (buffer[offset+1] << 8) + (buffer[offset+2] << 16) + (buffer[offset+3] << 24);
|
||||||
|
}
|
||||||
|
|
||||||
function getDebugInfo() {
|
function getDebugInfo() {
|
||||||
const payload = new Buffer([uhk.usbCommands.readDebugInfo]);
|
const payload = new Buffer([uhk.usbCommands.getDebugInfo]);
|
||||||
console.log('Sending ', uhk.bufferToString(payload));
|
console.log('Sending ', uhk.bufferToString(payload));
|
||||||
device.write(uhk.getTransferData(payload));
|
device.write(uhk.getTransferData(payload));
|
||||||
const receivedBuffer = Buffer.from(device.readSync());
|
const rxBuffer = Buffer.from(device.readSync());
|
||||||
console.log('Received', uhk.bufferToString(receivedBuffer));
|
console.log('Received', uhk.bufferToString(rxBuffer));
|
||||||
|
process.stdout.write(`I2C_Watchdog:${getUint32(rxBuffer, 1)} | `);
|
||||||
|
process.stdout.write(`I2cSchedulerCounter:${getUint32(rxBuffer, 5)} | `);
|
||||||
|
process.stdout.write(`I2cWatchdog_OuterCounter:${getUint32(rxBuffer, 9)} | `);
|
||||||
|
process.stdout.write(`I2cWatchdog_InnerCounter:${getUint32(rxBuffer, 13)}`);
|
||||||
|
process.stdout.write('\n');
|
||||||
setTimeout(getDebugInfo, 500);
|
setTimeout(getDebugInfo, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user