@ -40,6 +40,7 @@ struct Alert { 
			
		
	
		
		
			
				
					
					  QString  text2 ;    QString  text2 ;   
			
		
	
		
		
			
				
					
					  QString  type ;    QString  type ;   
			
		
	
		
		
			
				
					
					  cereal : : ControlsState : : AlertSize  size ;    cereal : : ControlsState : : AlertSize  size ;   
			
		
	
		
		
			
				
					
					  cereal : : ControlsState : : AlertStatus  status ;   
			
		
	
		
		
			
				
					
					  AudibleAlert  sound ;    AudibleAlert  sound ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					  bool  equal ( const  Alert  & a2 )  {    bool  equal ( const  Alert  & a2 )  {   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -51,6 +52,7 @@ struct Alert { 
			
		
	
		
		
			
				
					
					    if  ( sm . updated ( " controlsState " ) )  {      if  ( sm . updated ( " controlsState " ) )  {   
			
		
	
		
		
			
				
					
					      return  { cs . getAlertText1 ( ) . cStr ( ) ,  cs . getAlertText2 ( ) . cStr ( ) ,        return  { cs . getAlertText1 ( ) . cStr ( ) ,  cs . getAlertText2 ( ) . cStr ( ) ,   
			
		
	
		
		
			
				
					
					              cs . getAlertType ( ) . cStr ( ) ,  cs . getAlertSize ( ) ,                cs . getAlertType ( ) . cStr ( ) ,  cs . getAlertSize ( ) ,   
			
		
	
		
		
			
				
					
					              cs . getAlertStatus ( ) ,   
			
		
	
		
		
			
				
					
					              cs . getAlertSound ( ) } ;                cs . getAlertSound ( ) } ;   
			
		
	
		
		
			
				
					
					    }  else  if  ( ( sm . frame  -  started_frame )  >  5  *  UI_FREQ )  {      }  else  if  ( ( sm . frame  -  started_frame )  >  5  *  UI_FREQ )  {   
			
		
	
		
		
			
				
					
					      const  int  CONTROLS_TIMEOUT  =  5 ;        const  int  CONTROLS_TIMEOUT  =  5 ;   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -61,16 +63,19 @@ struct Alert { 
			
		
	
		
		
			
				
					
					        // car is started, but controlsState hasn't been seen at all
          // car is started, but controlsState hasn't been seen at all
   
			
		
	
		
		
			
				
					
					        return  { " openpilot Unavailable " ,  " Waiting for controls to start " ,          return  { " openpilot Unavailable " ,  " Waiting for controls to start " ,   
			
		
	
		
		
			
				
					
					                " controlsWaiting " ,  cereal : : ControlsState : : AlertSize : : MID ,                  " controlsWaiting " ,  cereal : : ControlsState : : AlertSize : : MID ,   
			
		
	
		
		
			
				
					
					                cereal : : ControlsState : : AlertStatus : : NORMAL ,   
			
		
	
		
		
			
				
					
					                AudibleAlert : : NONE } ;                  AudibleAlert : : NONE } ;   
			
		
	
		
		
			
				
					
					      }  else  if  ( controls_missing  >  CONTROLS_TIMEOUT  & &  ! Hardware : : PC ( ) )  {        }  else  if  ( controls_missing  >  CONTROLS_TIMEOUT  & &  ! Hardware : : PC ( ) )  {   
			
		
	
		
		
			
				
					
					        // car is started, but controls is lagging or died
          // car is started, but controls is lagging or died
   
			
		
	
		
		
			
				
					
					        if  ( cs . getEnabled ( )  & &  ( controls_missing  -  CONTROLS_TIMEOUT )  <  10 )  {          if  ( cs . getEnabled ( )  & &  ( controls_missing  -  CONTROLS_TIMEOUT )  <  10 )  {   
			
		
	
		
		
			
				
					
					          return  { " TAKE CONTROL IMMEDIATELY " ,  " Controls Unresponsive " ,            return  { " TAKE CONTROL IMMEDIATELY " ,  " Controls Unresponsive " ,   
			
		
	
		
		
			
				
					
					                  " controlsUnresponsive " ,  cereal : : ControlsState : : AlertSize : : FULL ,                    " controlsUnresponsive " ,  cereal : : ControlsState : : AlertSize : : FULL ,   
			
		
	
		
		
			
				
					
					                  cereal : : ControlsState : : AlertStatus : : CRITICAL ,   
			
		
	
		
		
			
				
					
					                  AudibleAlert : : WARNING_IMMEDIATE } ;                    AudibleAlert : : WARNING_IMMEDIATE } ;   
			
		
	
		
		
			
				
					
					        }  else  {          }  else  {   
			
		
	
		
		
			
				
					
					          return  { " Controls Unresponsive " ,  " Reboot Device " ,            return  { " Controls Unresponsive " ,  " Reboot Device " ,   
			
		
	
		
		
			
				
					
					                  " controlsUnresponsivePermanent " ,  cereal : : ControlsState : : AlertSize : : MID ,                    " controlsUnresponsivePermanent " ,  cereal : : ControlsState : : AlertSize : : MID ,   
			
		
	
		
		
			
				
					
					                  cereal : : ControlsState : : AlertStatus : : NORMAL ,   
			
		
	
		
		
			
				
					
					                  AudibleAlert : : NONE } ;                    AudibleAlert : : NONE } ;   
			
		
	
		
		
			
				
					
					        }          }   
			
		
	
		
		
			
				
					
					      }        }   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -83,16 +88,18 @@ typedef enum UIStatus { 
			
		
	
		
		
			
				
					
					  STATUS_DISENGAGED ,    STATUS_DISENGAGED ,   
			
		
	
		
		
			
				
					
					  STATUS_OVERRIDE ,    STATUS_OVERRIDE ,   
			
		
	
		
		
			
				
					
					  STATUS_ENGAGED ,    STATUS_ENGAGED ,   
			
		
	
		
		
			
				
					
					  STATUS_WARNING ,   
			
		
	
		
		
			
				
					
					  STATUS_ALERT ,   
			
		
	
		
		
			
				
					
					}  UIStatus ; }  UIStatus ;  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					const  QColor  bg_colors  [ ]  =  { const  QColor  bg_colors  [ ]  =  {  
			
		
	
		
		
			
				
					
					  [ STATUS_DISENGAGED ]  =  QColor ( 0x17 ,  0x33 ,  0x49 ,  0xc8 ) ,    [ STATUS_DISENGAGED ]  =  QColor ( 0x17 ,  0x33 ,  0x49 ,  0xc8 ) ,   
			
		
	
		
		
			
				
					
					  [ STATUS_OVERRIDE ]  =  QColor ( 0x91 ,  0x9b ,  0x95 ,  0xf1 ) ,    [ STATUS_OVERRIDE ]  =  QColor ( 0x91 ,  0x9b ,  0x95 ,  0xf1 ) ,   
			
		
	
		
		
			
				
					
					  [ STATUS_ENGAGED ]  =  QColor ( 0x17 ,  0x86 ,  0x44 ,  0xf1 ) ,    [ STATUS_ENGAGED ]  =  QColor ( 0x17 ,  0x86 ,  0x44 ,  0xf1 ) ,   
			
		
	
		
		
			
				
					
					  [ STATUS_WARNING ]  =  QColor ( 0xDA ,  0x6F ,  0x25 ,  0xf1 ) ,  } ;  
			
				
				
			
		
	
		
		
			
				
					
					  [ STATUS_ALERT ]  =  QColor ( 0xC9 ,  0x22 ,  0x31 ,  0xf1 ) ,  
 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					static  std : : map < cereal : : ControlsState : : AlertStatus ,  QColor >  alert_colors  =  {  
			
		
	
		
		
			
				
					
					  { cereal : : ControlsState : : AlertStatus : : NORMAL ,  QColor ( 0x00 ,  0x00 ,  0x00 ,  0xa6 ) } ,   
			
		
	
		
		
			
				
					
					  { cereal : : ControlsState : : AlertStatus : : USER_PROMPT ,  QColor ( 0xDA ,  0x6F ,  0x25 ,  0xf1 ) } ,   
			
		
	
		
		
			
				
					
					  { cereal : : ControlsState : : AlertStatus : : CRITICAL ,  QColor ( 0xC9 ,  0x22 ,  0x31 ,  0xf1 ) } ,   
			
		
	
		
		
			
				
					
					} ; } ;  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					typedef  struct  UIScene  { typedef  struct  UIScene  {