Switch personalities via steering wheel / onroad UI
Added toggle to switch between the personalities via the steering wheel or an onroad UI button. 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:
@@ -104,7 +104,7 @@ class CarController:
|
||||
# FIXME: follow the recent displayed-speed updates, also use mph_kmh toggle to fix display rounding problem?
|
||||
set_speed = hud_control.setSpeed * CV.MS_TO_KPH
|
||||
can_sends.append(self.CCS.create_acc_hud_control(self.packer_pt, CANBUS.pt, acc_hud_status, set_speed,
|
||||
lead_distance))
|
||||
lead_distance, CS.personality_profile))
|
||||
|
||||
# **** Stock ACC Button Controls **************************************** #
|
||||
|
||||
|
||||
@@ -151,6 +151,25 @@ class CarState(CarStateBase):
|
||||
# Digital instrument clusters expect the ACC HUD lead car distance to be scaled differently
|
||||
self.upscale_lead_car_signal = bool(pt_cp.vl["Kombi_03"]["KBI_Variante"])
|
||||
|
||||
# Driving personalities function
|
||||
if frogpilot_variables.personalities_via_wheel and ret.cruiseState.available:
|
||||
# Sync with the onroad UI button
|
||||
if self.fpf.personality_changed_via_ui:
|
||||
self.personality_profile = self.fpf.current_personality
|
||||
self.previous_personality_profile = self.personality_profile
|
||||
self.fpf.reset_personality_changed_param()
|
||||
|
||||
# Change personality upon steering wheel button press
|
||||
distance_button = pt_cp.vl["GRA_ACC_01"]["GRA_Verstellung_Zeitluecke"]
|
||||
|
||||
if distance_button and not self.distance_previously_pressed:
|
||||
self.personality_profile = (self.previous_personality_profile + 2) % 3
|
||||
self.distance_previously_pressed = distance_button
|
||||
|
||||
if self.personality_profile != self.previous_personality_profile:
|
||||
self.fpf.distance_button_function(self.personality_profile)
|
||||
self.previous_personality_profile = self.personality_profile
|
||||
|
||||
return ret
|
||||
|
||||
def update_pq(self, pt_cp, cam_cp, ext_cp, trans_type, frogpilot_variables):
|
||||
|
||||
@@ -125,11 +125,11 @@ def create_acc_accel_control(packer, bus, acc_type, acc_enabled, accel, acc_cont
|
||||
return commands
|
||||
|
||||
|
||||
def create_acc_hud_control(packer, bus, acc_hud_status, set_speed, lead_distance):
|
||||
def create_acc_hud_control(packer, bus, acc_hud_status, set_speed, lead_distance, personality_profile):
|
||||
values = {
|
||||
"ACC_Status_Anzeige": acc_hud_status,
|
||||
"ACC_Wunschgeschw_02": set_speed if set_speed < 250 else 327.36,
|
||||
"ACC_Gesetzte_Zeitluecke": 3,
|
||||
"ACC_Gesetzte_Zeitluecke": 1 if personality_profile == 0 else 3 if personality_profile == 1 else 5,
|
||||
"ACC_Display_Prio": 3,
|
||||
"ACC_Abstandsindex": lead_distance,
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ def create_acc_accel_control(packer, bus, acc_type, acc_enabled, accel, acc_cont
|
||||
return commands
|
||||
|
||||
|
||||
def create_acc_hud_control(packer, bus, acc_hud_status, set_speed, lead_distance):
|
||||
def create_acc_hud_control(packer, bus, acc_hud_status, set_speed, lead_distance, personality_profile):
|
||||
values = {
|
||||
"ACA_StaACC": acc_hud_status,
|
||||
"ACA_Zeitluecke": 2,
|
||||
|
||||
Reference in New Issue
Block a user