Feature/zeroing rx buffer remain (#90)
* Added zeroing rx buffer remain * Added zeroing rx buffer remain * Added safety margin for the rx-buffer in the different ports. * Added safety margin for the receive buffer. * Added DoxyGen comments. * Fixed checking return value when calculating distance between opening and closing tag on multiple properties.
This commit is contained in:
@@ -141,7 +141,17 @@ void bacnet_init(void)
|
||||
Send_I_Am(&Handler_Transmit_Buffer[0]);
|
||||
}
|
||||
|
||||
static uint8_t PDUBuffer[MAX_MPDU];
|
||||
/** Static receive buffer, initialized with zeros by the C Library Startup Code. */
|
||||
|
||||
static uint8_t PDUBuffer[MAX_MPDU + 16 /* Add a little safety margin to the buffer,
|
||||
* so that in the rare case, the message
|
||||
* would be filled up to MAX_MPDU and some
|
||||
* decoding functions would overrun, these
|
||||
* decoding functions will just end up in
|
||||
* a safe field of static zeros. */];
|
||||
|
||||
/** BACnet task doing receive and transmit. */
|
||||
|
||||
void bacnet_task(void)
|
||||
{
|
||||
uint8_t mstp_mac_address;
|
||||
@@ -208,7 +218,7 @@ void bacnet_task(void)
|
||||
dcc_timer_seconds(DCC_CYCLE_SECONDS);
|
||||
}
|
||||
/* handle the messaging */
|
||||
pdu_len = datalink_receive(&src, &PDUBuffer[0], sizeof(PDUBuffer), 0);
|
||||
pdu_len = datalink_receive(&src, &PDUBuffer[0], MAX_MPDU, 0);
|
||||
if (pdu_len) {
|
||||
npdu_handler(&src, &PDUBuffer[0], pdu_len);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user