fix: 接收帧类型改为通过数据读取

This commit is contained in:
2025-05-25 23:16:16 +08:00
parent 46ca71c78a
commit e94f2b3848
6 changed files with 69 additions and 86 deletions
+5 -3
View File
@@ -131,7 +131,6 @@ static void L2_FrameStateUpdate(L2_INST *instPtr)
ASSERT(instPtr != NULL);
PHY_INST *phyRef = instPtr->config.phyInstPtr;
bool isValid;
L2_FRAME_TYPE recvType = L2_GetLastFrameType(instPtr);
isValid = false;
// Update frame state.
if (Phy_IsFrameValid(phyRef) == false)
@@ -145,6 +144,9 @@ static void L2_FrameStateUpdate(L2_INST *instPtr)
Phy_RetrieveRecvData(phyRef, instPtr->recvPktData);
instPtr->log.frameRecv++;
L2_MSG_COMMON *msg = (L2_MSG_COMMON *) instPtr->recvPktData;
L2_FRAME_TYPE recvType = msg->msgType;
// Update frame state.
switch (recvType)
{
@@ -459,7 +461,7 @@ size_t L2_GetSvcPacketLen(L2_SVC_RATE l2SvcRate)
case L2_SVC_2M:
return sizeof(L2_MSG_SVC_2M);
default:
DBG_ERROR("Unsupported service rate: %" PRId8 ".\n", instPtr->config.serviceRate);
DBG_ERROR("Unsupported service rate: %" PRId8 ".\n", l2SvcRate);
return EPARAM;
}
}
@@ -484,7 +486,7 @@ size_t L2_GetSvcPayloadLen(L2_SVC_RATE l2SvcRate)
case L2_SVC_2M:
return L2_PAYLOAD_LEN_SVC_2M;
default:
DBG_ERROR("Unsupported service rate: %" PRId8 ".\n", instPtr->config.serviceRate);
DBG_ERROR("Unsupported service rate: %" PRId8 ".\n", l2SvcRate);
return EPARAM;
}
}
+3 -3
View File
@@ -111,7 +111,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
message->common.slotNum = L2_GetNextSlotNum(instPtr);
message->common.src = L2_GetNodeId(instPtr);
message->common.dst = dstId;
message->common.msgType = L2_FRAME_ADV;
message->common.msgType = L2_FRAME_ACK;
// insert position and speed info
SysMonitor_GetSysinfo(&(instPtr->sysInfo));
@@ -222,7 +222,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
if (Status != SUCCESS)
{
DBG_ERROR("Failed to compute time deviation.\n")
DBG_ERROR("Failed to compute time deviation.\n");
break;
}
@@ -294,7 +294,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
if (Status != SUCCESS)
{
DBG_ERROR("Failed to compute time deviation.\n")
DBG_ERROR("Failed to compute time deviation.\n");
break;
}
+3 -3
View File
@@ -472,7 +472,7 @@ static int32_t Service_PktHandler128K(L2_INST *instPtr, uint8_t *msg)
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
if (Status != SUCCESS)
{
DBG_ERROR("Failed to compute time deviation.\n")
DBG_ERROR("Failed to compute time deviation.\n");
return Status;
}
@@ -547,7 +547,7 @@ static int32_t Service_PktHandler512K(L2_INST *instPtr, uint8_t *msg)
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
if (Status != SUCCESS)
{
DBG_ERROR("Failed to compute time deviation.\n")
DBG_ERROR("Failed to compute time deviation.\n");
return Status;
}
@@ -622,7 +622,7 @@ static int32_t Service_PktHandler2M(L2_INST *instPtr, uint8_t *msg)
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
if (Status != SUCCESS)
{
DBG_ERROR("Failed to compute time deviation.\n")
DBG_ERROR("Failed to compute time deviation.\n");
return Status;
}