Fix Bug: Update RS485 baud rate configuration to use dlmstp_baud_rate(mstp_port) instead of shared data enum value (#1294)

This commit is contained in:
jenahn0630
2026-04-09 06:36:21 +09:00
committed by GitHub
parent 7536c6b6fa
commit f8bbc0b006
2 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -702,8 +702,8 @@ bool dlmstp_init(void *poPort, char *ifname)
*/
newtio.c_cflag =
poSharedData->RS485MOD | CLOCAL | CREAD | BOTHER | (BOTHER << IBSHIFT);
newtio.c_ispeed = poSharedData->RS485_Baud;
newtio.c_ospeed = poSharedData->RS485_Baud;
newtio.c_ispeed = dlmstp_baud_rate(mstp_port);
newtio.c_ospeed = dlmstp_baud_rate(mstp_port);
/* Raw input */
newtio.c_iflag = 0;
/* Raw output */
+7 -1
View File
@@ -206,7 +206,13 @@ void RS485_Send_Frame(
if (mstp_port && mstp_port->UserData) {
poSharedData = (SHARED_MSTP_DATA *)mstp_port->UserData;
baud = poSharedData->RS485_Baud;
/* poSharedData->RS485_Baud stores a termios B-constant (e.g.
* B38400=15), NOT the actual numeric baud rate. Using it directly in
* the turnaround delay formula (40,000,000 / baud) would produce ~2.7
* seconds instead of the correct ~1ms at 38400 baud. dlmstp_baud_rate()
* converts the termios constant to the real value.
*/
baud = dlmstp_baud_rate(mstp_port);
handle = poSharedData->RS485_Handle;
}