添加1字节对齐,避免结构体大小错误

This commit is contained in:
CSSC-WORK\murmur 2024-12-31 09:51:01 +08:00
parent bb7ade7025
commit f1ae618627
2 changed files with 3 additions and 1 deletions

View File

@ -1347,7 +1347,7 @@ static void packMsgToHost(uint16_t funcCode, uint8_t isOK) {
if(funcCode == HOST_CMD_STATUS_QUERY) {
dlen = sizeof(DeviceStatus_t);
index = sizeof(FRAME_TAIL)+2;
msgBuf[index] = 17;
msgBuf[index] = dlen;//#pragma pack(1)后大小正确
index += 1;
//系统是小端序将deviceStatus转换为大端序
memcpy(msgBuf+index, &deviceStatus.sensorStatus, 1);

View File

@ -375,6 +375,8 @@ typedef enum {
INIT_FAILED = 2
} InitStatus_t;
// 大小对齐至1字节
#pragma pack(1)
// 三通阀结构体
typedef struct {
uint16_t angle[2]; // 阀门实时角度