diff --git a/opendbc_repo/opendbc/car/toyota/carcontroller.py b/opendbc_repo/opendbc/car/toyota/carcontroller.py index d38db5bac..a82955706 100644 --- a/opendbc_repo/opendbc/car/toyota/carcontroller.py +++ b/opendbc_repo/opendbc/car/toyota/carcontroller.py @@ -284,7 +284,7 @@ class CarController(CarControllerBase): hud_control.rightLaneVisible, hud_control.leftLaneDepart, hud_control.rightLaneDepart, lat_active, CS.lkas_hud)) - if (self.frame % 100 == 0 or send_ui) and (self.CP.enableDsu or self.CP.flags & ToyotaFlags.DISABLE_RADAR.value): + if not self.CP.flags & ToyotaFlags.RADAR_FILTER.value and (self.frame % 100 == 0 or send_ui) and (self.CP.enableDsu or self.CP.flags & ToyotaFlags.DISABLE_RADAR.value): can_sends.append(toyotacan.create_fcw_command(self.packer, fcw_alert)) # *** static msgs *** @@ -293,7 +293,7 @@ class CarController(CarControllerBase): can_sends.append(CanData(addr, vl, bus)) # keep radar disabled - if self.frame % 20 == 0 and self.CP.flags & ToyotaFlags.DISABLE_RADAR.value: + if not self.CP.flags & ToyotaFlags.RADAR_FILTER.value and self.frame % 20 == 0 and self.CP.flags & ToyotaFlags.DISABLE_RADAR.value: can_sends.append(make_tester_present_msg(0x750, 0, 0xF)) new_actuators = actuators.as_builder() diff --git a/opendbc_repo/opendbc/car/toyota/interface.py b/opendbc_repo/opendbc/car/toyota/interface.py index 4865bec5d..d6dc57c69 100644 --- a/opendbc_repo/opendbc/car/toyota/interface.py +++ b/opendbc_repo/opendbc/car/toyota/interface.py @@ -118,6 +118,16 @@ class CarInterface(CarInterfaceBase): if experimental_long and candidate in RADAR_ACC_CAR: ret.flags |= ToyotaFlags.DISABLE_RADAR.value + # RADAR_ACC_CAR = CHR TSS2 / RAV4 TSS2 + # NO_DSU_CAR = CAMRY / CHR + if 0x2FF in fingerprint[0] or 0x2AA in fingerprint[0]: + print("----------------------------------------------") + print("dragonpilot: RADAR_FILTER detected!") + print("----------------------------------------------") + ret.safetyConfigs[0].safetyParam |= ToyotaSafetyFlags.LONG_FILTER.value + ret.experimentalLongitudinalAvailable = False + ret.flags |= ToyotaFlags.RADAR_FILTER.value | ToyotaFlags.DISABLE_RADAR.value + # openpilot longitudinal enabled by default: # - cars w/ DSU disconnected # - TSS2 cars with camera sending ACC_CONTROL where we can block it @@ -162,6 +172,6 @@ class CarInterface(CarInterfaceBase): @staticmethod def init(CP, can_recv, can_send): # disable radar if alpha longitudinal toggled on radar-ACC car - if CP.flags & ToyotaFlags.DISABLE_RADAR.value: + if not CP.flags & ToyotaFlags.RADAR_FILTER.value and CP.flags & ToyotaFlags.DISABLE_RADAR.value: communication_control = bytes([uds.SERVICE_TYPE.COMMUNICATION_CONTROL, uds.CONTROL_TYPE.ENABLE_RX_DISABLE_TX, uds.MESSAGE_TYPE.NORMAL]) disable_ecu(can_recv, can_send, bus=0, addr=0x750, sub_addr=0xf, com_cont_req=communication_control) diff --git a/opendbc_repo/opendbc/car/toyota/values.py b/opendbc_repo/opendbc/car/toyota/values.py index acb6a6982..e7c2aabba 100644 --- a/opendbc_repo/opendbc/car/toyota/values.py +++ b/opendbc_repo/opendbc/car/toyota/values.py @@ -80,6 +80,7 @@ class ToyotaFlags(IntFlag): ALKA = 2 ** 12 DOOR_AUTO_LOCK_UNLOCK = 2 ** 13 TSS1_SNG = 2 ** 14 + RADAR_FILTER = 2 ** 15 class Footnote(Enum): CAMRY = CarFootnote(