mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-12 04:42:13 +08:00
done goofed
This commit is contained in:
@@ -336,6 +336,46 @@ class TestHyundaiFingerprint:
|
||||
assert canfd_alt_buttons_cp.flags & HyundaiFlags.CANFD_ALT_BUTTONS
|
||||
assert not canfd_alt_buttons_fpcp.redneckCruiseAvailable
|
||||
|
||||
def test_hyundai_full_long_keeps_redneck_cruise_disabled(self, monkeypatch):
|
||||
class FakeParams:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def get_bool(key):
|
||||
return key == "RedneckCruise"
|
||||
|
||||
toggles = get_test_toggles()
|
||||
monkeypatch.setattr("opendbc.car.interfaces.Params", FakeParams)
|
||||
|
||||
for candidate in (CAR.HYUNDAI_SONATA, CAR.KIA_FORTE):
|
||||
CP = CarInterface.get_params(candidate, gen_empty_fingerprint(), [], True, False, False, toggles)
|
||||
FPCP = CarInterface.get_starpilot_params(candidate, gen_empty_fingerprint(), [], CP, toggles)
|
||||
|
||||
assert CP.openpilotLongitudinalControl
|
||||
assert not FPCP.redneckCruiseAvailable
|
||||
assert FPCP.pcmCruiseSpeed
|
||||
|
||||
def test_hyundai_scc_stock_long_keeps_redneck_cruise_disabled(self, monkeypatch):
|
||||
class FakeParams:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def get_bool(key):
|
||||
return key == "RedneckCruise"
|
||||
|
||||
toggles = get_test_toggles()
|
||||
monkeypatch.setattr("opendbc.car.interfaces.Params", FakeParams)
|
||||
|
||||
for candidate in (CAR.HYUNDAI_SONATA, CAR.KIA_FORTE, CAR.HYUNDAI_IONIQ_6):
|
||||
CP = CarInterface.get_params(candidate, gen_empty_fingerprint(), [], False, False, False, toggles)
|
||||
FPCP = CarInterface.get_starpilot_params(candidate, gen_empty_fingerprint(), [], CP, toggles)
|
||||
|
||||
assert not CP.openpilotLongitudinalControl
|
||||
assert not FPCP.redneckCruiseAvailable
|
||||
assert FPCP.pcmCruiseSpeed
|
||||
|
||||
def test_palisade_2023_pause_resume_button_maps_to_enable(self):
|
||||
toggles = get_test_toggles()
|
||||
CP = CarInterface.get_params(CAR.HYUNDAI_PALISADE_2023, gen_empty_fingerprint(), [], True, False, False, toggles)
|
||||
|
||||
@@ -228,7 +228,7 @@ class CarInterfaceBase(ABC):
|
||||
if 0x1FA in fingerprint[CAN.ECAN]:
|
||||
fp_ret.flags |= HyundaiStarPilotFlags.SPEED_LIMIT_AVAILABLE.value
|
||||
|
||||
fp_ret.redneckCruiseAvailable = not bool(CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS)
|
||||
fp_ret.redneckCruiseAvailable = bool(CP.flags & HyundaiFlags.NON_SCC) and not bool(CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS)
|
||||
if fp_ret.redneckCruiseAvailable and Params(return_defaults=True).get_bool("RedneckCruise") and \
|
||||
not CP.openpilotLongitudinalControl:
|
||||
fp_ret.pcmCruiseSpeed = False
|
||||
|
||||
@@ -168,7 +168,7 @@ class Car:
|
||||
|
||||
self.mock_carstate = MockCarState()
|
||||
self.v_cruise_helper = VCruiseHelper(self.CP, self.FPCP)
|
||||
self.redneck_cruise = RedneckCruise(self.CP, self.FPCP) if self.CP.brand == "hyundai" else None
|
||||
self.redneck_cruise = RedneckCruise(self.CP, self.FPCP) if self.CP.brand == "hyundai" and self.FPCP.redneckCruiseAvailable and not self.FPCP.pcmCruiseSpeed else None
|
||||
self.redneck_button_event_filter_frames = {
|
||||
int(ButtonType.accelCruise): 0,
|
||||
int(ButtonType.decelCruise): 0,
|
||||
|
||||
@@ -41,7 +41,9 @@ class VCruiseHelper:
|
||||
self.button_change_states = {btn: {"standstill": False, "enabled": False} for btn in self.button_timers}
|
||||
|
||||
self.gm_cc_only = self.CP.carFingerprint in CC_ONLY_CAR and self.CP.flags & GMFlags.CC_LONG.value
|
||||
self.redneck_non_pcm = bool(FPCP is not None and not getattr(FPCP, "pcmCruiseSpeed", True))
|
||||
self.redneck_non_pcm = bool(FPCP is not None and
|
||||
getattr(FPCP, "redneckCruiseAvailable", False) and
|
||||
not getattr(FPCP, "pcmCruiseSpeed", True))
|
||||
|
||||
def _get_short_press_delta(self, is_metric, starpilot_toggles: SimpleNamespace) -> float:
|
||||
base_delta = 1. if is_metric else IMPERIAL_INCREMENT
|
||||
|
||||
@@ -309,7 +309,7 @@ class TestVCruiseHelper:
|
||||
class TestVCruiseHelperRedneck:
|
||||
def setup_method(self):
|
||||
self.CP = car.CarParams(pcmCruise=True)
|
||||
self.FPCP = SimpleNamespace(pcmCruiseSpeed=False)
|
||||
self.FPCP = SimpleNamespace(pcmCruiseSpeed=False, redneckCruiseAvailable=True)
|
||||
self.v_cruise_helper = VCruiseHelper(self.CP, self.FPCP)
|
||||
self.starpilot_toggles = SimpleNamespace(
|
||||
cruise_increase=1,
|
||||
|
||||
Reference in New Issue
Block a user