Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VW MLB: Audi A4/S4 #793

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion can/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void init_crc_lookup_tables() {
gen_crc_lookup_table_16(0x1021, crc16_lut_xmodem); // CRC-16 XMODEM for HKG CAN FD
}

unsigned int volkswagen_mqb_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
unsigned int volkswagen_mxb_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think of mxb -> mqb_mlb for better grep-ability?

Copy link
Collaborator Author

@jyoung8607 jyoung8607 Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with either. The whole set of abstractions needs another look, was focused on passing tests tonight, will look at it with fresh eyes later.

// Volkswagen uses standard CRC8 8H2F/AUTOSAR, but they compute it with
// a magic variable padding byte tacked onto the end of the payload.
// https://www.autosar.org/fileadmin/user_upload/standards/classic/4-3/AUTOSAR_SWS_CRCLibrary.pdf
Expand Down
2 changes: 1 addition & 1 deletion can/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ unsigned int honda_checksum(uint32_t address, const Signal &sig, const std::vect
unsigned int toyota_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
unsigned int subaru_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
unsigned int chrysler_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
unsigned int volkswagen_mqb_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
unsigned int volkswagen_mxb_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
unsigned int xor_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
unsigned int hkg_can_fd_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
unsigned int pedal_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
Expand Down
2 changes: 1 addition & 1 deletion can/common.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cdef extern from "common_dbc.h":
HONDA_CHECKSUM,
TOYOTA_CHECKSUM,
PEDAL_CHECKSUM,
VOLKSWAGEN_MQB_CHECKSUM,
VOLKSWAGEN_MXB_CHECKSUM,
XOR_CHECKSUM,
SUBARU_CHECKSUM,
CHRYSLER_CHECKSUM
Expand Down
2 changes: 1 addition & 1 deletion can/common_dbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum SignalType {
HONDA_CHECKSUM,
TOYOTA_CHECKSUM,
PEDAL_CHECKSUM,
VOLKSWAGEN_MQB_CHECKSUM,
VOLKSWAGEN_MXB_CHECKSUM,
XOR_CHECKSUM,
SUBARU_CHECKSUM,
CHRYSLER_CHECKSUM,
Expand Down
4 changes: 2 additions & 2 deletions can/dbc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ ChecksumState* get_checksum(const std::string& dbc_name) {
s = new ChecksumState({8, -1, 7, -1, false, TOYOTA_CHECKSUM, &toyota_checksum});
} else if (startswith(dbc_name, "hyundai_canfd")) {
s = new ChecksumState({16, -1, 0, -1, true, HKG_CAN_FD_CHECKSUM, &hkg_can_fd_checksum});
} else if (startswith(dbc_name, "vw_mqb_2010")) {
s = new ChecksumState({8, 4, 0, 0, true, VOLKSWAGEN_MQB_CHECKSUM, &volkswagen_mqb_checksum});
} else if (startswith(dbc_name, {"vw_mqb_2010", "vw_mlb"})) {
s = new ChecksumState({8, 4, 0, 0, true, VOLKSWAGEN_MXB_CHECKSUM, &volkswagen_mxb_checksum});
} else if (startswith(dbc_name, "vw_golf_mk4")) {
s = new ChecksumState({8, 4, 0, -1, true, XOR_CHECKSUM, &xor_checksum});
} else if (startswith(dbc_name, "subaru_global_")) {
Expand Down
Loading