@ -139,11 +139,10 @@ class Alert: 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					class  NoEntryAlert ( Alert ) :  
			
		
	
		
			
				
					  def  __init__ ( self ,  alert_text_2 ,  audible_alert = AudibleAlert . chimeError ,   
			
		
	
		
			
				
					               visual_alert = VisualAlert . none ) :   
			
		
	
		
			
				
					  def  __init__ ( self ,  alert_text_2 ,  visual_alert = VisualAlert . none ) :   
			
		
	
		
			
				
					    super ( ) . __init__ ( " openpilot Unavailable " ,  alert_text_2 ,  AlertStatus . normal ,   
			
		
	
		
			
				
					                     AlertSize . mid ,  Priority . LOW ,  visual_alert ,   
			
		
	
		
			
				
					                     audible_alert ,  3. )   
			
		
	
		
			
				
					                     AudibleAlert . refuse ,  3. )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					class  SoftDisableAlert ( Alert ) :  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -151,7 +150,7 @@ class SoftDisableAlert(Alert): 
			
		
	
		
			
				
					    super ( ) . __init__ ( " TAKE CONTROL IMMEDIATELY " ,  alert_text_2 ,   
			
		
	
		
			
				
					                     AlertStatus . userPrompt ,  AlertSize . full ,   
			
		
	
		
			
				
					                     Priority . MID ,  VisualAlert . steerRequired ,   
			
		
	
		
			
				
					                     AudibleAlert . chimeWarningRepeatInfinite ,  2. ) ,   
			
		
	
		
			
				
					                     AudibleAlert . warningSoft ,  2. ) ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					class  ImmediateDisableAlert ( Alert ) :  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -159,7 +158,7 @@ class ImmediateDisableAlert(Alert): 
			
		
	
		
			
				
					    super ( ) . __init__ ( " TAKE CONTROL IMMEDIATELY " ,  alert_text_2 ,   
			
		
	
		
			
				
					                     AlertStatus . critical ,  AlertSize . full ,   
			
		
	
		
			
				
					                     Priority . HIGHEST ,  VisualAlert . steerRequired ,   
			
		
	
		
			
				
					                     AudibleAlert . chimeWarningRepeatInfini te,  4. ) ,   
			
		
	
		
			
				
					                     AudibleAlert . warningImmedia te,  4. ) ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					class  EngagementAlert ( Alert ) :  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -201,7 +200,7 @@ def below_steer_speed_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: 
			
		
	
		
			
				
					    f " Steer Unavailable Below  { get_display_speed ( CP . minSteerSpeed ,  metric ) } " ,   
			
		
	
		
			
				
					    " " ,   
			
		
	
		
			
				
					    AlertStatus . userPrompt ,  AlertSize . small ,   
			
		
	
		
			
				
					    Priority . MID ,  VisualAlert . steerRequired ,  AudibleAlert . chimeP rompt,  0.4 )   
			
		
	
		
			
				
					    Priority . MID ,  VisualAlert . steerRequired ,  AudibleAlert . p rompt,  0.4 )   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					def  calibration_incomplete_alert ( CP :  car . CarParams ,  sm :  messaging . SubMaster ,  metric :  bool )  - >  Alert :  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -321,7 +320,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " BRAKE! " ,   
			
		
	
		
			
				
					      " Risk of Collision " ,   
			
		
	
		
			
				
					      AlertStatus . critical ,  AlertSize . full ,   
			
		
	
		
			
				
					      Priority . HIGHEST ,  VisualAlert . fcw ,  AudibleAlert . chimeWarningRepeatInfinite ,  2. ) ,   
			
		
	
		
			
				
					      Priority . HIGHEST ,  VisualAlert . fcw ,  AudibleAlert . warningSoft ,  2. ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . ldw :  {   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -329,7 +328,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " TAKE CONTROL " ,   
			
		
	
		
			
				
					      " Lane Departure Detected " ,   
			
		
	
		
			
				
					      AlertStatus . userPrompt ,  AlertSize . mid ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . ldw ,  AudibleAlert . chimeP rompt,  3. ) ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . ldw ,  AudibleAlert . p rompt,  3. ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  # ********** events only containing alerts that display while engaged **********   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -360,7 +359,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " Steering Temporarily Unavailable " ,   
			
		
	
		
			
				
					      " " ,   
			
		
	
		
			
				
					      AlertStatus . userPrompt ,  AlertSize . small ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . steerRequired ,  AudibleAlert . chimeP rompt,  1. ) ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . steerRequired ,  AudibleAlert . p rompt,  1. ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . preDriverDistracted :  {   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -376,7 +375,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " KEEP EYES ON ROAD " ,   
			
		
	
		
			
				
					      " Driver Distracted " ,   
			
		
	
		
			
				
					      AlertStatus . userPrompt ,  AlertSize . mid ,   
			
		
	
		
			
				
					      Priority . MID ,  VisualAlert . steerRequired ,  AudibleAlert . chimeWarning2RepeatInfinite ,  .1 ) ,   
			
		
	
		
			
				
					      Priority . MID ,  VisualAlert . steerRequired ,  AudibleAlert . prompt ,  .1 ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . driverDistracted :  {   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -384,7 +383,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " DISENGAGE IMMEDIATELY " ,   
			
		
	
		
			
				
					      " Driver Distracted " ,   
			
		
	
		
			
				
					      AlertStatus . critical ,  AlertSize . full ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . steerRequired ,  AudibleAlert . chimeWarningRepeatInfini te,  .1 ) ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . steerRequired ,  AudibleAlert . warningImmedia te,  .1 ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . preDriverUnresponsive :  {   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -400,7 +399,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " TOUCH STEERING WHEEL " ,   
			
		
	
		
			
				
					      " Driver Unresponsive " ,   
			
		
	
		
			
				
					      AlertStatus . userPrompt ,  AlertSize . mid ,   
			
		
	
		
			
				
					      Priority . MID ,  VisualAlert . steerRequired ,  AudibleAlert . chimeWarning2RepeatInfinite ,  .1 ) ,   
			
		
	
		
			
				
					      Priority . MID ,  VisualAlert . steerRequired ,  AudibleAlert . prompt ,  .1 ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . driverUnresponsive :  {   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -408,7 +407,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " DISENGAGE IMMEDIATELY " ,   
			
		
	
		
			
				
					      " Driver Unresponsive " ,   
			
		
	
		
			
				
					      AlertStatus . critical ,  AlertSize . full ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . steerRequired ,  AudibleAlert . chimeWarningRepeatInfini te,  .1 ) ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . steerRequired ,  AudibleAlert . warningImmedia te,  .1 ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . manualRestart :  {   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -452,7 +451,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " Car Detected in Blindspot " ,   
			
		
	
		
			
				
					      " " ,   
			
		
	
		
			
				
					      AlertStatus . userPrompt ,  AlertSize . small ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . none ,  AudibleAlert . chimeP rompt,  .1 ) ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . none ,  AudibleAlert . p rompt,  .1 ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . laneChange :  {   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -468,7 +467,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " TAKE CONTROL " ,   
			
		
	
		
			
				
					      " Turn Exceeds Steering Limit " ,   
			
		
	
		
			
				
					      AlertStatus . userPrompt ,  AlertSize . mid ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . steerRequired ,  AudibleAlert . chimeWarning2RepeatInfinite ,  1. ) ,   
			
		
	
		
			
				
					      Priority . LOW ,  VisualAlert . steerRequired ,  AudibleAlert . promptRepeat ,  1. ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  # Thrown when the fan is driven at >50% but is not rotating   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -496,44 +495,44 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					  # ********** events that affect controls state transitions **********   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . pcmEnable :  {   
			
		
	
		
			
				
					    ET . ENABLE :  EngagementAlert ( AudibleAlert . chim eE ngage) ,   
			
		
	
		
			
				
					    ET . ENABLE :  EngagementAlert ( AudibleAlert . engage ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . buttonEnable :  {   
			
		
	
		
			
				
					    ET . ENABLE :  EngagementAlert ( AudibleAlert . chim eE ngage) ,   
			
		
	
		
			
				
					    ET . ENABLE :  EngagementAlert ( AudibleAlert . engage ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . pcmDisable :  {   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . chimeD isengage) ,   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . d isengage) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . buttonCancel :  {   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . chimeD isengage) ,   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . d isengage) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . brakeHold :  {   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . chimeD isengage) ,   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . d isengage) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Brake Hold Active " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . parkBrake :  {   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . chimeD isengage) ,   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . d isengage) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Park Brake Engaged " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . pedalPressed :  {   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . chimeD isengage) ,   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . d isengage) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Pedal Pressed During Attempt " ,   
			
		
	
		
			
				
					                              visual_alert = VisualAlert . brakePressed ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . wrongCarMode :  {   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . chimeD isengage) ,   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . d isengage) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  wrong_car_mode_alert ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . wrongCruiseMode :  {   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . chimeD isengage) ,   
			
		
	
		
			
				
					    ET . USER_DISABLE :  EngagementAlert ( AudibleAlert . d isengage) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Enable Adaptive Cruise " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -627,14 +626,12 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					  # ten times the regular interval, or the average interval is more than 10% too high.   
			
		
	
		
			
				
					  EventName . commIssue :  {   
			
		
	
		
			
				
					    ET . SOFT_DISABLE :  SoftDisableAlert ( " Communication Issue between Processes " ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Communication Issue between Processes " ,   
			
		
	
		
			
				
					                              audible_alert = AudibleAlert . chimeDisengage ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Communication Issue between Processes " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  # Thrown when manager detects a service exited unexpectedly while driving   
			
		
	
		
			
				
					  EventName . processNotRunning :  {   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " System Malfunction: Reboot Your Device " ,   
			
		
	
		
			
				
					                              audible_alert = AudibleAlert . chimeDisengage ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " System Malfunction: Reboot Your Device " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . radarFault :  {   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -670,15 +667,13 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					  EventName . lowMemory :  {   
			
		
	
		
			
				
					    ET . SOFT_DISABLE :  SoftDisableAlert ( " Low Memory: Reboot Your Device " ) ,   
			
		
	
		
			
				
					    ET . PERMANENT :  NormalPermanentAlert ( " Low Memory " ,  " Reboot your Device " ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Low Memory: Reboot Your Device " ,   
			
		
	
		
			
				
					                              audible_alert = AudibleAlert . chimeDisengage ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Low Memory: Reboot Your Device " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . highCpuUsage :  {   
			
		
	
		
			
				
					    #ET.SOFT_DISABLE: SoftDisableAlert("System Malfunction: Reboot Your Device"),   
			
		
	
		
			
				
					    #ET.PERMANENT: NormalPermanentAlert("System Malfunction", "Reboot your Device"),   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " System Malfunction: Reboot Your Device " ,   
			
		
	
		
			
				
					                              audible_alert = AudibleAlert . chimeDisengage ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " System Malfunction: Reboot Your Device " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  EventName . accFaulted :  {   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -782,7 +777,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " openpilot Canceled " ,   
			
		
	
		
			
				
					      " No close lead car " ,   
			
		
	
		
			
				
					      AlertStatus . normal ,  AlertSize . mid ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . none ,  AudibleAlert . chimeD isengage,  3. ) ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . none ,  AudibleAlert . d isengage,  3. ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " No Close Lead Car " ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -791,7 +786,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " openpilot Canceled " ,   
			
		
	
		
			
				
					      " Speed too low " ,   
			
		
	
		
			
				
					      AlertStatus . normal ,  AlertSize . mid ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . none ,  AudibleAlert . chimeD isengage,  3. ) ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . none ,  AudibleAlert . d isengage,  3. ) ,   
			
		
	
		
			
				
					  } ,   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  # When the car is driving faster than most cars in the training data the model outputs can be unpredictable   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -800,7 +795,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo 
			
		
	
		
			
				
					      " Speed Too High " ,   
			
		
	
		
			
				
					      " Model uncertain at this speed " ,   
			
		
	
		
			
				
					      AlertStatus . userPrompt ,  AlertSize . mid ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . steerRequired ,  AudibleAlert . chimeWarning2RepeatInfinite ,  4. ) ,   
			
		
	
		
			
				
					      Priority . HIGH ,  VisualAlert . steerRequired ,  AudibleAlert . promptRepeat ,  4. ) ,   
			
		
	
		
			
				
					    ET . NO_ENTRY :  NoEntryAlert ( " Slow down to engage " ) ,   
			
		
	
		
			
				
					  } ,