|
|
@ -83,11 +83,16 @@ class CarController: |
|
|
|
|
|
|
|
|
|
|
|
# tester present - w/ no response (keeps relevant ECU disabled) |
|
|
|
# tester present - w/ no response (keeps relevant ECU disabled) |
|
|
|
if self.frame % 100 == 0 and not (self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value) and self.CP.openpilotLongitudinalControl: |
|
|
|
if self.frame % 100 == 0 and not (self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value) and self.CP.openpilotLongitudinalControl: |
|
|
|
|
|
|
|
# for longitudinal control, either radar or ADAS driving ECU |
|
|
|
addr, bus = 0x7d0, 0 |
|
|
|
addr, bus = 0x7d0, 0 |
|
|
|
if self.CP.flags & HyundaiFlags.CANFD_HDA2.value: |
|
|
|
if self.CP.flags & HyundaiFlags.CANFD_HDA2.value: |
|
|
|
addr, bus = 0x730, 5 |
|
|
|
addr, bus = 0x730, 5 |
|
|
|
can_sends.append([addr, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", bus]) |
|
|
|
can_sends.append([addr, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", bus]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# for blinkers |
|
|
|
|
|
|
|
if self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: |
|
|
|
|
|
|
|
can_sends.append([0x7b1, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", 5]) |
|
|
|
|
|
|
|
|
|
|
|
# >90 degree steering fault prevention |
|
|
|
# >90 degree steering fault prevention |
|
|
|
# Count up to MAX_ANGLE_FRAMES, at which point we need to cut torque to avoid a steering fault |
|
|
|
# Count up to MAX_ANGLE_FRAMES, at which point we need to cut torque to avoid a steering fault |
|
|
|
if CC.latActive and abs(CS.out.steeringAngleDeg) >= MAX_ANGLE: |
|
|
|
if CC.latActive and abs(CS.out.steeringAngleDeg) >= MAX_ANGLE: |
|
|
@ -118,6 +123,10 @@ class CarController: |
|
|
|
if self.frame % 5 == 0 and (not hda2 or hda2_long): |
|
|
|
if self.frame % 5 == 0 and (not hda2 or hda2_long): |
|
|
|
can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CP, CC.enabled)) |
|
|
|
can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CP, CC.enabled)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# blinkers |
|
|
|
|
|
|
|
if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: |
|
|
|
|
|
|
|
can_sends.extend(hyundaicanfd.create_spas_messages(self.packer, self.frame, False, False)) |
|
|
|
|
|
|
|
|
|
|
|
if self.CP.openpilotLongitudinalControl: |
|
|
|
if self.CP.openpilotLongitudinalControl: |
|
|
|
if hda2: |
|
|
|
if hda2: |
|
|
|
can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.frame)) |
|
|
|
can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.frame)) |
|
|
|