diff --git a/model/UhkBuffer.ts b/model/UhkBuffer.ts index 2569f2d5..88968cc5 100644 --- a/model/UhkBuffer.ts +++ b/model/UhkBuffer.ts @@ -1,5 +1,6 @@ class UhkBuffer { + private static eepromSize = 32 * 1024; private static maxStringByteLength = 0xFFFF; private static longStringPrefix = 0xFF; private static stringEncoding = 'utf8'; @@ -7,9 +8,10 @@ class UhkBuffer { buffer: Buffer; offset: number; - constructor(buffer: Buffer) { + constructor() { this.offset = 0; - this.buffer = buffer; + this.buffer = new Buffer(UhkBuffer.eepromSize); + this.buffer.fill(0); } readInt8(): number { diff --git a/model/serializeConfig.ts b/model/serializeConfig.ts index c44524e2..fe3463d7 100644 --- a/model/serializeConfig.ts +++ b/model/serializeConfig.ts @@ -2,9 +2,7 @@ /// let fs = require('fs'); -let buffer: Buffer = new Buffer(1000); -buffer.fill(0); -let writer = new UhkBuffer(buffer); +let writer = new UhkBuffer(); let uhkConfig = JSON.parse(fs.readFileSync('uhk-config.json')); let keyActions = uhkConfig.keymaps[0].layers[0].modules[0].keyActions; @@ -153,4 +151,4 @@ function serializeSwitchLayerAction(switchLayerAction) { new KeystrokeAction(); serializeKeyActions(keyActions); -fs.writeFileSync('uhk-config.bin', buffer); +fs.writeFileSync('uhk-config.bin', writer.buffer); diff --git a/model/tslint.json b/model/tslint.json index 71d6cd15..c008a8b7 100644 --- a/model/tslint.json +++ b/model/tslint.json @@ -33,7 +33,10 @@ true, "spaces" ], - "max-line-length": [true, 100], + "max-line-length": [ + true, + 100 + ], "no-trailing-whitespace": true, "trailing-comma": [ true, {