diff --git a/controls-serial/src/main/kotlin/space/kscience/controls/serial/SerialPort.kt b/controls-serial/src/main/kotlin/space/kscience/controls/serial/SerialPort.kt index 05d4b64..54b7ac8 100644 --- a/controls-serial/src/main/kotlin/space/kscience/controls/serial/SerialPort.kt +++ b/controls-serial/src/main/kotlin/space/kscience/controls/serial/SerialPort.kt @@ -2,6 +2,7 @@ package space.kscience.controls.serial import jssc.SerialPort.* import jssc.SerialPortEventListener +import kotlinx.coroutines.launch import space.kscience.controls.ports.AbstractPort import space.kscience.controls.ports.Port import space.kscience.controls.ports.PortFactory @@ -27,7 +28,7 @@ public class SerialPort private constructor( if (event.isRXCHAR) { val chars = event.eventValue val bytes = jssc.readBytes(chars) - receive(bytes) + scope.launch { receive(bytes) } } }