Skip to content

Commit

Permalink
fix occasional LKAS error
Browse files Browse the repository at this point in the history
  • Loading branch information
visualage committed Feb 29, 2024
1 parent a1df079 commit ad623e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion board/safety/safety_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ int default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
}

if ((addr == 284) && (bus_num == 0)) {
// the following two conditions are to stop spoofing
// when comma stops sending LKAS or ACC commands for whatever reason
// 284 is sent by the vehicle, and 502/658 is sent by comma,
// and they are sent in the same frequency (50Hz)
if (counter_502 > 0) {
counter_284_502 += 1;
if (counter_284_502 - counter_502 > 25) {
Expand All @@ -249,7 +253,7 @@ int default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
}

if (counter_658 > 0) {
counter_284_658 += 2;
counter_284_658 += 1;
if (counter_284_658 - counter_658 > 25){
is_op_active = false;
steer_type = 3;
Expand Down

0 comments on commit ad623e1

Please sign in to comment.