@ -12,7 +12,6 @@ class CarController:
self . frame = 0
self . frame = 0
self . cruise_button_prev = 0
self . cruise_button_prev = 0
self . last_cancel_frame = 0
self . p = CarControllerParams ( CP )
self . p = CarControllerParams ( CP )
self . packer = CANPacker ( DBC [ CP . carFingerprint ] [ ' pt ' ] )
self . packer = CANPacker ( DBC [ CP . carFingerprint ] [ ' pt ' ] )
@ -100,10 +99,9 @@ class CarController:
can_sends . append ( subarucan . create_es_distance ( self . packer , CS . es_distance_msg , 0 , pcm_cancel_cmd ,
can_sends . append ( subarucan . create_es_distance ( self . packer , CS . es_distance_msg , 0 , pcm_cancel_cmd ,
self . CP . openpilotLongitudinalControl , cruise_brake > 0 , cruise_throttle ) )
self . CP . openpilotLongitudinalControl , cruise_brake > 0 , cruise_throttle ) )
else :
else :
if pcm_cancel_cmd and ( self . frame - self . last_cancel_frame ) > 0.2 :
if pcm_cancel_cmd :
bus = CanBus . alt if self . CP . carFingerprint in GLOBAL_GEN2 else CanBus . main
bus = CanBus . alt if self . CP . carFingerprint in GLOBAL_GEN2 else CanBus . main
can_sends . append ( subarucan . create_es_distance ( self . packer , CS . es_distance_msg , bus , pcm_cancel_cmd ) )
can_sends . append ( subarucan . create_es_distance ( self . packer , CS . es_distance_msg , bus , pcm_cancel_cmd ) )
self . last_cancel_frame = self . frame
new_actuators = actuators . copy ( )
new_actuators = actuators . copy ( )
new_actuators . steer = self . apply_steer_last / self . p . STEER_MAX
new_actuators . steer = self . apply_steer_last / self . p . STEER_MAX