fix: lite breaks layout viewer

This commit is contained in:
2023-11-02 22:13:37 +01:00
parent ef309d603e
commit 88429412b9
2 changed files with 3 additions and 2 deletions

View File

@@ -61,8 +61,7 @@ export async function initSerial(manual = false) {
const parsedLayout: CharaLayout = [[], [], []]
for (let layer = 1; layer <= 3; layer++) {
// TODO: this will fail for LITE!
for (let i = 0; i < 90; i++) {
for (let i = 0; i < device.keyCount; i++) {
parsedLayout[layer - 1][i] = await device.getLayoutKey(layer, i)
}
}

View File

@@ -33,6 +33,7 @@ export class CharaDevice {
company!: "CHARACHORDER"
device!: "ONE" | "LITE"
chipset!: "M0" | "S2"
keyCount!: 90 | 67
constructor(private readonly baudRate = 115200) {}
@@ -62,6 +63,7 @@ export class CharaDevice {
this.company = company as "CHARACHORDER"
this.device = device as "ONE" | "LITE"
this.chipset = chipset as "M0" | "S2"
this.keyCount = this.device === "ONE" ? 90 : 67
}
private async suspend() {