Skip to content

Commit

Permalink
Alexandre Sato's Auto Brake Hold
Browse files Browse the repository at this point in the history
  • Loading branch information
eFiniLan committed Jun 28, 2024
1 parent ce9642d commit aa18bc8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
}
}
}

// AleSato's automatic brakehold
if (addr == 0x344 && (alternative_experience & ALT_EXP_ALLOW_AEB)) {
if(vehicle_moving || gas_pressed || !acc_main_on) {
tx = false;
}
}
}

// UDS: Only tester present ("\x0F\x02\x3E\x00\x00\x00\x00\x00") allowed on diagnostics address
Expand Down Expand Up @@ -337,7 +344,9 @@ static int toyota_fwd_hook(int bus_num, int addr) {
bool is_lkas_msg = ((addr == 0x2E4) || (addr == 0x412) || (addr == 0x191));
// in TSS2 the camera does ACC as well, so filter 0x343
bool is_acc_msg = (addr == 0x343);
bool block_msg = is_lkas_msg || (is_acc_msg && !toyota_stock_longitudinal);
// Block AEB when stoped to use as a automatic brakehold
bool is_aeb_msg = (addr == 0x344 && (alternative_experience & ALT_EXP_ALLOW_AEB));
bool block_msg = is_lkas_msg || (is_acc_msg && !toyota_stock_longitudinal) || (is_aeb_msg && !vehicle_moving && acc_main_on && !gas_pressed);
if (!block_msg) {
bus_fwd = 0;
}
Expand Down

0 comments on commit aa18bc8

Please sign in to comment.