support mk60e5

This commit is contained in:
Matthew Kennedy 2023-11-26 16:51:29 -08:00
parent f26e64e40c
commit d35b833ead
3 changed files with 13 additions and 2 deletions

View File

@ -296,7 +296,7 @@ typedef enum __attribute__ ((__packed__)) {
typedef enum __attribute__ ((__packed__)) {
BMW_e46 = 0,
W202 = 1,
BMW_e90 = 2,
} can_vss_nbc_e;
/**

View File

@ -21,6 +21,8 @@ static expected<uint16_t> look_up_can_id(can_vss_nbc_e type) {
switch (type) {
case BMW_e46:
return 0x01F0; /* BMW e46 ABS Message */
case BMW_e90:
return 0x10A; // BMW E90 ABS speed frame (not wheel speeds, vehicle speed)
case W202:
return 0x0200; /* W202 C180 ABS signal */
default:
@ -39,6 +41,13 @@ float processBMW_e46(const CANRxFrame& frame) {
return (left + right) / (16 * 2);
}
float processBMW_e90(const CANRxFrame& frame) {
uint8_t low = frame.data8[0];
uint8_t high = frame.data8[1] & 0x0F;
return (low | high << 8);
}
float processW202(const CANRxFrame& frame) {
uint16_t tmp = (frame.data8[2] << 8);
tmp |= frame.data8[3];
@ -51,6 +60,8 @@ expected<float> processCanRxVssImpl(const CANRxFrame& frame) {
switch (engineConfiguration->canVssNbcType){
case BMW_e46:
return processBMW_e46(frame);
case BMW_e90:
return processBMW_e90(frame);
case W202:
return processW202(frame);
default:

View File

@ -1252,7 +1252,7 @@ tChargeMode_e tChargeMode;
Gpio tle8888_cs;
pin_output_mode_e tle8888_csPinMode;
custom can_vss_nbc_e 1 bits, U08, @OFFSET@, [0:0], "BMW_e46", "W202"
custom can_vss_nbc_e 2 bits, U08, @OFFSET@, [0:1], "BMW_e46", "W202", "BMW E8x/E9x MK60e5"
can_vss_nbc_e canVssNbcType
Gpio mc33816_cs;