dbc parser: remove address check for interceptor check (#615)

* draft

* remove address

* don't see why this isn't fine
This commit is contained in:
Shane Smiskol 2022-05-25 23:49:48 -07:00 committed by GitHub
parent 7701277d26
commit c8a851618a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 11 deletions

View File

@ -76,7 +76,7 @@ ChecksumState* get_checksum(const std::string& dbc_name) {
return s;
}
void set_signal_type(Signal& s, uint32_t address, ChecksumState* chk, const std::string& dbc_name, int line_num) {
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");
@ -90,15 +90,12 @@ void set_signal_type(Signal& s, uint32_t address, ChecksumState* chk, const std:
s.type = chk->counter_type;
}
}
// TODO: replace hardcoded addresses with signal names. prefix with COMMA_PEDAL_?
if (address == 0x200 || address == 0x201) {
if (s.name == "CHECKSUM_PEDAL") {
DBC_ASSERT(s.size == 8, "PEDAL CHECKSUM is not 8 bits long");
s.type = PEDAL_CHECKSUM;
} else if (s.name == "COUNTER_PEDAL") {
DBC_ASSERT(s.size == 4, "PEDAL COUNTER is not 4 bits long");
s.type = PEDAL_COUNTER;
}
if (s.name == "CHECKSUM_PEDAL") {
DBC_ASSERT(s.size == 8, "INTERCEPTOR CHECKSUM is not 8 bits long");
s.type = PEDAL_CHECKSUM;
} else if (s.name == "COUNTER_PEDAL") {
DBC_ASSERT(s.size == 4, "INTERCEPTOR COUNTER is not 4 bits long");
s.type = PEDAL_COUNTER;
}
}
@ -161,7 +158,7 @@ DBC* dbc_parse(const std::string& dbc_name, const std::string& dbc_file_path) {
sig.is_signed = match[offset + 5].str() == "-";
sig.factor = std::stod(match[offset + 6].str());
sig.offset = std::stod(match[offset + 7].str());
set_signal_type(sig, address, checksum.get(), dbc_name, line_num);
set_signal_type(sig, checksum.get(), dbc_name, line_num);
if (sig.is_little_endian) {
sig.lsb = sig.start_bit;
sig.msb = sig.start_bit + sig.size - 1;