TLazSerial icon indicating copy to clipboard operation
TLazSerial copied to clipboard

Add user-configurable initial states for DTR and RTS control lines

Open guarjo opened this issue 4 months ago • 0 comments

Motivation Currently, DTR and RTS are always set to HIGH when opening a serial port. This causes issues with hardware that is sensitive to these control lines (e.g., devices that reset on DTR change, or RS-485 transceivers).

Changes

  • Added InitialDTR and InitialRTS boolean properties to TLazSerial
  • Modified DeviceOpen() to apply user-specified pin states after configuration
  • Changed Config() to use disable flags, preventing automatic pin changes
  • Defaults to True for backward compatibility

Testing

  • Tested on Windows with COM ports
  • Verified no DTR/RTS glitches when InitialDTR/RTS = False
  • Confirmed backward compatibility with existing code

Breaking Changes None - defaults preserve original behavior.

guarjo avatar Dec 09 '25 16:12 guarjo