From 733a139646aa04d13c6a9088601ec2dc3e842fe3 Mon Sep 17 00:00:00 2001 From: cydia2020 <12470297+cydia2020@users.noreply.github.com> Date: Wed, 5 Jan 2022 02:02:53 +1100 Subject: [PATCH] Toyota: only send gas interceptor message when openpilot controls longitudinal (#23357) * Toyota: gate enableGasInterceptor behind openpilotLongitudinalControl * fix carcontroller typo * Revert "Toyota: gate enableGasInterceptor behind openpilotLongitudinalControl" This reverts commit a974e8f8cfb4040d0fe12e285154c6fff4cb9825. * put condition in carcontroller * gate building can messages Co-authored-by: Willem Melching old-commit-hash: a6aa09446176e11364f0244e87757e27e992ffbd --- selfdrive/car/toyota/carcontroller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 506d754729..2be745df4f 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -89,7 +89,7 @@ class CarController(): # we can spam can to cancel the system even if we are using lat only control if (frame % 3 == 0 and CS.CP.openpilotLongitudinalControl) or pcm_cancel_cmd: - lead = lead or CS.out.vEgo < 12. # at low speed we always assume the lead is present do ACC can be engaged + lead = lead or CS.out.vEgo < 12. # at low speed we always assume the lead is present so ACC can be engaged # Lexus IS uses a different cancellation message if pcm_cancel_cmd and CS.CP.carFingerprint in [CAR.LEXUS_IS, CAR.LEXUS_RC]: @@ -100,7 +100,7 @@ class CarController(): else: can_sends.append(create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, CS.acc_type)) - if frame % 2 == 0 and CS.CP.enableGasInterceptor: + if frame % 2 == 0 and CS.CP.enableGasInterceptor and CS.CP.openpilotLongitudinalControl: # send exactly zero if gas cmd is zero. Interceptor will send the max between read value and gas cmd. # This prevents unexpected pedal range rescaling can_sends.append(create_gas_interceptor_command(self.packer, interceptor_gas_cmd, frame // 2))