mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-21 09:12:25 +08:00
23 lines
839 B
Python
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)
|