Change checksum log message
This commit is contained in:
parent
460c707253
commit
185ffc2811
|
@ -514,16 +514,16 @@ bool Channels::GetFiles(
|
||||||
std::uint16_t size = _from_data<std::uint16_t>(data + 1);
|
std::uint16_t size = _from_data<std::uint16_t>(data + 1);
|
||||||
std::uint8_t checksum = data[3 + size];
|
std::uint8_t checksum = data[3 + size];
|
||||||
|
|
||||||
std::uint8_t checksum_cal = 0;
|
std::uint8_t checksum_now = 0;
|
||||||
for (std::size_t i = 4, n = 4 + size; i < n; i++) {
|
for (std::size_t i = 4, n = 4 + size; i < n; i++) {
|
||||||
checksum_cal = (checksum_cal ^ data[i]);
|
checksum_now = (checksum_now ^ data[i]);
|
||||||
}
|
}
|
||||||
if (checksum_cal != checksum) {
|
if (checksum != checksum_now) {
|
||||||
LOG(WARNING) << "Files checksum should be 0x" << std::hex
|
LOG(WARNING) << "Files checksum should be 0x" << std::hex
|
||||||
<< std::uppercase << std::setw(2) << std::setfill('0')
|
<< std::uppercase << std::setw(2) << std::setfill('0')
|
||||||
<< static_cast<int>(checksum_cal) << ", but 0x"
|
<< static_cast<int>(checksum) << ", but 0x" << std::setw(2)
|
||||||
<< std::setw(2) << std::setfill('0')
|
<< std::setfill('0') << static_cast<int>(checksum_now)
|
||||||
<< static_cast<int>(checksum) << " now";
|
<< " now";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -901,12 +901,12 @@ bool Channels::XuImuRead(ImuResPacket *res) const {
|
||||||
for (std::size_t i = 4, n = 4 + res->size; i < n; i++) {
|
for (std::size_t i = 4, n = 4 + res->size; i < n; i++) {
|
||||||
checksum = (checksum ^ data[i]);
|
checksum = (checksum ^ data[i]);
|
||||||
}
|
}
|
||||||
if (checksum != res->checksum) {
|
if (res->checksum != checksum) {
|
||||||
LOG(WARNING) << "Imu response packet checksum should be 0x" << std::hex
|
LOG(WARNING) << "Imu response packet checksum should be 0x" << std::hex
|
||||||
<< std::uppercase << std::setw(2) << std::setfill('0')
|
<< std::uppercase << std::setw(2) << std::setfill('0')
|
||||||
<< static_cast<int>(checksum) << ", but 0x" << std::setw(2)
|
<< static_cast<int>(res->checksum) << ", but 0x"
|
||||||
<< std::setfill('0') << static_cast<int>(res->checksum)
|
<< std::setw(2) << std::setfill('0')
|
||||||
<< " now";
|
<< static_cast<int>(checksum) << " now";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,12 @@ bool unpack_stereo_img_data(
|
||||||
for (std::size_t i = 2, n = packet_n - 2; i <= n; i++) { // content: [2,9]
|
for (std::size_t i = 2, n = packet_n - 2; i <= n; i++) { // content: [2,9]
|
||||||
checksum = (checksum ^ packet[i]);
|
checksum = (checksum ^ packet[i]);
|
||||||
}
|
}
|
||||||
if (checksum != img_packet.checksum) {
|
if (img_packet.checksum != checksum) {
|
||||||
LOG(WARNING) << "Image packet checksum should be 0x" << std::hex
|
LOG(WARNING) << "Image packet checksum should be 0x" << std::hex
|
||||||
<< std::uppercase << std::setw(2) << std::setfill('0')
|
<< std::uppercase << std::setw(2) << std::setfill('0')
|
||||||
<< static_cast<int>(checksum) << ", but 0x" << std::setw(2)
|
<< static_cast<int>(img_packet.checksum) << ", but 0x"
|
||||||
<< std::setfill('0') << static_cast<int>(img_packet.checksum)
|
<< std::setw(2) << std::setfill('0')
|
||||||
<< " now";
|
<< static_cast<int>(checksum) << " now";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user