From 531b56cb5697f21acbba3e4ff2bd4c38dffcd626 Mon Sep 17 00:00:00 2001 From: Robert Kossessa Date: Thu, 16 May 2024 15:05:01 +0200 Subject: [PATCH] FIX: Ugly hack to prevent profile fetch issue TODO: Fix properly once root cause has been identified --- src/main/nanoSerialApi.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/nanoSerialApi.ts b/src/main/nanoSerialApi.ts index b47ce38..a2a2d6f 100644 --- a/src/main/nanoSerialApi.ts +++ b/src/main/nanoSerialApi.ts @@ -51,10 +51,15 @@ class NanoSerialApi extends EventEmitter { if (lines.length > 1) { for (let i = 0; i < lines.length - 1; i++) { if (lines[i].length > 0) { + if (lines[i].startsWith('undefined')) { + // This is an absolutely horrible hack, but it works for now + // TODO: Fix the root cause of this issue + lines[i] = lines[i].substring(9) + } if (lines[i].startsWith('{')) // if its a json object this.emit('nanoSerialApi:update', serialNumber, lines[i]) - else console.log('Device: ' + lines[i]) // otherwise just log it + else console.warn('Device: ' + lines[i]) // otherwise just log it } } connected_port.data = lines[lines.length - 1]