Add get-module-state.js and the relevant device command id.
This commit is contained in:
@@ -21,7 +21,8 @@ export enum UsbCommand {
|
|||||||
SetTestLed = 0x0a,
|
SetTestLed = 0x0a,
|
||||||
GetDebugBuffer = 0x0b,
|
GetDebugBuffer = 0x0b,
|
||||||
GetAdcValue = 0x0c,
|
GetAdcValue = 0x0c,
|
||||||
SetLedPwmBrightness = 0x0d
|
SetLedPwmBrightness = 0x0d,
|
||||||
|
GetModuleProperties = 0x0e
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum EepromOperation {
|
export enum EepromOperation {
|
||||||
|
|||||||
14
packages/usb/get-module-state.js
Executable file
14
packages/usb/get-module-state.js
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
const uhk = require('./uhk');
|
||||||
|
const device = uhk.getUhkDevice();
|
||||||
|
|
||||||
|
function getModuleState() {
|
||||||
|
const payload = new Buffer([uhk.usbCommands.getModuleProperties, 1]);
|
||||||
|
console.log('Sending ', uhk.bufferToString(payload));
|
||||||
|
device.write(uhk.getTransferData(payload));
|
||||||
|
const receivedBuffer = device.readSync();
|
||||||
|
console.log('Received', uhk.bufferToString(receivedBuffer));
|
||||||
|
setTimeout(getModuleState, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
getModuleState();
|
||||||
@@ -76,6 +76,7 @@ exports = module.exports = moduleExports = {
|
|||||||
getDebugBuffer : 0x0b,
|
getDebugBuffer : 0x0b,
|
||||||
getAdcValue : 0x0c,
|
getAdcValue : 0x0c,
|
||||||
setLedPwmBrightness : 0x0d,
|
setLedPwmBrightness : 0x0d,
|
||||||
|
getModuleProperties : 0x0e,
|
||||||
},
|
},
|
||||||
enumerationModes: {
|
enumerationModes: {
|
||||||
bootloader: 0,
|
bootloader: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user