diff --git a/packages/uhk-usb/src/constants.ts b/packages/uhk-usb/src/constants.ts index b634fb1f..f0056b08 100644 --- a/packages/uhk-usb/src/constants.ts +++ b/packages/uhk-usb/src/constants.ts @@ -21,7 +21,8 @@ export enum UsbCommand { SetTestLed = 0x0a, GetDebugBuffer = 0x0b, GetAdcValue = 0x0c, - SetLedPwmBrightness = 0x0d + SetLedPwmBrightness = 0x0d, + GetModuleProperties = 0x0e } export enum EepromOperation { diff --git a/packages/usb/blink-led-pwm-brithness.js b/packages/usb/blink-led-pwm-brightness.js similarity index 100% rename from packages/usb/blink-led-pwm-brithness.js rename to packages/usb/blink-led-pwm-brightness.js diff --git a/packages/usb/get-module-state.js b/packages/usb/get-module-state.js new file mode 100755 index 00000000..77d240d6 --- /dev/null +++ b/packages/usb/get-module-state.js @@ -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(); diff --git a/packages/usb/uhk.js b/packages/usb/uhk.js index 9a62a854..56dc89a1 100644 --- a/packages/usb/uhk.js +++ b/packages/usb/uhk.js @@ -76,6 +76,7 @@ exports = module.exports = moduleExports = { getDebugBuffer : 0x0b, getAdcValue : 0x0c, setLedPwmBrightness : 0x0d, + getModuleProperties : 0x0e, }, enumerationModes: { bootloader: 0, diff --git a/packages/usb/update-loop-getkey.sh b/packages/usb/update-loop-getkey.sh new file mode 100755 index 00000000..c259b342 --- /dev/null +++ b/packages/usb/update-loop-getkey.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +firmwarePath=$1 + +while true; do + read -n 1 char + if [[ $char == "a" ]]; then + ./flash update-firmwares-and-configs.js "$firmwarePath" ansi + elif [[ $char == "i" ]]; then + ./flash update-firmwares-and-configs.js "$firmwarePath" iso + fi +done