diff --git a/celrs/platform/serial_win.c b/celrs/platform/serial_win.c index e9fcf09..082a29b 100644 --- a/celrs/platform/serial_win.c +++ b/celrs/platform/serial_win.c @@ -27,6 +27,13 @@ cel_serial_platform_handle cel_serial_platform_open(char const* path, int baud_r dcb.Parity = NOPARITY; dcb.StopBits = ONESTOPBIT; + /* Keep DTR/RTS low so the TX module is not reset on connect. Setting + * these in the same SetCommState call (rather than via a later + * EscapeCommFunction) avoids a brief DTR/RTS-high pulse if the port's + * existing DCB has them enabled. */ + dcb.fDtrControl = DTR_CONTROL_DISABLE; + dcb.fRtsControl = RTS_CONTROL_DISABLE; + if (!SetCommState(h, &dcb)) { CloseHandle(h); return CEL_SERIAL_PLATFORM_INVALID_HANDLE;