diff --git a/selfdrive/car/nissan/carcontroller.py b/selfdrive/car/nissan/carcontroller.py index f165eb4332..56e2ae7522 100644 --- a/selfdrive/car/nissan/carcontroller.py +++ b/selfdrive/car/nissan/carcontroller.py @@ -76,7 +76,7 @@ class CarController(): can_sends.append(nissancan.create_cancel_msg(self.packer, CS.cancel_msg, cruise_cancel)) can_sends.append(nissancan.create_steering_control( - self.packer, self.car_fingerprint, apply_angle, frame, acc_active, self.lkas_max_torque)) + self.packer, self.car_fingerprint, apply_angle, frame, enabled, self.lkas_max_torque)) if frame % 2 == 0: can_sends.append(nissancan.create_lkas_hud_msg( diff --git a/selfdrive/car/nissan/carstate.py b/selfdrive/car/nissan/carstate.py index 4930e8a1f4..849e89b731 100644 --- a/selfdrive/car/nissan/carstate.py +++ b/selfdrive/car/nissan/carstate.py @@ -48,13 +48,16 @@ class CarState(CarStateBase): elif self.CP.carFingerprint == CAR.LEAF: ret.cruiseState.available = bool(cp.vl["CRUISE_THROTTLE"]["CRUISE_AVAILABLE"]) - # TODO: Find mph/kph bit on XTRAIL - if self.CP.carFingerprint == CAR.LEAF: - speed = cp_adas.vl["PROPILOT_HUD"]["SET_SPEED"] - if speed != 255: - speed -= 1 # Speed on HUD is always 1 lower than actually sent on can bus + # TODO: Find mph/kph bit on XTRAIL until then, assume xtrail is kph. + # Unable to change kph to mph on the xtrail, need a rogue to test it on + speed = cp_adas.vl["PROPILOT_HUD"]["SET_SPEED"] + if speed != 255: + if self.CP.carFingerprint == CAR.XTRAIL: + conversion = CV.KPH_TO_MS + else: conversion = CV.MPH_TO_MS if cp.vl["HUD_SETTINGS"]["SPEED_MPH"] else CV.KPH_TO_MS - ret.cruiseState.speed = speed * conversion + speed -= 1 # Speed on HUD is always 1 lower than actually sent on can bus + ret.cruiseState.speed = speed * conversion ret.steeringTorque = cp.vl["STEER_TORQUE_SENSOR"]["STEER_TORQUE_DRIVER"] ret.steeringPressed = abs(ret.steeringTorque) > STEER_THRESHOLD diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 9c84b7d3a6..10ff3748b8 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -9340df7223fd4ec402d161523301a996d33aef5c \ No newline at end of file +64da2a519cfff9f74bd07190dd96425224a8ad1f \ No newline at end of file