Skip to content

Commit

Permalink
Merge pull request #93 from vntarasov/volt
Browse files Browse the repository at this point in the history
Tweak Volt's brake pedal stickiness
  • Loading branch information
geohot authored Mar 8, 2018
2 parents 06f5109 + 2434f1c commit 30fd66a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions board/safety/safety_gm.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int brake = (to_push->RDLR & 0xFF00) >> 8;
// Brake pedal's potentiometer returns near-zero reading
// even when pedal is not pressed
if (brake <= 5) {
if (brake < 10) {
brake = 0;
}
if (brake && (!gm_brake_prev || gm_speed)) {
Expand All @@ -71,7 +71,7 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// exit controls on rising edge of gas press
if (addr == 417) {
int gas = to_push->RDHR & 0xFF0000;
if (gas && !(gm_gas_prev)) {
if (gas && !gm_gas_prev) {
controls_allowed = 0;
}
gm_gas_prev = gas;
Expand Down Expand Up @@ -102,7 +102,7 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// disallow actuator commands if gas or brake (with vehicle moving) are pressed
// and the the latching controls_allowed flag is True
int pedal_pressed = gm_gas_prev || (gm_brake_prev && gm_speed);
int current_controls_allowed = controls_allowed && !(pedal_pressed);
int current_controls_allowed = controls_allowed && !pedal_pressed;

uint32_t addr;
if (to_send->RIR & 4) {
Expand Down

0 comments on commit 30fd66a

Please sign in to comment.