mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-05 18:01:56 +02:00
DesktopSerialHandler: Minor cleanup
This commit is contained in:
@@ -104,10 +104,7 @@ class DesktopSerialHandler :
|
||||
}
|
||||
if (isConnected) {
|
||||
if (SerialPortWrapper(newPort) != currentPort?.let { SerialPortWrapper(it) }) {
|
||||
LogManager.info(
|
||||
"[SerialHandler] Closing current serial port " +
|
||||
currentPort!!.descriptivePortName,
|
||||
)
|
||||
LogManager.info("[SerialHandler] Closing current serial port ${currentPort!!.descriptivePortName}")
|
||||
currentPort!!.removeDataListener()
|
||||
currentPort!!.closePort()
|
||||
} else {
|
||||
@@ -117,18 +114,13 @@ class DesktopSerialHandler :
|
||||
}
|
||||
}
|
||||
currentPort = newPort
|
||||
LogManager.info(
|
||||
"[SerialHandler] Trying to connect to new serial port " +
|
||||
currentPort!!.descriptivePortName,
|
||||
)
|
||||
currentPort?.setBaudRate(115200)
|
||||
LogManager.info("[SerialHandler] Trying to connect to new serial port ${currentPort!!.descriptivePortName}")
|
||||
currentPort?.baudRate = 115200
|
||||
currentPort?.clearRTS()
|
||||
currentPort?.clearDTR()
|
||||
if (currentPort?.openPort(1000) == false) {
|
||||
LogManager.warning(
|
||||
"[SerialHandler] Can't open serial port ${currentPort?.descriptivePortName}, last error: ${currentPort?.lastErrorCode}",
|
||||
|
||||
)
|
||||
LogManager
|
||||
.warning("[SerialHandler] Can't open serial port ${currentPort?.descriptivePortName}, last error: ${currentPort?.lastErrorCode}")
|
||||
currentPort = null
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user