debug-7
This commit is contained in:
parent
49993af206
commit
64237aebe7
@ -27,10 +27,16 @@ public:
|
||||
|
||||
void subData(const uint8_t* sub_address, int& index)
|
||||
{
|
||||
int dataLength = getLength(m_type);
|
||||
|
||||
uint32_t dataSize = getDataSize() - index;
|
||||
uint32_t protocolSize = checkXor(&sub_address[index] , dataSize);
|
||||
if(protocolSize == 44)
|
||||
// 简单的XOR校验
|
||||
uint8_t check_sum = 0;
|
||||
for (int i = 0; i < dataLength - 1; ++i)
|
||||
{
|
||||
check_sum ^= sub_address[i];
|
||||
}
|
||||
|
||||
if (check_sum == sub_address[dataLength - 1])
|
||||
{
|
||||
int16_t middle;
|
||||
uint32_t tmpU32;
|
||||
@ -49,9 +55,7 @@ public:
|
||||
m_pubAsensingMsg.temperature = middle * 200.0 / 32768;
|
||||
// time
|
||||
tmpU32 = toValue<uint32_t>(sub_address, sub_index);
|
||||
m_pubAsensingMsg.imu_time_stamp = (double)tmpU32 / 4000;
|
||||
// status
|
||||
m_pubAsensingMsg.status = toValue<uint8_t>(sub_address, sub_index);
|
||||
m_pubAsensingMsg.time = (double)tmpU32 / 4000;
|
||||
|
||||
/* msg header */
|
||||
m_pubAsensingMsg.header.frame_id = m_frameId;
|
||||
@ -102,7 +106,7 @@ public:
|
||||
isPrint = true;
|
||||
}
|
||||
}
|
||||
index += protocolSize;
|
||||
index += dataLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user