Skip to content

Commit ef185be

Browse files
dbg
1 parent 1ef3fe8 commit ef185be

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

kernel/src/services/DeviceService.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,7 @@ export class DeviceService {
88
private deviceType: string = '';
99
private decoder: TextDecoder = new TextDecoder();
1010

11-
constructor() {
12-
// Contiuously check the port status every 2 seconds to update the connection status/card
13-
setInterval(() => {
14-
console.log('[DeviceService]: Checking port status...');
15-
if (this.port && !this.port.readable && !this.port.writable) {
16-
console.log('[DeviceService]: Port is not readable or writable, disconnecting...');
17-
this.disconnect();
18-
}
19-
}, 2000);
20-
21-
}
11+
constructor() {}
2212

2313
// Check if port is available (return true if available)
2414
// Don't run if we are already connected from within this tab
@@ -107,6 +97,15 @@ export class DeviceService {
10797
detail: { msg: "Connected" }
10898
});
10999
document.dispatchEvent(event)
100+
101+
// Contiuously check the port status every 2 seconds to update the connection status/card
102+
setInterval(() => {
103+
console.log('[DeviceService]: Checking port status...');
104+
if (this.port && !this.port.readable && !this.port.writable) {
105+
console.log('[DeviceService]: Port is not readable or writable, disconnecting...');
106+
this.disconnect();
107+
}
108+
}, 2000);
110109
}
111110

112111
async disconnect(): Promise<void> {

0 commit comments

Comments
 (0)