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:
@@ -94,7 +94,7 @@ def process_hud_alert(hud_alert):
|
||||
|
||||
|
||||
HUDData = namedtuple("HUDData",
|
||||
["pcm_accel", "v_cruise", "lead_visible",
|
||||
["pcm_accel", "v_cruise", "lead_visible", "distance_lines",
|
||||
"lanes_visible", "fcw", "acc_alert", "steer_required"])
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ class CarController:
|
||||
|
||||
# Send dashboard UI commands.
|
||||
if self.frame % 10 == 0:
|
||||
hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_control.leadVisible,
|
||||
hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_control.leadVisible, CS.personality_profile + 1,
|
||||
hud_control.lanesVisible, fcw_display, acc_alert, steer_required)
|
||||
can_sends.extend(hondacan.create_ui_commands(self.packer, self.CP, CC.enabled, pcm_speed, hud, CS.is_metric, CS.acc_hud, CS.lkas_hud))
|
||||
|
||||
|
||||
@@ -268,6 +268,25 @@ class CarState(CarStateBase):
|
||||
ret.leftBlindspot = cp_body.vl["BSM_STATUS_LEFT"]["BSM_ALERT"] == 1
|
||||
ret.rightBlindspot = cp_body.vl["BSM_STATUS_RIGHT"]["BSM_ALERT"] == 1
|
||||
|
||||
# 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
|
||||
self.distance_button = self.cruise_setting == 3
|
||||
|
||||
if self.distance_button and not self.distance_previously_pressed:
|
||||
self.param_memory.put_bool("PersonalityChangedViaWheel", True)
|
||||
self.personality_profile = (self.previous_personality_profile + 2) % 3
|
||||
self.distance_previously_pressed = self.distance_button
|
||||
|
||||
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 = self.cruise_setting == 1
|
||||
|
||||
@@ -132,7 +132,7 @@ def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, acc_hud,
|
||||
acc_hud_values = {
|
||||
'CRUISE_SPEED': hud.v_cruise,
|
||||
'ENABLE_MINI_CAR': 1 if enabled else 0,
|
||||
'HUD_DISTANCE': 0, # max distance setting on display
|
||||
'HUD_DISTANCE': hud.distance_lines,
|
||||
'IMPERIAL_UNIT': int(not is_metric),
|
||||
'HUD_LEAD': 2 if enabled and hud.lead_visible else 1 if enabled else 0,
|
||||
'SET_ME_X01_2': 1,
|
||||
|
||||
Reference in New Issue
Block a user