From 185ffc281122be730181987557d4c0bf0a292c9c Mon Sep 17 00:00:00 2001 From: John Zhao Date: Tue, 17 Apr 2018 14:46:11 +0800 Subject: [PATCH] Change checksum log message --- src/internal/channels.cc | 20 ++++++++++---------- src/internal/streams.cc | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/internal/channels.cc b/src/internal/channels.cc index f7960fd..1cda925 100644 --- a/src/internal/channels.cc +++ b/src/internal/channels.cc @@ -514,16 +514,16 @@ bool Channels::GetFiles( std::uint16_t size = _from_data(data + 1); 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++) { - 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 << std::uppercase << std::setw(2) << std::setfill('0') - << static_cast(checksum_cal) << ", but 0x" - << std::setw(2) << std::setfill('0') - << static_cast(checksum) << " now"; + << static_cast(checksum) << ", but 0x" << std::setw(2) + << std::setfill('0') << static_cast(checksum_now) + << " now"; 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++) { checksum = (checksum ^ data[i]); } - if (checksum != res->checksum) { + if (res->checksum != checksum) { LOG(WARNING) << "Imu response packet checksum should be 0x" << std::hex << std::uppercase << std::setw(2) << std::setfill('0') - << static_cast(checksum) << ", but 0x" << std::setw(2) - << std::setfill('0') << static_cast(res->checksum) - << " now"; + << static_cast(res->checksum) << ", but 0x" + << std::setw(2) << std::setfill('0') + << static_cast(checksum) << " now"; return false; } diff --git a/src/internal/streams.cc b/src/internal/streams.cc index fc2785b..7631a04 100644 --- a/src/internal/streams.cc +++ b/src/internal/streams.cc @@ -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] checksum = (checksum ^ packet[i]); } - if (checksum != img_packet.checksum) { + if (img_packet.checksum != checksum) { LOG(WARNING) << "Image packet checksum should be 0x" << std::hex << std::uppercase << std::setw(2) << std::setfill('0') - << static_cast(checksum) << ", but 0x" << std::setw(2) - << std::setfill('0') << static_cast(img_packet.checksum) - << " now"; + << static_cast(img_packet.checksum) << ", but 0x" + << std::setw(2) << std::setfill('0') + << static_cast(checksum) << " now"; return false; }