mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-10 06:23:43 +08:00
ef11470b30
Register GM controllers, car state, distance-button actions and feature capabilities against the shared platform groups.
23 lines
707 B
Python
23 lines
707 B
Python
from opendbc.car.gm.values import is_bolt_cc_profile
|
|
from opendbc.car.structs import car
|
|
from openpilot.cereal import log
|
|
from openpilot.selfdrive.selfdrived.events import EVENTS, ET, ImmediateDisableAlert
|
|
|
|
|
|
def qualified(cp) -> bool:
|
|
try:
|
|
return bool(is_bolt_cc_profile(cp))
|
|
except (AttributeError, IndexError, TypeError, ValueError):
|
|
return False
|
|
|
|
|
|
def event_rules(cp) -> dict:
|
|
if not qualified(cp):
|
|
return {}
|
|
name = log.OnroadEvent.EventName.wrongGear
|
|
return {name: {**EVENTS[name], ET.USER_DISABLE: ImmediateDisableAlert("Gear not D")}}
|
|
|
|
|
|
def unsupported_gear(cp, gear) -> bool:
|
|
return qualified(cp) and gear not in (car.CarState.GearShifter.drive, car.CarState.GearShifter.low)
|