add emulation option.

This commit is contained in:
Gatsby Van
2024-01-24 11:19:48 +08:00
parent 2302fbf6de
commit 1b8ea4c38d
2 changed files with 8 additions and 4 deletions
@@ -26,7 +26,9 @@
#include "util.h" #include "util.h"
#include "circ_queue.h" #include "circ_queue.h"
#include "../time_ctrl/time_ctrl.h" #include "../time_ctrl/time_ctrl.h"
#ifndef EMULATION
#include "../config/app_config.h"
#endif
/************************** Constant Definitions *****************************/ /************************** Constant Definitions *****************************/
#define NET_START_TIME_INFTY UINT32_MAX #define NET_START_TIME_INFTY UINT32_MAX
#define LINK_BROCK_THRESHOLD (3 * 200) // 3 secods #define LINK_BROCK_THRESHOLD (3 * 200) // 3 secods
@@ -1091,10 +1093,11 @@ static int32_t IntcNodeTTL(NODE_ENTRY *node, const void *param)
/** /**
* @brief Utility function to check connection to node is still valid. * @brief Utility function to check connection to node is still valid.
*/ */
#ifdef DATALINK_ENABLE_AUTORECONNECT
static bool IsNodeConnected(NODE_ENTRY *node) static bool IsNodeConnected(NODE_ENTRY *node)
{ {
ASSERT(node != NULL); ASSERT(node != NULL);
DBG_INFO("Node: %u, TTL: %lu.\n", node->nodeInfo.nodeId, node->ttlCnt); DBG_INFO("Node: %u, TTL: %u.\n", node->nodeInfo.nodeId, node->ttlCnt);
if (node->ttlCnt < LINK_BROCK_THRESHOLD) if (node->ttlCnt < LINK_BROCK_THRESHOLD)
{ {
return true; return true;
@@ -1105,6 +1108,7 @@ static bool IsNodeConnected(NODE_ENTRY *node)
return false; return false;
} }
} }
#endif
/*****************************************************************************/ /*****************************************************************************/
/** /**
@@ -210,7 +210,7 @@ static int32_t Scan_CfmHandler(L2_INST *instPtr)
* @brief Packing Scan message to a bit array. * @brief Packing Scan message to a bit array.
* *
* @param bitarr pointer to bit array buffer. * @param bitarr pointer to bit array buffer.
* msgType message type. * @param msgType message type.
* *
* @return EPARAM * @return EPARAM
* SUCCESS * SUCCESS
@@ -279,7 +279,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
Status = L2_CrcAppend(buff, L2_CMF_PACK_LEN - L2_MSG_CFM_CRC_LEN, L2_MSG_CFM_CRC, L2_CRC16_1021); Status = L2_CrcAppend(buff, L2_CMF_PACK_LEN - L2_MSG_CFM_CRC_LEN, L2_MSG_CFM_CRC, L2_CRC16_1021);
if (Status != SUCCESS) if (Status != SUCCESS)
{ {
DBG_ERROR("Fail to append CRC, error code: %ld.\n", Status); DBG_ERROR("Fail to append CRC, error code: %d.\n", Status);
return Status; return Status;
} }
break; break;