@ -34,6 +34,7 @@ CURRENT_TAU = 15.   # 15s time constant 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					TEMP_TAU  =  5.    # 5s time constant  
					 
					 
					 
					TEMP_TAU  =  5.    # 5s time constant  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					DISCONNECT_TIMEOUT  =  5.   # wait 5 seconds before going offroad after disconnect so you get an alert  
					 
					 
					 
					DISCONNECT_TIMEOUT  =  5.   # wait 5 seconds before going offroad after disconnect so you get an alert  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					PANDA_STATES_TIMEOUT  =  round ( 1000  /  SERVICE_LIST [ ' pandaStates ' ] . frequency  *  1.5 )   # 1.5x the expected pandaState frequency  
					 
					 
					 
					PANDA_STATES_TIMEOUT  =  round ( 1000  /  SERVICE_LIST [ ' pandaStates ' ] . frequency  *  1.5 )   # 1.5x the expected pandaState frequency  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					ONROAD_CYCLE_TIME  =  1   # seconds to wait offroad after requesting an onroad cycle  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					ThermalBand  =  namedtuple ( " ThermalBand " ,  [ ' min_temp ' ,  ' max_temp ' ] )  
					 
					 
					 
					ThermalBand  =  namedtuple ( " ThermalBand " ,  [ ' min_temp ' ,  ' max_temp ' ] )  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					HardwareState  =  namedtuple ( " HardwareState " ,  [ ' network_type ' ,  ' network_info ' ,  ' network_strength ' ,  ' network_stats ' ,  
					 
					 
					 
					HardwareState  =  namedtuple ( " HardwareState " ,  [ ' network_type ' ,  ' network_info ' ,  ' network_strength ' ,  ' network_stats ' ,  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -196,6 +197,7 @@ def hardware_thread(end_event, hw_queue) -> None: 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  should_start_prev  =  False   
					 
					 
					 
					  should_start_prev  =  False   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  in_car  =  False   
					 
					 
					 
					  in_car  =  False   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  engaged_prev  =  False   
					 
					 
					 
					  engaged_prev  =  False   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  offroad_cycle_count  =  0   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  params  =  Params ( )   
					 
					 
					 
					  params  =  Params ( )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  power_monitor  =  PowerMonitoring ( )   
					 
					 
					 
					  power_monitor  =  PowerMonitoring ( )   
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -213,7 +215,10 @@ def hardware_thread(end_event, hw_queue) -> None: 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    peripheral_panda_present  =  peripheralState . pandaType  !=  log . PandaState . PandaType . unknown   
					 
					 
					 
					    peripheral_panda_present  =  peripheralState . pandaType  !=  log . PandaState . PandaType . unknown   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    # handle requests to cycle system started state   
					 
					 
					 
					    # handle requests to cycle system started state   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    onroad_conditions [ " not_onroad_cycle " ]  =  not  params . get_bool ( " OnroadCycleRequested " )   
					 
					 
					 
					    if  params . get_bool ( " OnroadCycleRequested " ) :   
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      params . put_bool ( " OnroadCycleRequested " ,  False )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      offroad_cycle_count  =  sm . frame   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    onroad_conditions [ " not_onroad_cycle " ]  =  ( sm . frame  -  offroad_cycle_count )  > =  ONROAD_CYCLE_TIME  *  SERVICE_LIST [ ' pandaStates ' ] . frequency   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    if  sm . updated [ ' pandaStates ' ]  and  len ( pandaStates )  >  0 :   
					 
					 
					 
					    if  sm . updated [ ' pandaStates ' ]  and  len ( pandaStates )  >  0 :