Skip to content

Commit

Permalink
VW PQ: OEM+ ACC bugfix ACC_System on falling edge of EPB_enable
Browse files Browse the repository at this point in the history
* welcome; EPB_enabled. because variables should be well thought out and never confusingly named! seriously if you come up with a better name let me know..
  • Loading branch information
dkiiv committed Dec 5, 2024
1 parent 262f36f commit 6398a8d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion selfdrive/car/volkswagen/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(self, dbc_name, CP, VM):
self.EPB_brake = 0
self.EPB_brake_last = 0
self.EPB_enable = 0
self.EPB_enable_last = 0
self.EPB_counter = 0
self.accel_diff = 0
self.long_deviation = 0
Expand Down Expand Up @@ -273,8 +274,9 @@ def update(self, CC, CS, now_nanos):
stopped = CS.out.vEgoRaw == 0 and self.EPB_enable

if CS.acc_sys_stock["COUNTER"] != self.acc_sys_counter_last:
can_sends.append(self.CCS.filter_ACC_System(self.packer_pt, CANBUS.pt, CS.acc_sys_stock, self.EPB_enable))
EPB_handler(self, CS.acc_sys_stock["ACS_Sta_ADR"], CS.acc_sys_stock["ACS_Sollbeschl"], CS.out.vEgoRaw, stopped)
EPB_enabled = int(self.EPB_enable_last and not self.EPB_enable or self.EPB_enable)
can_sends.append(self.CCS.filter_ACC_System(self.packer_pt, CANBUS.pt, CS.acc_sys_stock, EPB_enabled))
can_sends.append(self.CCS.create_epb_control(self.packer_pt, CANBUS.br, self.EPB_brake, self.EPB_enable))
can_sends.append(self.CCS.filter_epb1(self.packer_pt, CANBUS.cam, stopped)) # in custom module, filter the gateway fwd EPB msg
if self.motor2_frame % 2 or CS.motor2_stock != getattr(self, 'motor2_last', CS.motor2_stock): # 50hz / 20ms
Expand All @@ -286,6 +288,7 @@ def update(self, CC, CS, now_nanos):

self.motor2_last = CS.motor2_stock
self.motor2_frame += 1
self.EPB_enable_last = self.EPB_enable
self.acc_sys_counter_last = CS.acc_sys_stock["COUNTER"]
self.bremse8_counter_last = CS.bremse8_stock["COUNTER"]
self.bremse11_counter_last = CS.bremse11_stock["COUNTER"]
Expand Down

0 comments on commit 6398a8d

Please sign in to comment.