From 58691c16d6a21a75080aa7638e6161a127c68736 Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 24 Aug 2011 12:48:33 +0000 Subject: [PATCH] Changed the Treply_delay wait to be smaller when the next message in the queue is does not match. --- bacnet-stack/ports/at91sam7s/dlmstp.c | 3 ++- bacnet-stack/ports/bdk-atxx4-mstp/dlmstp.c | 3 ++- bacnet-stack/ports/stm32f10x/dlmstp.c | 3 ++- bacnet-stack/src/mstp.c | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bacnet-stack/ports/at91sam7s/dlmstp.c b/bacnet-stack/ports/at91sam7s/dlmstp.c index ea81ab52..085e169d 100644 --- a/bacnet-stack/ports/at91sam7s/dlmstp.c +++ b/bacnet-stack/ports/at91sam7s/dlmstp.c @@ -1118,7 +1118,8 @@ static bool MSTP_Master_Node_FSM( Master_State = MSTP_MASTER_STATE_IDLE; /* clear our flag we were holding for comparison */ MSTP_Flag.ReceivedValidFrame = false; - } else if (rs485_silence_time_elapsed(Treply_delay)) { + } else if (rs485_silence_time_elapsed(Treply_delay) || + (pkt != NULL)) { /* DeferredReply */ /* If no reply will be available from the higher layers */ /* within Treply_delay after the reception of the */ diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/dlmstp.c b/bacnet-stack/ports/bdk-atxx4-mstp/dlmstp.c index 1623d8df..e985ea68 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/dlmstp.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/dlmstp.c @@ -1145,7 +1145,8 @@ static bool MSTP_Master_Node_FSM( Master_State = MSTP_MASTER_STATE_IDLE; /* clear our flag we were holding for comparison */ MSTP_Flag.ReceivedValidFrame = false; - } else if (rs485_silence_time_elapsed(Treply_delay)) { + } else if (rs485_silence_time_elapsed(Treply_delay) || + (pkt != NULL)) { /* DeferredReply */ /* If no reply will be available from the higher layers */ /* within Treply_delay after the reception of the */ diff --git a/bacnet-stack/ports/stm32f10x/dlmstp.c b/bacnet-stack/ports/stm32f10x/dlmstp.c index 0bc0fc72..190f8f1f 100644 --- a/bacnet-stack/ports/stm32f10x/dlmstp.c +++ b/bacnet-stack/ports/stm32f10x/dlmstp.c @@ -1234,7 +1234,8 @@ static bool MSTP_Master_Node_FSM( Master_State = MSTP_MASTER_STATE_IDLE; /* clear our flag we were holding for comparison */ MSTP_Flag.ReceivedValidFrame = false; - } else if (rs485_silence_time_elapsed(Treply_delay)) { + } else if (rs485_silence_time_elapsed(Treply_delay) || + (pkt != NULL)) { /* DeferredReply */ /* If no reply will be available from the higher layers */ /* within Treply_delay after the reception of the */ diff --git a/bacnet-stack/src/mstp.c b/bacnet-stack/src/mstp.c index 72245876..0cd6fb23 100644 --- a/bacnet-stack/src/mstp.c +++ b/bacnet-stack/src/mstp.c @@ -1051,6 +1051,9 @@ bool MSTP_Master_Node_FSM( /* The ANSWER_DATA_REQUEST state is entered when a */ /* BACnet Data Expecting Reply, a Test_Request, or */ /* a proprietary frame that expects a reply is received. */ + /* FIXME: MSTP_Get_Reply waits for a matching reply, but + if the next queued message doesn't match, then we + sit here for Treply_delay doing nothing */ length = (unsigned) MSTP_Get_Reply(mstp_port, 0); if (length > 0) { /* Reply */