mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 01:12:59 +00:00
feat: alert user when connection failed, resolves #53
This commit is contained in:
@@ -54,6 +54,7 @@ export class CharaDevice {
|
|||||||
constructor(private readonly baudRate = 115200) {}
|
constructor(private readonly baudRate = 115200) {}
|
||||||
|
|
||||||
async init(manual = false) {
|
async init(manual = false) {
|
||||||
|
try {
|
||||||
const ports = await getViablePorts()
|
const ports = await getViablePorts()
|
||||||
this.port =
|
this.port =
|
||||||
!manual && ports.length === 1
|
!manual && ports.length === 1
|
||||||
@@ -79,6 +80,11 @@ export class CharaDevice {
|
|||||||
this.device = device as "ONE" | "LITE"
|
this.device = device as "ONE" | "LITE"
|
||||||
this.chipset = chipset as "M0" | "S2"
|
this.chipset = chipset as "M0" | "S2"
|
||||||
this.keyCount = this.device === "ONE" ? 90 : 67
|
this.keyCount = this.device === "ONE" ? 90 : 67
|
||||||
|
} catch (e) {
|
||||||
|
alert(e)
|
||||||
|
console.error(e)
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async suspend() {
|
private async suspend() {
|
||||||
|
|||||||
Reference in New Issue
Block a user