@ -37,6 +37,7 @@ class CarController(CarControllerBase): 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    self . last_standstill  =  False   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    self . standstill_req  =  False   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    self . steer_rate_counter  =  0   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    self . distance_button  =  0   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    self . packer  =  CANPacker ( dbc_name )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    self . gas  =  0   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -139,14 +140,23 @@ class CarController(CarControllerBase): 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    if  ( self . frame  %  3  ==  0  and  self . CP . openpilotLongitudinalControl )  or  pcm_cancel_cmd :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      lead  =  hud_control . leadVisible  or  CS . out . vEgo  <  12.   # at low speed we always assume the lead is present so ACC can be engaged   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      # Press distance button until we are at the correct bar length. Only change while enabled to avoid skipping startup popup   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      if  self . frame  %  6  ==  0 :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  CS . pcm_follow_distance_values . get ( CS . pcm_follow_distance ,  " UNKNOWN " )  !=  " FAR "  and  CS . out . cruiseState . enabled  and  \  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					          self . CP . carFingerprint  not  in  UNSUPPORTED_DSU_CAR :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					          self . distance_button  =  not  self . distance_button   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        else :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					          self . distance_button  =  0   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      # Lexus IS uses a different cancellation message   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      if  pcm_cancel_cmd  and  self . CP . carFingerprint  in  UNSUPPORTED_DSU_CAR :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        can_sends . append ( toyotacan . create_acc_cancel_command ( self . packer ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      elif  self . CP . openpilotLongitudinalControl :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        can_sends . append ( toyotacan . create_accel_command ( self . packer ,  pcm_accel_cmd ,  pcm_cancel_cmd ,  self . standstill_req ,  lead ,  CS . acc_type ,  fcw_alert ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        can_sends . append ( toyotacan . create_accel_command ( self . packer ,  pcm_accel_cmd ,  pcm_cancel_cmd ,  self . standstill_req ,  lead ,  CS . acc_type ,  fcw_alert ,   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                                        self . distance_button ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        self . accel  =  pcm_accel_cmd   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      else :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        can_sends . append ( toyotacan . create_accel_command ( self . packer ,  0 ,  pcm_cancel_cmd ,  False ,  lead ,  CS . acc_type ,  False ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        can_sends . append ( toyotacan . create_accel_command ( self . packer ,  0 ,  pcm_cancel_cmd ,  False ,  lead ,  CS . acc_type ,  False ,  self . distance_button ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    if  self . frame  %  2  ==  0  and  self . CP . enableGasInterceptor  and  self . CP . openpilotLongitudinalControl :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					      # send exactly zero if gas cmd is zero. Interceptor will send the max between read value and gas cmd.