Fix open port being discarded without closing

This commit is contained in:
GHOSCHT 2022-03-14 23:49:56 +01:00
parent e1056637ab
commit 2ee4d0df48
No known key found for this signature in database
GPG key ID: A35BD466B8871994

View file

@ -51,6 +51,9 @@ const serialConnection: Middleware<{}, RootState> = (state) => (next) => (action
} else if (connectionEnd.match(action)) { } else if (connectionEnd.match(action)) {
electron.ipcRenderer.send("asynchronous-message", "yellow"); electron.ipcRenderer.send("asynchronous-message", "yellow");
} else if (setSerialPort.match(action)) { } else if (setSerialPort.match(action)) {
if (serialPort?.isOpen) {
serialPort.close();
}
serialPort = new PortController(action.payload); serialPort = new PortController(action.payload);
} else if (sendMessage.match(action)) { } else if (sendMessage.match(action)) {
serialPort?.write(action.payload); serialPort?.write(action.payload);