This commit is contained in:
Jason Wen
2023-08-26 17:55:52 -04:00
parent 5292924533
commit 30322aee1c
2 changed files with 11 additions and 9 deletions
+4 -3
View File
@@ -113,10 +113,11 @@ class CarController:
# disable LFA on HDA2
if self.frame % 5 == 0 and hda2:
if not hda2_alt_steering:
can_sends.append(hyundaicanfd.create_cam_0x2a4(self.packer, self.CAN, CS.cam_0x2a4))
elif hda2_alt_steering:
# TODO: consolidate both messages, they have similar definitions
if hda2_alt_steering:
can_sends.append(hyundaicanfd.create_cam_0x362(self.packer, self.CAN, CS.cam_0x362))
else:
can_sends.append(hyundaicanfd.create_cam_0x2a4(self.packer, self.CAN, CS.cam_0x2a4))
# LFA and HDA icons
if self.frame % 5 == 0 and (not hda2 or hda2_long):
+7 -6
View File
@@ -228,10 +228,12 @@ class CarState(CarStateBase):
self.buttons_counter = cp.vl[self.cruise_btns_msg_canfd]["COUNTER"]
ret.accFaulted = cp.vl["TCS"]["ACCEnable"] != 0 # 0 ACC CONTROL ENABLED, 1-3 ACC CONTROL DISABLED
# TODO: consolidate both messages, they have similar definitions
if self.CP.flags & HyundaiFlags.CANFD_HDA2 and not self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING:
self.cam_0x2a4 = copy.copy(cp_cam.vl["CAM_0x2a4"])
if self.CP.flags & HyundaiFlags.CANFD_HDA2 and self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING:
self.cam_0x362 = copy.copy(cp_cam.vl["CAM_0x362"])
if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING:
self.cam_0x362 = copy.copy(cp_cam.vl["CAM_0x362"])
else:
self.cam_0x2a4 = copy.copy(cp_cam.vl["CAM_0x2a4"])
return ret
@@ -334,9 +336,8 @@ class CarState(CarStateBase):
def get_cam_can_parser_canfd(CP):
messages = []
if CP.flags & HyundaiFlags.CANFD_HDA2 and not CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING:
messages += [("CAM_0x2a4", 20)]
elif CP.flags & HyundaiFlags.CANFD_HDA2 and CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING:
messages += [("CAM_0x362", 20)]
block_lfa_msg = "CAM_0x362" if CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING else "CAM_0x2a4"
messages += [(block_lfa_msg, 20)]
elif CP.flags & HyundaiFlags.CANFD_CAMERA_SCC:
messages += [
("SCC_CONTROL", 50),