Switch personalities via steering wheel / onroad UI
Added toggle to switch between the personalities via the steering wheel for GM/Toyota/Volkswagen vehicles and an onroad button for other makes. Co-Authored-By: henryccy <104284652+henryccy@users.noreply.github.com> Co-Authored-By: Jason Jackrel <23621790+thinkpad4by3@users.noreply.github.com> Co-Authored-By: Eric Brown <13560103+nworb-cire@users.noreply.github.com> Co-Authored-By: Kevin Robert Keegan <3046315+krkeegan@users.noreply.github.com> Co-Authored-By: Jacob Pfeifer <jacob@pfeifer.dev> Co-Authored-By: mike8643 <98910897+mike8643@users.noreply.github.com>
This commit is contained in:
@@ -167,6 +167,22 @@ class CarState(CarStateBase):
|
||||
if self.prev_main_buttons == 0 and self.main_buttons[-1] != 0:
|
||||
self.main_enabled = not self.main_enabled
|
||||
|
||||
# Driving personalities function
|
||||
if self.personalities_via_wheel and ret.cruiseState.available:
|
||||
# Sync with the onroad UI button
|
||||
if self.param_memory.get_bool("PersonalityChangedViaUI"):
|
||||
self.personality_profile = self.param.get_int("LongitudinalPersonality")
|
||||
self.param_memory.put_bool("PersonalityChangedViaUI", False)
|
||||
|
||||
# Change personality upon steering wheel button press
|
||||
if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0:
|
||||
self.param_memory.put_bool("PersonalityChangedViaWheel", True)
|
||||
self.personality_profile = (self.previous_personality_profile + 2) % 3
|
||||
|
||||
if self.personality_profile != self.previous_personality_profile and self.personality_profile >= 0:
|
||||
self.param.put_int("LongitudinalPersonality", self.personality_profile)
|
||||
self.previous_personality_profile = self.personality_profile
|
||||
|
||||
# Toggle Experimental Mode from steering wheel function
|
||||
if self.experimental_mode_via_press and ret.cruiseState.available:
|
||||
lkas_pressed = cp.vl["BCM_PO_11"]["LFA_Pressed"]
|
||||
@@ -267,6 +283,22 @@ class CarState(CarStateBase):
|
||||
self.hda2_lfa_block_msg = copy.copy(cp_cam.vl["CAM_0x362"] if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING
|
||||
else cp_cam.vl["CAM_0x2a4"])
|
||||
|
||||
# Driving personalities function
|
||||
if self.personalities_via_wheel and ret.cruiseState.available:
|
||||
# Sync with the onroad UI button
|
||||
if self.param_memory.get_bool("PersonalityChangedViaUI"):
|
||||
self.personality_profile = self.param.get_int("LongitudinalPersonality")
|
||||
self.param_memory.put_bool("PersonalityChangedViaUI", False)
|
||||
|
||||
# Change personality upon steering wheel button press
|
||||
if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0:
|
||||
self.param_memory.put_bool("PersonalityChangedViaWheel", True)
|
||||
self.personality_profile = (self.previous_personality_profile + 2) % 3
|
||||
|
||||
if self.personality_profile != self.previous_personality_profile and self.personality_profile >= 0:
|
||||
self.param.put_int("LongitudinalPersonality", self.personality_profile)
|
||||
self.previous_personality_profile = self.personality_profile
|
||||
|
||||
# Toggle Experimental Mode from steering wheel function
|
||||
if self.experimental_mode_via_press and ret.cruiseState.available:
|
||||
lkas_pressed = cp.vl[self.cruise_btns_msg_canfd]["LKAS_BTN"]
|
||||
|
||||
Reference in New Issue
Block a user