mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2025-12-11 13:26:16 +00:00
feat: improve device support
This commit is contained in:
@@ -96,7 +96,12 @@ export function restoreFromFile(
|
|||||||
case "backup": {
|
case "backup": {
|
||||||
const recent = file.history[0];
|
const recent = file.history[0];
|
||||||
if (!recent) return;
|
if (!recent) return;
|
||||||
if (recent[1].device !== get(serialPort)?.device) {
|
let backupDevice = recent[1].device;
|
||||||
|
if (backupDevice === "TWO") backupDevice = "ONE";
|
||||||
|
let currentDevice = get(serialPort)?.device;
|
||||||
|
if (currentDevice === "TWO") currentDevice = "ONE";
|
||||||
|
|
||||||
|
if (backupDevice !== currentDevice) {
|
||||||
alert("Backup is incompatible with this device");
|
alert("Backup is incompatible with this device");
|
||||||
throw new Error("Backup is incompatible with this device");
|
throw new Error("Backup is incompatible with this device");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
import("$lib/assets/layouts/one.yml").then(
|
import("$lib/assets/layouts/one.yml").then(
|
||||||
(it) => it.default as VisualLayout,
|
(it) => it.default as VisualLayout,
|
||||||
),
|
),
|
||||||
|
TWO: () =>
|
||||||
|
import("$lib/assets/layouts/one.yml").then(
|
||||||
|
(it) => it.default as VisualLayout,
|
||||||
|
),
|
||||||
LITE: () =>
|
LITE: () =>
|
||||||
import("$lib/assets/layouts/lite.yml").then(
|
import("$lib/assets/layouts/lite.yml").then(
|
||||||
(it) => it.default as VisualLayout,
|
(it) => it.default as VisualLayout,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { browser } from "$app/environment";
|
|||||||
|
|
||||||
const PORT_FILTERS: Map<string, SerialPortFilter> = new Map([
|
const PORT_FILTERS: Map<string, SerialPortFilter> = new Map([
|
||||||
["ONE M0", { usbProductId: 32783, usbVendorId: 9114 }],
|
["ONE M0", { usbProductId: 32783, usbVendorId: 9114 }],
|
||||||
|
["TWO S3", { usbProductId: 0x0056, usbVendorId: 0x2886}],
|
||||||
["LITE S2", { usbProductId: 33070, usbVendorId: 12346 }],
|
["LITE S2", { usbProductId: 33070, usbVendorId: 12346 }],
|
||||||
["LITE M0", { usbProductId: 32796, usbVendorId: 9114 }],
|
["LITE M0", { usbProductId: 32796, usbVendorId: 9114 }],
|
||||||
["X", { usbProductId: 33163, usbVendorId: 12346 }],
|
["X", { usbProductId: 33163, usbVendorId: 12346 }],
|
||||||
@@ -87,8 +88,8 @@ export class CharaDevice {
|
|||||||
|
|
||||||
version!: SemVer;
|
version!: SemVer;
|
||||||
company!: "CHARACHORDER";
|
company!: "CHARACHORDER";
|
||||||
device!: "ONE" | "LITE" | "X";
|
device!: "ONE" | "TWO" | "LITE" | "X";
|
||||||
chipset!: "M0" | "S2";
|
chipset!: "M0" | "S2" | "S3";
|
||||||
keyCount!: 90 | 67 | 256;
|
keyCount!: 90 | 67 | 256;
|
||||||
|
|
||||||
get portInfo() {
|
get portInfo() {
|
||||||
|
|||||||
Reference in New Issue
Block a user