modified for nuc472
Dependents: modbus-over-rs485-sample NTOUEE-mbed-modbus-RTU NuMaker_NuWicam_Lite
Fork of Modbus by
Diff: mbrtu.cpp
- Revision:
- 2:6ee56c002f64
- Parent:
- 0:274eb57e1df3
- Child:
- 3:419ee4c5e10f
diff -r cfde7320b0bf -r 6ee56c002f64 mbrtu.cpp --- a/mbrtu.cpp Tue Aug 09 08:21:33 2016 +0000 +++ b/mbrtu.cpp Thu Aug 18 08:24:37 2016 +0000 @@ -27,6 +27,7 @@ * * File: $Id: mbrtu.c,v 1.18 2007/09/12 10:15:56 wolti Exp $ */ +#include "mbed.h" /* ----------------------- System includes ----------------------------------*/ #include "stdlib.h" @@ -153,7 +154,14 @@ eMBErrorCode eStatus = MB_ENOERR; ENTER_CRITICAL_SECTION( ); - assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ); + //assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ); //Wayne's workaround + if ( usRcvBufferPos >= MB_SER_PDU_SIZE_MAX ) + { + //printf("usRcvBufferPos < MB_SER_PDU_SIZE_MAX - %d %d \r\n", usRcvBufferPos, MB_SER_PDU_SIZE_MAX ); + eStatus = MB_EIO; + usRcvBufferPos = 0; + return eStatus; + } /* Length and CRC check */ if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN )