mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-08-05 08:16:03 +08:00
VW: Increase stock ACC button spam reliability (#25692)
* VW MQB: Fix/simplify stock ACC button spam * try this instead old-commit-hash: 21972605e7ed0f713d89324777afc2c60f862e6c
This commit is contained in:
@@ -17,6 +17,7 @@ class CarController:
|
||||
self.packer_pt = CANPacker(dbc_name)
|
||||
|
||||
self.apply_steer_last = 0
|
||||
self.gra_acc_counter_last = None
|
||||
self.frame = 0
|
||||
self.hcaSameTorqueCount = 0
|
||||
self.hcaEnabledFrameCount = 0
|
||||
@@ -91,15 +92,15 @@ class CarController:
|
||||
|
||||
# **** Stock ACC Button Controls **************************************** #
|
||||
|
||||
if self.CP.pcmCruise and self.frame % self.CCP.GRA_ACC_STEP == 0:
|
||||
idx = (CS.gra_stock_values["COUNTER"] + 1) % 16
|
||||
if CC.cruiseControl.cancel:
|
||||
can_sends.append(self.CCS.create_acc_buttons_control(self.packer_pt, ext_bus, CS.gra_stock_values, idx, cancel=True))
|
||||
elif CC.cruiseControl.resume:
|
||||
can_sends.append(self.CCS.create_acc_buttons_control(self.packer_pt, ext_bus, CS.gra_stock_values, idx, resume=True))
|
||||
gra_send_ready = self.CP.pcmCruise and CS.gra_stock_values["COUNTER"] != self.gra_acc_counter_last
|
||||
if gra_send_ready and (CC.cruiseControl.cancel or CC.cruiseControl.resume):
|
||||
counter = (CS.gra_stock_values["COUNTER"] + 1) % 16
|
||||
can_sends.append(self.CCS.create_acc_buttons_control(self.packer_pt, ext_bus, CS.gra_stock_values, counter,
|
||||
cancel=CC.cruiseControl.cancel, resume=CC.cruiseControl.resume))
|
||||
|
||||
new_actuators = actuators.copy()
|
||||
new_actuators.steer = self.apply_steer_last / self.CCP.STEER_MAX
|
||||
|
||||
self.gra_acc_counter_last = CS.gra_stock_values["COUNTER"]
|
||||
self.frame += 1
|
||||
return new_actuators, can_sends
|
||||
|
||||
@@ -26,11 +26,11 @@ def create_lka_hud_control(packer, bus, ldw_stock_values, enabled, steering_pres
|
||||
return packer.make_can_msg("LDW_02", bus, values)
|
||||
|
||||
|
||||
def create_acc_buttons_control(packer, bus, gra_stock_values, idx, cancel=False, resume=False):
|
||||
def create_acc_buttons_control(packer, bus, gra_stock_values, counter, cancel=False, resume=False):
|
||||
values = gra_stock_values.copy()
|
||||
|
||||
values.update({
|
||||
"COUNTER": idx,
|
||||
"COUNTER": counter,
|
||||
"GRA_Abbrechen": cancel,
|
||||
"GRA_Tip_Wiederaufnahme": resume,
|
||||
})
|
||||
|
||||
@@ -23,11 +23,11 @@ def create_lka_hud_control(packer, bus, ldw_stock_values, enabled, steering_pres
|
||||
return packer.make_can_msg("LDW_Status", bus, values)
|
||||
|
||||
|
||||
def create_acc_buttons_control(packer, bus, gra_stock_values, idx, cancel=False, resume=False):
|
||||
def create_acc_buttons_control(packer, bus, gra_stock_values, counter, cancel=False, resume=False):
|
||||
values = gra_stock_values.copy()
|
||||
|
||||
values.update({
|
||||
"COUNTER": idx,
|
||||
"COUNTER": counter,
|
||||
"GRA_Abbrechen": cancel,
|
||||
"GRA_Recall": resume,
|
||||
})
|
||||
|
||||
@@ -19,7 +19,6 @@ Button = namedtuple('Button', ['event_type', 'can_addr', 'can_msg', 'values'])
|
||||
|
||||
class CarControllerParams:
|
||||
HCA_STEP = 2 # HCA_01/HCA_1 message frequency 50Hz
|
||||
GRA_ACC_STEP = 3 # GRA_ACC_01/GRA_Neu message frequency 33Hz
|
||||
ACC_CONTROL_STEP = 2 # ACC_06/ACC_07/ACC_System frequency 50Hz
|
||||
ACC_HUD_STEP = 4 # ACC_GRA_Anziege frequency 25Hz
|
||||
|
||||
|
||||
Reference in New Issue
Block a user