mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-03 08:32:52 +00:00
feat: ccx key count
This commit is contained in:
@@ -12,6 +12,12 @@ const PORT_FILTERS: Map<string, SerialPortFilter> = new Map([
|
|||||||
["X", {usbProductId: 33163, usbVendorId: 12346}],
|
["X", {usbProductId: 33163, usbVendorId: 12346}],
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const KEY_COUNTS = {
|
||||||
|
ONE: 90,
|
||||||
|
LITE: 67,
|
||||||
|
X: 255,
|
||||||
|
}
|
||||||
|
|
||||||
if (browser && navigator.serial === undefined && import.meta.env.TAURI_FAMILY !== undefined) {
|
if (browser && navigator.serial === undefined && import.meta.env.TAURI_FAMILY !== undefined) {
|
||||||
await import("./tauri-serial")
|
await import("./tauri-serial")
|
||||||
}
|
}
|
||||||
@@ -47,9 +53,9 @@ export class CharaDevice {
|
|||||||
|
|
||||||
version!: SemVer
|
version!: SemVer
|
||||||
company!: "CHARACHORDER"
|
company!: "CHARACHORDER"
|
||||||
device!: "ONE" | "LITE"
|
device!: "ONE" | "LITE" | "X"
|
||||||
chipset!: "M0" | "S2"
|
chipset!: "M0" | "S2"
|
||||||
keyCount!: 90 | 67
|
keyCount!: 90 | 67 | 255
|
||||||
|
|
||||||
constructor(private readonly baudRate = 115200) {}
|
constructor(private readonly baudRate = 115200) {}
|
||||||
|
|
||||||
@@ -77,9 +83,9 @@ export class CharaDevice {
|
|||||||
this.version = new SemVer(await this.send("VERSION").then(([version]) => version))
|
this.version = new SemVer(await this.send("VERSION").then(([version]) => version))
|
||||||
const [company, device, chipset] = await this.send("ID")
|
const [company, device, chipset] = await this.send("ID")
|
||||||
this.company = company as "CHARACHORDER"
|
this.company = company as "CHARACHORDER"
|
||||||
this.device = device as "ONE" | "LITE"
|
this.device = device as "ONE" | "LITE" | "X"
|
||||||
this.chipset = chipset as "M0" | "S2"
|
this.chipset = chipset as "M0" | "S2"
|
||||||
this.keyCount = this.device === "ONE" ? 90 : 67
|
this.keyCount = KEY_COUNTS[this.device]
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert(e)
|
alert(e)
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user