feat(device): Read user config from eeprom (#413)

* feat(device): Read user config from eeprom

* read data from eeprom

* fix user config serialization

* fix device connected detection

* not allow override default config is eeprom is empty

* add error handling to eeprom parsing

* colorize log output

* add USB[T] feature

* add class name to USB[T] log

* remove redundant error log msg

* Add USB[T] to Apply user config
This commit is contained in:
Róbert Kiss
2017-09-17 14:45:20 +02:00
committed by László Monda
parent d621b1e5e6
commit 96e968729d
11 changed files with 185 additions and 33 deletions

View File

@@ -27,6 +27,7 @@ while(offset < configSize) {
const usbCommand = isHardwareConfig ? uhk.usbCommands.readHardwareConfig : uhk.usbCommands.readUserConfig;
chunkSizeToRead = Math.min(chunkSize, configSize - offset);
buffer = Buffer.from([usbCommand, chunkSizeToRead, offset & 0xff, offset >> 8]);
console.log('write to keyboard', uhk.bufferToString(buffer));
device.write(uhk.getTransferData(buffer));
buffer = Buffer.from(device.readSync());
console.log('read-config-chunk', uhk.bufferToString(buffer));