This commit is contained in:
Fancy code 2024-05-21 19:21:23 +08:00
parent 19247f0646
commit 5c95effe7c
3 changed files with 7 additions and 6 deletions

View File

@ -92,7 +92,7 @@ ssize_t McuDevice::WriteData(const void *buff, const size_t buffLength, std::sha
*/
mMutex.lock();
length = IUartSend(mUartDevice, buff, buffLength);
PrintHexadecimalData(buff, buffLength, "Mcu urat write:");
// PrintHexadecimalData(buff, buffLength, "Mcu urat write:");
mMutex.unlock();
return length;
}
@ -106,7 +106,7 @@ ssize_t McuDevice::WriteData(const void *buff, const size_t buffLength, std::sha
mMutex.lock();
AddMcuAsk(ask);
length = IUartSend(mUartDevice, buff, buffLength);
PrintHexadecimalData(buff, buffLength, "AddMcuAsk, Mcu urat write:");
// PrintHexadecimalData(buff, buffLength, "AddMcuAsk, Mcu urat write:");
mMutex.unlock();
if (WRITE_ERROR == length) {
LogError("Uart send failed, something wrong happened.\n");

View File

@ -152,8 +152,10 @@ void ProtocolHandle::MakeNoUserDataPacket(const std::shared_ptr<VProtocolParam>
packet.mCheckCode = BigEndianConversion(packet.mCheckCode);
memcpy(mProtocolData + KEY_HEAD_LENGTH, &packet.mCheckCode, CHECK_CODE_LENGTH);
mProtocolDataLength = packetLength;
if (param->mCommand != ASK_FEED_WATCH_DOG) {
ProtocolHandle::PrintHexadecimalData(
mProtocolData, mProtocolDataLength - CHECK_CODE_LENGTH, "MakeNoUserDataPacket:");
}
}
void ProtocolHandle::MakeAskIpcMissionPacket(const std::shared_ptr<VProtocolParam> &param)
{
@ -351,7 +353,6 @@ StatusCode ProtocolHandle::GetDataLength(const void *keyHead, const size_t &head
LogError("key head buf error.\n");
return CreateStatusCode(STATUS_CODE_NOT_OK);
}
ProtocolHandle::PrintHexadecimalData(keyHead, headLength);
unsigned short headNum = PROTOCOL_HEAD;
char byteOrder = ProtocolHandle::GetByteOrder();
if (ORDER_LITTLE_ENDIAN == byteOrder) {

View File

@ -64,6 +64,6 @@ unsigned short calculate_check_sum(const unsigned char *pData, unsigned short le
CRCHi = CRCLo ^ chCRCHi[uIndex];
CRCLo = chCRCLo[uIndex];
}
printf("CRCHi = 0x%x, CRCLo = 0x%x\n", CRCHi, CRCLo);
// printf("CRCHi = 0x%x, CRCLo = 0x%x\n", CRCHi, CRCLo);
return (CRCHi << 8 | CRCLo);
}