This commit is contained in:
Your Name
2024-05-18 03:50:40 -05:00
parent d6a5bd4c56
commit 3cbaf1253a
2 changed files with 36 additions and 3 deletions

View File

@@ -134,8 +134,8 @@ class CarController(CarControllerBase):
params_memory = Params("/dev/shm/params") params_memory = Params("/dev/shm/params")
if params_memory.get_bool("CPTLkasButtonAction"): if params_memory.get_bool("CPTLkasButtonAction"):
# can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.CAN, self.frame)) # can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.CAN, self.frame))
can_sends.append(hyundaicanfd.create_acc_control(self.packer, self.CAN, CC.enabled, self.accel_last, accel, stopping, CC.cruiseControl.override, can_sends.append(hyundaicanfd.create_acc_set_speed(self.packer, self.CAN, CS.cruise_info, 50))
50, hud_control)) # can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
print("Debug cancel executed") print("Debug cancel executed")
if self.CP.openpilotLongitudinalControl: if self.CP.openpilotLongitudinalControl:
@@ -218,7 +218,8 @@ class CarController(CarControllerBase):
if CC.cruiseControl.cancel: if CC.cruiseControl.cancel:
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
# pass # pass
can_sends.append(hyundaicanfd.create_buttons_alt(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL)) can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
# can_sends.append(hyundaicanfd.create_buttons_alt(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL))
print("Yes2") print("Yes2")
self.last_button_frame = self.frame self.last_button_frame = self.frame
CS.lkas_trigger_result = 1 CS.lkas_trigger_result = 1

View File

@@ -99,6 +99,38 @@ def create_buttons_alt(packer, CP, CAN, cnt, btn):
bus = CAN.ECAN # if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM bus = CAN.ECAN # if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM
return packer.make_can_msg("CRUISE_BUTTONS_ALT", bus, values) return packer.make_can_msg("CRUISE_BUTTONS_ALT", bus, values)
def create_acc_set_speed(packer, CP, CAN, cruise_info_copy, speed):
# why are we executing this at all?
# TODO: why do we copy different values here?
if CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value:
values = {s: cruise_info_copy[s] for s in [
"COUNTER",
"CHECKSUM",
"NEW_SIGNAL_1",
"MainMode_ACC",
"ACCMode",
"ZEROS_9",
"CRUISE_STANDSTILL",
"ZEROS_5",
"DISTANCE_SETTING",
"VSetDis",
]}
else:
values = {s: cruise_info_copy[s] for s in [
"COUNTER",
"CHECKSUM",
"ACCMode",
"VSetDis",
"CRUISE_STANDSTILL",
]}
values.update({
"ACCMode": 1, # testing 1 instead of 4
"VSetDis", speed
})
return packer.make_can_msg("SCC_CONTROL", CAN.ECAN, values)
def create_acc_cancel(packer, CP, CAN, cruise_info_copy): def create_acc_cancel(packer, CP, CAN, cruise_info_copy):
# why are we executing this at all? # why are we executing this at all?
# TODO: why do we copy different values here? # TODO: why do we copy different values here?