From da6553c24dd0b33e2e7722b10da8dcfd63260ee6 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 9 Feb 2024 17:24:49 -0600 Subject: [PATCH] wip --- notes | 11 ++++++++++- selfdrive/car/hyundai/carcontroller.py | 15 +++++++++------ selfdrive/car/hyundai/carstate.py | 15 +++++++++------ selfdrive/car/hyundai/hyundaicanfd.py | 2 +- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/notes b/notes index 4e6faaf..06e8eb1 100644 --- a/notes +++ b/notes @@ -23,4 +23,13 @@ ret.cruiseState.standstill cp_scc.vl["SCC11"]["SCCInfoDisplay"] == 4. Interesting can messages SG_ C_SunRoofOpenState - CR_Datc_DrTempDispF \ No newline at end of file + CR_Datc_DrTempDispF + + 2-9 test notes + +- Only the icon with the lane lines is showing after recent lkas mods - can we show amber? +- pressing lkas distance does in fact cancel cruise, if only for a second. that means that it response to the cancel button - and possibly resume too? +- test: set cluster speed directly +- test: simulate down button on wheel +- we should put a splash screen of the pacman ghost over the main startup display, and only reveal the interface when we tap on it +- Fix: read speed limit from car computer, flicker LKAS button when it is out of range \ No newline at end of file diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 619bfab..c60c64f 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -197,9 +197,9 @@ class CarController: # else: # can_sends.extend([hyundaican.create_clu11(self.packer, (self.frame // 2) + 1, CS.clu11, self.cruise_button, self.CP.carFingerprint)] * 25) - # Test - if CS.cruise_buttons == Buttons.NONE and CS.cruiseState.enabled: - can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, ((self.frame // 2) + 1) % 0x10, Buttons.SET_DECEL)) + # Test - Works??? + # if CS.cruise_buttons == Buttons.NONE and CS.cruiseState.enabled: + # can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, ((self.frame // 2) + 1) % 0x10, Buttons.SET_DECEL)) new_actuators = actuators.copy() new_actuators.steer = apply_steer / self.params.STEER_MAX @@ -237,10 +237,13 @@ class CarController: if CS.oscar_lane_center_btn_pressed: CS.oscar_lane_center_btn_pressed = False # CC.cruiseControl.resume = True - CC.cruiseControl.cancel = True + # CC.cruiseControl.cancel = True # Test this... - # ?? can_sends.append(hyundaicanfd.create_acc_control(self.packer, self.CAN, CC.enabled, self.accel_last, accel, stopping, CC.cruiseControl.override, - # set_speed_in_units, CS.personality_profile)) + # Also try create_acc_commands + # This attempts to set the speed to + stopping = CC.actuators.longControlState == LongCtrlState.stopping + can_sends.append(hyundaicanfd.create_acc_control(self.packer, self.CAN, CC.enabled, self.accel_last, CC.actuators.accel, stopping, CC.cruiseControl.override, + 40, CS.personality_profile)) # cruise cancel if CC.cruiseControl.cancel: diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 47243a1..377ab64 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -309,15 +309,18 @@ class CarState(CarStateBase): if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0: self.oscar_lane_center_btn_pressed = True + lkas_pressed = False + try: + lkas_pressed = cp.vl[self.cruise_btns_msg_canfd]["LKAS_BTN"] + except: + nothing = 0 + + # intentionally cause a failure + if lkas_pressed: + floog=norpdywoop # if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0: # self.oscar_lane_center_btn_pressed= True - # lkas_pressed = cp.vl_all[self.cruise_btns_msg_canfd]["LKAS_BTN"] - # if lkas_pressed and not self.lkas_previously_pressed: - # self.custom_speed_up = True - # self.lkas_previously_pressed = lkas_pressed - - # Driving personalities function # if self.personalities_via_wheel and ret.cruiseState.available: # # Sync with the onroad UI button diff --git a/selfdrive/car/hyundai/hyundaicanfd.py b/selfdrive/car/hyundai/hyundaicanfd.py index 674ed22..bbfc030 100644 --- a/selfdrive/car/hyundai/hyundaicanfd.py +++ b/selfdrive/car/hyundai/hyundaicanfd.py @@ -116,7 +116,7 @@ def create_acc_cancel(packer, CP, CAN, cruise_info_copy): def create_lfahda_cluster(packer, CAN, enabled): values = { "HDA_ICON": 1 if enabled else 0, - "LFA_ICON": 0 if enabled else 0, + "LFA_ICON": 3 if enabled else 0, # was green before i think in 2? 3 should be flashing? # "LFA_ICON": 2 if enabled else 0, } return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values)