Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.34k stars 287 forks source link

Missing parameters in method setRs485ModeParameters #265

Closed sistik closed 4 years ago

sistik commented 4 years ago

There is missing parameter to setup logical levels of drive enable signal. This parameters can be set as flags in configuration. Flag names: SER_RS485_RTS_ON_SEND, SER_RS485_RTS_AFTER_SEND

You can add something like this to SerialPort_Posix.c (function Java_com_fazecast_jSerialComm_SerialPort_configPort):

if (rs485RtsOnSend) {
    rs485Conf.flags |= SER_RS485_RTS_ON_SEND;
    rs485Conf.flags &= SER_RS485_RTS_AFTER_SEND;
} else {
    rs485Conf.flags &= SER_RS485_RTS_ON_SEND;
    rs485Conf.flags |= SER_RS485_RTS_AFTER_SEND;
}
hedgecrw commented 4 years ago

This has been corrected with the latest check-in, and will be available in the next release v2.5.4. The only API change is that setRs485ModeParameters(boolean useRS485Mode, int delayBeforeSendMicroseconds, int delayAfterSendMicroseconds) has been changed to setRs485ModeParameters(boolean useRS485Mode, boolean rs485RtsActiveHigh, int delayBeforeSendMicroseconds, int delayAfterSendMicroseconds) to allow the user to enable RTS active high or RTS active low. Thanks for opening the issue!