Fix weird bitwise logic

pull/26342/head^2
Jason Wen 3 years ago
parent 557418a5cf
commit 0b7572ed53
No known key found for this signature in database
GPG Key ID: 6AAEBEBBB33E2AD2
  1. 4
      selfdrive/car/hyundai/carstate.py

@ -199,7 +199,7 @@ class CarState(CarStateBase):
self.is_metric = cp.vl["CLUSTER_INFO"]["DISTANCE_UNIT"] != 1
if not self.CP.openpilotLongitudinalControl:
speed_factor = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS
cp_cruise_info = cp if self.CP.flags & (HyundaiFlags.CANFD_HDA2 | ~HyundaiFlags.CANFD_CAMERA_SCC) else cp_cam
cp_cruise_info = cp_cam if self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC else cp
ret.cruiseState.speed = cp_cruise_info.vl["CRUISE_INFO"]["SET_SPEED"] * speed_factor
ret.cruiseState.standstill = cp_cruise_info.vl["CRUISE_INFO"]["CRUISE_STANDSTILL"] == 1
self.cruise_info = copy.copy(cp_cruise_info.vl["CRUISE_INFO"])
@ -458,7 +458,7 @@ class CarState(CarStateBase):
("DOORS_SEATBELTS", 4),
]
if CP.flags & (HyundaiFlags.CANFD_HDA2 | ~HyundaiFlags.CANFD_CAMERA_SCC) and not CP.openpilotLongitudinalControl:
if not (CP.flags & HyundaiFlags.CANFD_CAMERA_SCC) and not CP.openpilotLongitudinalControl:
signals += [
("COUNTER", "CRUISE_INFO"),
("NEW_SIGNAL_1", "CRUISE_INFO"),

Loading…
Cancel
Save