@@ -58,7 +58,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
58
58
}
59
59
60
60
// exit controls on rising edge of gas press if no interceptor
61
- if (!bosch_hardware && ! gas_interceptor_detected ) {
61
+ if (!gas_interceptor_detected ) {
62
62
if ((to_push -> RIR >>21 ) == 0x17C ) {
63
63
int gas = to_push -> RDLR & 0xFF ;
64
64
if (gas && !(gas_prev )) {
@@ -83,7 +83,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
83
83
int current_controls_allowed = controls_allowed && !(pedal_pressed );
84
84
85
85
// BRAKE: safety check
86
- if (! bosch_hardware && (to_send -> RIR >>21 ) == 0x1FA ) {
86
+ if ((to_send -> RIR >>21 ) == 0x1FA ) {
87
87
if (current_controls_allowed ) {
88
88
if ((to_send -> RDLR & 0xFFFFFF3F ) != to_send -> RDLR ) return 0 ;
89
89
} else {
@@ -92,7 +92,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
92
92
}
93
93
94
94
// STEER: safety check
95
- if ((to_send -> RIR >>21 ) == 0xE4 || (! bosch_hardware && ( to_send -> RIR >>21 ) == 0x194 ) ) {
95
+ if ((to_send -> RIR >>21 ) == 0xE4 || (to_send -> RIR >>21 ) == 0x194 ) {
96
96
if (current_controls_allowed ) {
97
97
// all messages are fine here
98
98
} else {
@@ -101,7 +101,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
101
101
}
102
102
103
103
// GAS: safety check
104
- if (! bosch_hardware && (to_send -> RIR >>21 ) == 0x200 ) {
104
+ if ((to_send -> RIR >>21 ) == 0x200 ) {
105
105
if (current_controls_allowed ) {
106
106
// all messages are fine here
107
107
} else {
@@ -120,15 +120,11 @@ static int honda_tx_lin_hook(int lin_num, uint8_t *data, int len) {
120
120
121
121
static void honda_init (int16_t param ) {
122
122
controls_allowed = 0 ;
123
+ bosch_hardware = false;
123
124
}
124
125
125
126
static int honda_fwd_hook (int bus_num , CAN_FIFOMailBox_TypeDef * to_fwd ) {
126
- int bus_fwd_num = -1 ;
127
- if (bosch_hardware && (bus_num == 1 || bus_num == 2 )) {
128
- int addr = to_fwd -> RIR >>21 ;
129
- bus_fwd_num = addr != 0xE4 && addr != 0x33D ? (uint8_t )(~bus_num & 0x3 ) : -1 ;
130
- }
131
- return bus_fwd_num ;
127
+ return -1 ;
132
128
}
133
129
134
130
const safety_hooks honda_hooks = {
@@ -144,10 +140,18 @@ static void honda_bosch_init(int16_t param) {
144
140
bosch_hardware = true;
145
141
}
146
142
143
+ static int honda_bosch_fwd_hook (int bus_num , CAN_FIFOMailBox_TypeDef * to_fwd ) {
144
+ if (bus_num == 1 || bus_num == 2 ) {
145
+ int addr = to_fwd -> RIR >>21 ;
146
+ return addr != 0xE4 && addr != 0x33D ? (uint8_t )(~bus_num & 0x3 ) : -1 ;
147
+ }
148
+ return -1 ;
149
+ }
150
+
147
151
const safety_hooks honda_bosch_hooks = {
148
152
.init = honda_bosch_init ,
149
153
.rx = honda_rx_hook ,
150
154
.tx = honda_tx_hook ,
151
155
.tx_lin = honda_tx_lin_hook ,
152
- .fwd = honda_fwd_hook ,
156
+ .fwd = honda_bosch_fwd_hook ,
153
157
};
0 commit comments