@@ -44,11 +44,6 @@ addr_checks toyota_rx_checks = {toyota_addr_checks, TOYOTA_ADDR_CHECKS_LEN};
44
44
// global actuation limit states
45
45
int toyota_dbc_eps_torque_factor = 100 ; // conversion factor for STEER_TORQUE_EPS in %: see dbc file
46
46
47
- // steering faults occur when the angle rate is above a certain threshold for too long,
48
- // allow setting STEER_REQUEST bit to 0 with a non-zero desired torque when expected
49
- const uint8_t TOYOTA_MAX_STEER_RATE_FRAMES = 19U ;
50
- uint8_t toyota_steer_req_matches ; // counter for steer request bit matching non-zero torque
51
-
52
47
static uint8_t toyota_compute_checksum (CANPacket_t * to_push ) {
53
48
int addr = GET_ADDR (to_push );
54
49
int len = GET_LEN (to_push );
@@ -205,7 +200,6 @@ static int toyota_tx_hook(CANPacket_t *to_send) {
205
200
if (addr == 0x2E4 ) {
206
201
int desired_torque = (GET_BYTE (to_send , 1 ) << 8 ) | GET_BYTE (to_send , 2 );
207
202
desired_torque = to_signed (desired_torque , 16 );
208
- bool steer_req = GET_BIT (to_send , 0U ) != 0U ;
209
203
bool violation = 0 ;
210
204
211
205
uint32_t ts = microsecond_timer_get ();
@@ -233,27 +227,13 @@ static int toyota_tx_hook(CANPacket_t *to_send) {
233
227
}
234
228
}
235
229
236
- // handle steer_req bit mismatches: we set the bit to 0 at an expected
237
- // interval to bypass an EPS fault, violation if we exceed that frequency
238
- bool steer_req_mismatch = (desired_torque != 0 ) && !steer_req ;
239
- if (!steer_req_mismatch ) {
240
- toyota_steer_req_matches = MIN (toyota_steer_req_matches + 1U , 255U );
241
- } else {
242
- // no torque if controls is not allowed or mismatch with STEER_REQUEST bit
243
- if ((!controls_allowed || !steer_req ) && (desired_torque != 0 )) {
244
- violation = 1 ;
245
- }
246
- toyota_steer_req_matches = 0U ;
247
- }
248
-
249
230
// no torque if controls is not allowed
250
231
if (!controls_allowed && (desired_torque != 0 )) {
251
232
violation = 1 ;
252
233
}
253
234
254
235
// reset to 0 if either controls is not allowed or there's a violation
255
236
if (violation || !controls_allowed ) {
256
- toyota_steer_req_matches = 0U ;
257
237
desired_torque_last = 0 ;
258
238
rt_torque_last = 0 ;
259
239
ts_last = ts ;
@@ -270,7 +250,6 @@ static int toyota_tx_hook(CANPacket_t *to_send) {
270
250
271
251
static const addr_checks * toyota_init (int16_t param ) {
272
252
controls_allowed = 0 ;
273
- toyota_steer_req_matches = 0U ;
274
253
relay_malfunction_reset ();
275
254
gas_interceptor_detected = 0 ;
276
255
toyota_dbc_eps_torque_factor = param ;
0 commit comments