Files
StarPilot/selfdrive/car/cruise_state.py
T
firestar5683 7fb15f97ab v16
2026-06-03 22:14:00 -05:00

23 lines
839 B
Python

from opendbc.car import structs
def hyundai_openpilot_longitudinal_acc_req_feedback(CP: structs.CarParams) -> bool:
return CP.brand == 'hyundai' and CP.openpilotLongitudinalControl and not CP.pcmCruise
def should_cancel_stock_cruise(CP: structs.CarParams, cruise_enabled: bool, controls_enabled: bool) -> bool:
if not cruise_enabled:
return False
if not controls_enabled:
return True
return not CP.pcmCruise and not hyundai_openpilot_longitudinal_acc_req_feedback(CP)
def should_flag_cruise_mismatch(CP: structs.CarParams, cruise_enabled: bool, controls_enabled: bool,
effective_pcm_cruise: bool) -> bool:
if not cruise_enabled:
return False
if not controls_enabled:
return True
return not effective_pcm_cruise and not hyundai_openpilot_longitudinal_acc_req_feedback(CP)