From aa84b7fc9bd900bf5a8cbba6c87604b492fcd1e5 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 13 Apr 2023 14:48:00 -0700 Subject: [PATCH] CANParser: add msg name to debug prints (#813) --- can/common.h | 1 + can/parser.cc | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/can/common.h b/can/common.h index ba9ce02348..b4dd10426f 100644 --- a/can/common.h +++ b/can/common.h @@ -37,6 +37,7 @@ unsigned int pedal_checksum(uint32_t address, const Signal &sig, const std::vect class MessageState { public: + std::string name; uint32_t address; unsigned int size; diff --git a/can/parser.cc b/can/parser.cc index 90fd4eaecf..d3995dc246 100644 --- a/can/parser.cc +++ b/can/parser.cc @@ -124,6 +124,7 @@ CANParser::CANParser(int abus, const std::string& dbc_name, assert(false); } + state.name = msg->name; state.size = msg->size; assert(state.size <= 64); // max signal size is 64 bytes @@ -162,6 +163,7 @@ CANParser::CANParser(int abus, const std::string& dbc_name, bool ignore_checksum for (const auto& msg : dbc->msgs) { MessageState state = { + .name = msg.name, .address = msg.address, .size = msg.size, .ignore_checksum = ignore_checksum, @@ -287,9 +289,9 @@ void CANParser::UpdateValid(uint64_t sec) { if (state.check_threshold > 0 && (missing || timed_out)) { if (show_missing && !bus_timeout) { if (missing) { - LOGE("0x%X NOT SEEN", state.address); + LOGE("0x%X '%s' NOT SEEN", state.address, state.name.c_str()); } else if (timed_out) { - LOGE("0x%X TIMED OUT", state.address); + LOGE("0x%X '%s' TIMED OUT", state.address, state.name.c_str()); } } _valid = false;