Skip to content

Commit

Permalink
clean up mazda steer speed alert
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Oct 2, 2024
1 parent 2b486b1 commit 726ceb5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ struct CarState {
carFaultedNonCritical @47 :Bool; # some ECU is faulted, but car remains controllable
espActive @51 :Bool;
vehicleSensorsInvalid @52 :Bool; # invalid steering angle readings, etc.
lowSpeedAlert @56 :Bool; # lost steering control due to a dynamic min steering speed

# cruise state
cruiseState @10 :CruiseState;
Expand Down
2 changes: 1 addition & 1 deletion opendbc_repo
10 changes: 3 additions & 7 deletions selfdrive/car/car_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def update(self, CS: CarStateBase, CS_prev: car.CarState, CC_prev: car.CarContro
if self.CP.carName in ('body', 'mock'):
events = Events()

elif self.CP.carName == 'subaru':
elif self.CP.carName in ('subaru', 'mazda'):
events = self.create_common_events(CS.out, CS_prev)

elif self.CP.carName == 'ford':
Expand All @@ -54,12 +54,6 @@ def update(self, CS: CarStateBase, CS_prev: car.CarState, CC_prev: car.CarContro
elif self.CP.carName == 'nissan':
events = self.create_common_events(CS.out, CS_prev, extra_gears=[GearShifter.brake])

elif self.CP.carName == 'mazda':
events = self.create_common_events(CS.out, CS_prev)

if CS.low_speed_alert: # type: ignore[attr-defined]
events.add(EventName.belowSteerSpeed)

elif self.CP.carName == 'chrysler':
events = self.create_common_events(CS.out, CS_prev, extra_gears=[GearShifter.low])

Expand Down Expand Up @@ -212,6 +206,8 @@ def create_common_events(self, CS: structs.CarState, CS_prev: car.CarState, extr
events.add(EventName.vehicleSensorsInvalid)
if CS.invalidLkasSetting:
events.add(EventName.invalidLkasSetting)
if CS.lowSpeedAlert:
events.add(EventName.belowSteerSpeed)

# Handle button presses
for b in CS.buttonEvents:
Expand Down

0 comments on commit 726ceb5

Please sign in to comment.