Move the computation to define if one of our module is concerned by the message at the byte 3
@@ -60,6 +60,13 @@ void Recep_GetHeader(volatile unsigned char *data)
data_count++;
// Check if we have all we need.
+
+ if (data_count == 3)
+ {
+ keep = Recep_NodeConcerned((header_t *)&current_msg->header);
+ }
+ else
+ {
if (data_count == (sizeof(header_t)))
{
#ifdef DEBUG
@@ -77,10 +84,13 @@ void Recep_GetHeader(volatile unsigned char *data)
ctx.data_cb = Recep_GetData;
// Cap size for big messages
if (current_msg->header.size > MAX_DATA_MSG_SIZE)
+ {
data_size = MAX_DATA_MSG_SIZE;
+ }
else
+ {
data_size = current_msg->header.size;
- keep = Recep_NodeConcerned((header_t *)&current_msg->header);
+ }
if (keep)
{
MsgAlloc_ValidHeader();
@@ -93,6 +103,7 @@ void Recep_GetHeader(volatile unsigned char *data)
}
}
}
+}
/******************************************************************************
* @brief Callback to get a complete data
* @param data come from RX
