Skip to content

Commit

Permalink
Revert "GM fix 'Controls Failed' on resuming after cycling main cruis…
Browse files Browse the repository at this point in the history
…e switch (commaai#255)"

This reverts commit 17f92b6.
  • Loading branch information
kishkaru committed Jan 10, 2020
1 parent a02bc73 commit e0d54d2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ struct CarEvent @0x9b1657f34caf3ad3 {
immediateDisable @6 :Bool;
preEnable @7 :Bool;
permanent @8 :Bool;
resetVCruise @9 :Bool;

enum EventName @0xbaa8c5d505f727de {
# TODO: copy from error list
Expand Down
9 changes: 1 addition & 8 deletions selfdrive/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,18 +370,11 @@ def update(self, c, can_strings):
# handle button presses
for b in ret.buttonEvents:
# do enable on both accel and decel buttons
# The ECM will fault if resume triggers an enable while speed is set to 0
if b.type == ButtonType.accelCruise and c.hudControl.setSpeed > 0 and c.hudControl.setSpeed < 70 and not b.pressed:
events.append(create_event('buttonEnable', [ET.ENABLE]))
if b.type == ButtonType.decelCruise and not b.pressed:
if b.type in [ButtonType.accelCruise, ButtonType.decelCruise] and not b.pressed:
events.append(create_event('buttonEnable', [ET.ENABLE]))
# do disable on button down
if b.type == ButtonType.cancel and b.pressed:
events.append(create_event('buttonCancel', [ET.USER_DISABLE]))
# The ECM independently tracks a ‘speed is set’ state that is reset on main off.
# To keep controlsd in sync with the ECM state, generate a RESET_V_CRUISE event on main cruise presses.
if b.type == ButtonType.altButton3 and b.pressed:
events.append(create_event('buttonCancel', [ET.RESET_V_CRUISE, ET.USER_DISABLE]))

ret.events = events

Expand Down
4 changes: 0 additions & 4 deletions selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ def state_transition(frame, CS, CP, state, events, soft_disable_timer, v_cruise_
# decrease the soft disable timer at every step, as it's reset on
# entrance in SOFT_DISABLING state
soft_disable_timer = max(0, soft_disable_timer - 1)

# Reset v_cruise_kph to 0
if get_events(events, [ET.RESET_V_CRUISE]):
v_cruise_kph = 0

# DISABLED
if state == State.disabled:
Expand Down
1 change: 0 additions & 1 deletion selfdrive/controls/lib/drive_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class EventTypes:
SOFT_DISABLE = 'softDisable'
IMMEDIATE_DISABLE = 'immediateDisable'
PERMANENT = 'permanent'
RESET_V_CRUISE = 'resetVCruise'


def create_event(name, types):
Expand Down

0 comments on commit e0d54d2

Please sign in to comment.