diff --git a/can/dbc.cc b/can/dbc.cc index 0d686bd9f0..e22b2ecadd 100644 --- a/can/dbc.cc +++ b/can/dbc.cc @@ -79,11 +79,13 @@ ChecksumState* get_checksum(const std::string& dbc_name) { void set_signal_type(Signal& s, ChecksumState* chk, const std::string& dbc_name, int line_num) { if (chk) { if (s.name == "CHECKSUM") { - DBC_ASSERT(s.size == chk->checksum_size, "CHECKSUM is not " << chk->checksum_size << " bits long"); + DBC_ASSERT(chk->checksum_size == -1 || s.size == chk->checksum_size, "CHECKSUM is not " << chk->checksum_size << " bits long"); + DBC_ASSERT(chk->checksum_start_bit == -1 || (s.start_bit % 8) == chk->checksum_start_bit, " CHECKSUM starts at wrong bit"); DBC_ASSERT(s.is_little_endian == chk->little_endian, "CHECKSUM has wrong endianness"); s.type = chk->checksum_type; } else if (s.name == "COUNTER") { DBC_ASSERT(chk->counter_size == -1 || s.size == chk->counter_size, "COUNTER is not " << chk->counter_size << " bits long"); + DBC_ASSERT(chk->counter_start_bit == -1 || (s.start_bit % 8) == chk->counter_start_bit, "COUNTER starts at wrong bit"); DBC_ASSERT(chk->little_endian == s.is_little_endian, "COUNTER has wrong endianness"); s.type = chk->counter_type; }