From 1b8ea4c38d2ab60c70efa009ea6f0d8978b2d24e Mon Sep 17 00:00:00 2001 From: Gatsby Van Date: Wed, 24 Jan 2024 11:19:48 +0800 Subject: [PATCH] add emulation option. --- df_datalink_sp/src/networking/link_layer/link_layer.c | 8 ++++++-- df_datalink_sp/src/networking/link_layer/scan.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/df_datalink_sp/src/networking/link_layer/link_layer.c b/df_datalink_sp/src/networking/link_layer/link_layer.c index ed1e492..7eba6cc 100644 --- a/df_datalink_sp/src/networking/link_layer/link_layer.c +++ b/df_datalink_sp/src/networking/link_layer/link_layer.c @@ -26,7 +26,9 @@ #include "util.h" #include "circ_queue.h" #include "../time_ctrl/time_ctrl.h" - +#ifndef EMULATION +#include "../config/app_config.h" +#endif /************************** Constant Definitions *****************************/ #define NET_START_TIME_INFTY UINT32_MAX #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. */ +#ifdef DATALINK_ENABLE_AUTORECONNECT static bool IsNodeConnected(NODE_ENTRY *node) { 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) { return true; @@ -1105,6 +1108,7 @@ static bool IsNodeConnected(NODE_ENTRY *node) return false; } } +#endif /*****************************************************************************/ /** diff --git a/df_datalink_sp/src/networking/link_layer/scan.c b/df_datalink_sp/src/networking/link_layer/scan.c index adeb327..8729018 100644 --- a/df_datalink_sp/src/networking/link_layer/scan.c +++ b/df_datalink_sp/src/networking/link_layer/scan.c @@ -210,7 +210,7 @@ static int32_t Scan_CfmHandler(L2_INST *instPtr) * @brief Packing Scan message to a bit array. * * @param bitarr pointer to bit array buffer. - * msgType message type. + * @param msgType message type. * * @return EPARAM * 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); 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; } break;