fix: 修复数据读取逻辑,增加入队拷贝拷贝

This commit is contained in:
2025-06-23 16:04:01 +08:00
parent 58a909673a
commit 5679de641c
5 changed files with 73 additions and 33 deletions
+58 -21
View File
@@ -196,16 +196,29 @@ static int32_t Service_Packing128K(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t
message->srcSpeedY = instPtr->sysInfo.vY;
message->srcSpeedZ = instPtr->sysInfo.vZ;
// TODO: Packing extra payload
// Pack extra payload
if (type == L2_FRAME_SVC)
{
SYSMON_SVC_PAYLOAD sendPayload;
// Packing extra payload
SYSMON_SVC_PAYLOAD *sendPayload;
SysMonitor_GetSendPayload(&sendPayload);
message->common.dst = sendPayload.nodeId;
message->dataId = sendPayload.dataId;
message->dataLen = sendPayload.dataLen;
memset(message->data, 0xAA, maxDataLen);
memcpy(message->data, sendPayload.data, sendPayload.dataLen);
if(sendPayload == NULL)
{
message->common.dst = L2_NONE_ID;
message->dataId = DATA_ID_NONE;
message->dataLen = 0;
memset(message->data, 0xAA, maxDataLen);
}
else
{
message->common.dst = sendPayload->nodeId;
message->dataId = sendPayload->dataId;
message->dataLen = sendPayload->dataLen;
memset(message->data, 0xAA, maxDataLen);
memcpy(message->data, sendPayload->data, (sendPayload->dataLen > maxDataLen) ?
maxDataLen : sendPayload->dataLen);
free(sendPayload);
}
}
else
{
@@ -264,14 +277,26 @@ static int32_t Service_Packing512K(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t
message->srcSpeedY = instPtr->sysInfo.vY;
message->srcSpeedZ = instPtr->sysInfo.vZ;
// TODO: Packing extra payload
SYSMON_SVC_PAYLOAD sendPayload;
// Pack extra payload
SYSMON_SVC_PAYLOAD *sendPayload;
SysMonitor_GetSendPayload(&sendPayload);
message->common.dst = sendPayload.nodeId;
message->dataId = sendPayload.dataId;
message->dataLen = sendPayload.dataLen;
memset(message->data, 0xAA, maxDataLen);
memcpy(message->data, sendPayload.data, sendPayload.dataLen);
if(sendPayload == NULL)
{
message->common.dst = L2_NONE_ID;
message->dataId = DATA_ID_NONE;
message->dataLen = 0;
memset(message->data, 0xAA, maxDataLen);
}
else
{
message->common.dst = sendPayload->nodeId;
message->dataId = sendPayload->dataId;
message->dataLen = sendPayload->dataLen;
memset(message->data, 0xAA, maxDataLen);
memcpy(message->data, sendPayload->data, (sendPayload->dataLen > maxDataLen) ?
maxDataLen : sendPayload->dataLen);
free(sendPayload);
}
// Append CRC
uint32_t crcVal;
@@ -322,14 +347,26 @@ static int32_t Service_Packing2M(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t d
message->srcSpeedY = instPtr->sysInfo.vY;
message->srcSpeedZ = instPtr->sysInfo.vZ;
// TODO: Packing extra payload
SYSMON_SVC_PAYLOAD sendPayload;
// Packing extra payload
SYSMON_SVC_PAYLOAD *sendPayload;
SysMonitor_GetSendPayload(&sendPayload);
message->common.dst = sendPayload.nodeId;
message->dataId = sendPayload.dataId;
message->dataLen = sendPayload.dataLen;
memset(message->data, 0xAA, maxDataLen);
memcpy(message->data, sendPayload.data, sendPayload.dataLen);
if(sendPayload == NULL)
{
message->common.dst = L2_NONE_ID;
message->dataId = DATA_ID_NONE;
message->dataLen = 0;
memset(message->data, 0xAA, maxDataLen);
}
else
{
message->common.dst = sendPayload->nodeId;
message->dataId = sendPayload->dataId;
message->dataLen = sendPayload->dataLen;
memset(message->data, 0xAA, maxDataLen);
memcpy(message->data, sendPayload->data, (sendPayload->dataLen > maxDataLen) ?
maxDataLen : sendPayload->dataLen);
free(sendPayload);
}
// Append CRC
uint32_t crcVal;