diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index c47972e177..9109150df7 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -132,15 +132,14 @@ class CarController(object): apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX)) # any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5 - if CS.steer_not_allowed: - apply_steer = 0 + lkas_active = enabled and not CS.steer_not_allowed # Send CAN commands. can_sends = [] # Send steering command. idx = frame % 4 - can_sends.append(hondacan.create_steering_control(self.packer, apply_steer, enabled, CS.CP.carFingerprint, idx)) + can_sends.append(hondacan.create_steering_control(self.packer, apply_steer, lkas_active, CS.CP.carFingerprint, idx)) # Send dashboard UI commands. if (frame % 10) == 0: diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index a5426453db..9dfb120088 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -63,11 +63,11 @@ def create_gas_command(packer, gas_amount, idx): return packer.make_can_msg("GAS_COMMAND", 0, values, idx) -def create_steering_control(packer, apply_steer, enabled, car_fingerprint, idx): +def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, idx): """Creates a CAN message for the Honda DBC STEERING_CONTROL.""" values = { - "STEER_TORQUE": apply_steer, - "STEER_TORQUE_REQUEST": enabled, + "STEER_TORQUE": apply_steer if lkas_active else 0, + "STEER_TORQUE_REQUEST": lkas_active, } # Set bus 2 for accord and new crv. bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) else 0