@@ -101,14 +101,13 @@ static int volkswagen_mqb_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
101
101
bool valid = addr_safety_check (to_push , volkswagen_mqb_rx_checks , VOLKSWAGEN_MQB_RX_CHECKS_LEN ,
102
102
volkswagen_get_checksum , volkswagen_mqb_compute_crc , volkswagen_get_counter );
103
103
104
- if (valid ) {
105
- int bus = GET_BUS (to_push );
104
+ if (valid && (GET_BUS (to_push ) == 0 )) {
106
105
int addr = GET_ADDR (to_push );
107
106
108
107
// Update in-motion state by sampling front wheel speeds
109
108
// Signal: ESP_19.ESP_VL_Radgeschw_02 (front left) in scaled km/h
110
109
// Signal: ESP_19.ESP_VR_Radgeschw_02 (front right) in scaled km/h
111
- if (( bus == 0 ) && ( addr == MSG_ESP_19 ) ) {
110
+ if (addr == MSG_ESP_19 ) {
112
111
int wheel_speed_fl = GET_BYTE (to_push , 4 ) | (GET_BYTE (to_push , 5 ) << 8 );
113
112
int wheel_speed_fr = GET_BYTE (to_push , 6 ) | (GET_BYTE (to_push , 7 ) << 8 );
114
113
// Check for average front speed in excess of 0.3m/s, 1.08km/h
@@ -119,7 +118,7 @@ static int volkswagen_mqb_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
119
118
// Update driver input torque samples
120
119
// Signal: EPS_01.Driver_Strain (absolute torque)
121
120
// Signal: EPS_01.Driver_Strain_VZ (direction)
122
- if (( bus == 0 ) && ( addr == MSG_EPS_01 ) ) {
121
+ if (addr == MSG_EPS_01 ) {
123
122
int torque_driver_new = GET_BYTE (to_push , 5 ) | ((GET_BYTE (to_push , 6 ) & 0x1F ) << 8 );
124
123
int sign = (GET_BYTE (to_push , 6 ) & 0x80 ) >> 7 ;
125
124
if (sign == 1 ) {
@@ -130,14 +129,14 @@ static int volkswagen_mqb_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
130
129
131
130
// Update ACC status from drivetrain coordinator for controls-allowed state
132
131
// Signal: TSK_06.TSK_Status
133
- if (( bus == 0 ) && ( addr == MSG_TSK_06 ) ) {
132
+ if (addr == MSG_TSK_06 ) {
134
133
int acc_status = (GET_BYTE (to_push , 3 ) & 0x7 );
135
134
controls_allowed = ((acc_status == 3 ) || (acc_status == 4 ) || (acc_status == 5 )) ? 1 : 0 ;
136
135
}
137
136
138
137
// Exit controls on rising edge of gas press
139
138
// Signal: Motor_20.MO_Fahrpedalrohwert_01
140
- if (( bus == 0 ) && ( addr == MSG_MOTOR_20 ) ) {
139
+ if (addr == MSG_MOTOR_20 ) {
141
140
int gas = (GET_BYTES_04 (to_push ) >> 12 ) & 0xFF ;
142
141
if ((gas > 0 ) && (volkswagen_gas_prev == 0 )) {
143
142
controls_allowed = 0 ;
@@ -147,7 +146,7 @@ static int volkswagen_mqb_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
147
146
148
147
// Exit controls on rising edge of brake press
149
148
// Signal: ESP_05.ESP_Fahrer_bremst
150
- if (( bus == 0 ) && ( addr == MSG_ESP_05 ) ) {
149
+ if (addr == MSG_ESP_05 ) {
151
150
bool brake_pressed = (GET_BYTE (to_push , 3 ) & 0x4 ) >> 2 ;
152
151
if (brake_pressed && (!(volkswagen_brake_pressed_prev ) || volkswagen_moving )) {
153
152
controls_allowed = 0 ;
@@ -156,7 +155,7 @@ static int volkswagen_mqb_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
156
155
}
157
156
158
157
// If there are HCA messages on bus 0 not sent by OP, there's a relay problem
159
- if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT ) && (bus == 0 ) && ( addr == MSG_HCA_01 )) {
158
+ if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT ) && (addr == MSG_HCA_01 )) {
160
159
relay_malfunction = true;
161
160
}
162
161
}
0 commit comments