From adf0f282e7fc53a93b41a5543f7ce4c581fc9c03 Mon Sep 17 00:00:00 2001 From: skarg Date: Mon, 27 Jul 2009 18:48:06 +0000 Subject: [PATCH] Added delay and flush to correctly flush RS485 buffer. --- bacnet-stack/ports/linux/rs485.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bacnet-stack/ports/linux/rs485.c b/bacnet-stack/ports/linux/rs485.c index 71da849f..4efd2fa2 100644 --- a/bacnet-stack/ports/linux/rs485.c +++ b/bacnet-stack/ports/linux/rs485.c @@ -281,6 +281,9 @@ void RS485_Initialize( tcsetattr(RS485_Handle, TCSAFLUSH, &newtio); /* destructor */ atexit(RS485_Cleanup); + /* flush any data waiting */ + usleep(200000); + tcflush(RS485_Handle, TCIOFLUSH); printf("=success!\n"); }