Merge pull request #458 from mcumings/rak-serial-fix

Explicitly enable DTR/RTS to fix RAK serial comms
pull/461/head
Andre Kirchhoff 2022-07-29 18:48:20 -03:00 zatwierdzone przez GitHub
commit 277db36a46
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -59,7 +59,9 @@ internal class SerialConnectionImpl(
} }
port.open(usbDeviceConnection) port.open(usbDeviceConnection)
port.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE) port.setParameters(115200, UsbSerialPort.DATABITS_8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
port.dtr = true
port.rts = true
debug("Starting serial reader thread") debug("Starting serial reader thread")
val io = SerialInputOutputManager(port, object : SerialInputOutputManager.Listener { val io = SerialInputOutputManager(port, object : SerialInputOutputManager.Listener {
@ -70,6 +72,8 @@ internal class SerialConnectionImpl(
override fun onRunError(e: Exception?) { override fun onRunError(e: Exception?) {
closed.set(true) closed.set(true)
ignoreException { ignoreException {
port.dtr = false
port.rts = false
port.close() port.close()
} }
closedLatch.countDown() closedLatch.countDown()