| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -19,6 +19,7 @@ CAR_CHARGING_RATE_W = 45 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					VBATT_PAUSE_CHARGING = 11.0           # Lower limit on the LPF car battery voltage | 
					 | 
					 | 
					 | 
					VBATT_PAUSE_CHARGING = 11.0           # Lower limit on the LPF car battery voltage | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					VBATT_INSTANT_PAUSE_CHARGING = 7.0    # Lower limit on the instant car battery voltage measurements to avoid triggering on instant power loss | 
					 | 
					 | 
					 | 
					VBATT_INSTANT_PAUSE_CHARGING = 7.0    # Lower limit on the instant car battery voltage measurements to avoid triggering on instant power loss | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					MAX_TIME_OFFROAD_S = 30*3600 | 
					 | 
					 | 
					 | 
					MAX_TIME_OFFROAD_S = 30*3600 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					MIN_ON_TIME_S = 3600 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					class PowerMonitoring: | 
					 | 
					 | 
					 | 
					class PowerMonitoring: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def __init__(self): | 
					 | 
					 | 
					 | 
					  def __init__(self): | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -184,5 +185,5 @@ class PowerMonitoring: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    # Wait until we have shut down charging before powering down | 
					 | 
					 | 
					 | 
					    # Wait until we have shut down charging before powering down | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    should_shutdown |= (not panda_charging and self.should_disable_charging(pandaState, offroad_timestamp)) | 
					 | 
					 | 
					 | 
					    should_shutdown |= (not panda_charging and self.should_disable_charging(pandaState, offroad_timestamp)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    should_shutdown |= ((HARDWARE.get_battery_capacity() < BATT_PERC_OFF) and (not HARDWARE.get_battery_charging()) and ((now - offroad_timestamp) > 60)) | 
					 | 
					 | 
					 | 
					    should_shutdown |= ((HARDWARE.get_battery_capacity() < BATT_PERC_OFF) and (not HARDWARE.get_battery_charging()) and ((now - offroad_timestamp) > 60)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    should_shutdown &= started_seen | 
					 | 
					 | 
					 | 
					    should_shutdown &= started_seen or (now > MIN_ON_TIME_S) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return should_shutdown | 
					 | 
					 | 
					 | 
					    return should_shutdown | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |