Skip to content

Commit

Permalink
Better count number of speed spoofs
Browse files Browse the repository at this point in the history
  • Loading branch information
visualage committed Feb 26, 2024
1 parent 3e86787 commit a1df079
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions board/safety/safety_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ static void send_steer_enable_speed(CAN_FIFOMailBox_TypeDef *to_fwd){
}
counter_speed_spoofed = counter_speed_spoofed + 1;
}
else {
if (actual_speed < lkas_enable_speed) {
counter_speed_spoofed = 0;
} else {
counter_speed_spoofed = counter_speed_spoofed + 1;
}
}

to_fwd->RDHR &= 0x00FF0000; //clear speed and Checksum
to_fwd->RDHR |= eps_cutoff_speed; //replace speed
Expand Down Expand Up @@ -225,7 +232,6 @@ int default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
steer_type = 1;
} else {
steer_type = 3;
counter_speed_spoofed = 0;
}
lkas_torq = ((GET_BYTE(to_push, 0) & 0x7) << 8) | GET_BYTE(to_push, 1);
counter_658 += 1;
Expand All @@ -246,7 +252,6 @@ int default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
counter_284_658 += 2;
if (counter_284_658 - counter_658 > 25){
is_op_active = false;
counter_speed_spoofed = 0;
steer_type = 3;
counter_658 = 0;
counter_284_658 = 0;
Expand Down

0 comments on commit a1df079

Please sign in to comment.