@ -16,7 +16,7 @@ class CarState(CarStateBase): 
			
		
	
		
		
			
				
					
					      self . shifter_values  =  can_define . dv [ " EV_Gearshift " ] [ ' GearPosition ' ]        self . shifter_values  =  can_define . dv [ " EV_Gearshift " ] [ ' GearPosition ' ]   
			
		
	
		
		
			
				
					
					    self . buttonStates  =  BUTTON_STATES . copy ( )      self . buttonStates  =  BUTTON_STATES . copy ( )   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					  def  update ( self ,  pt_cp ,  trans_type ) :    def  update ( self ,  pt_cp ,  cam_cp ,  trans_type ) :   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					    ret  =  car . CarState . new_message ( )      ret  =  car . CarState . new_message ( )   
			
		
	
		
		
			
				
					
					    # Update vehicle speed and acceleration from ABS wheel speeds.      # Update vehicle speed and acceleration from ABS wheel speeds.   
			
		
	
		
		
			
				
					
					    ret . wheelSpeeds . fl  =  pt_cp . vl [ " ESP_19 " ] [ ' ESP_VL_Radgeschw_02 ' ]  *  CV . KPH_TO_MS      ret . wheelSpeeds . fl  =  pt_cp . vl [ " ESP_19 " ] [ ' ESP_VL_Radgeschw_02 ' ]  *  CV . KPH_TO_MS   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -83,6 +83,14 @@ class CarState(CarStateBase): 
			
		
	
		
		
			
				
					
					    ret . leftBlindspot  =  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Infostufe_SWA_li " ] )  or  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Warnung_SWA_li " ] )      ret . leftBlindspot  =  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Infostufe_SWA_li " ] )  or  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Warnung_SWA_li " ] )   
			
		
	
		
		
			
				
					
					    ret . rightBlindspot  =  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Infostufe_SWA_re " ] )  or  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Warnung_SWA_re " ] )      ret . rightBlindspot  =  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Infostufe_SWA_re " ] )  or  bool ( pt_cp . vl [ " SWA_01 " ] [ " SWA_Warnung_SWA_re " ] )   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # Consume factory LDW data relevant for factory SWA (Lane Change Assist)   
			
		
	
		
		
			
				
					
					    # and capture it for forwarding to the blind spot radar controller   
			
		
	
		
		
			
				
					
					    self . ldw_lane_warning_left  =  bool ( cam_cp . vl [ " LDW_02 " ] [ " LDW_SW_Warnung_links " ] )   
			
		
	
		
		
			
				
					
					    self . ldw_lane_warning_right  =  bool ( cam_cp . vl [ " LDW_02 " ] [ " LDW_SW_Warnung_rechts " ] )   
			
		
	
		
		
			
				
					
					    self . ldw_side_dlc_tlc  =  bool ( cam_cp . vl [ " LDW_02 " ] [ " LDW_Seite_DLCTLC " ] )   
			
		
	
		
		
			
				
					
					    self . ldw_dlc  =  cam_cp . vl [ " LDW_02 " ] [ " LDW_DLC " ]   
			
		
	
		
		
			
				
					
					    self . ldw_tlc  =  cam_cp . vl [ " LDW_02 " ] [ " LDW_TLC " ]   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # Stock FCW is considered active if the release bit for brake-jerk warning      # Stock FCW is considered active if the release bit for brake-jerk warning   
			
		
	
		
		
			
				
					
					    # is set. Stock AEB considered active if the partial braking or target      # is set. Stock AEB considered active if the partial braking or target   
			
		
	
		
		
			
				
					
					    # braking release bits are set.      # braking release bits are set.   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -180,8 +188,6 @@ class CarState(CarStateBase): 
			
		
	
		
		
			
				
					
					      ( " KBI_Handbremse " ,  " Kombi_01 " ,  0 ) ,             # Manual handbrake applied        ( " KBI_Handbremse " ,  " Kombi_01 " ,  0 ) ,             # Manual handbrake applied   
			
		
	
		
		
			
				
					
					      ( " TSK_Status " ,  " TSK_06 " ,  0 ) ,                   # ACC engagement status from drivetrain coordinator        ( " TSK_Status " ,  " TSK_06 " ,  0 ) ,                   # ACC engagement status from drivetrain coordinator   
			
		
	
		
		
			
				
					
					      ( " TSK_Fahrzeugmasse_02 " ,  " Motor_16 " ,  0 ) ,       # Estimated vehicle mass from drivetrain coordinator        ( " TSK_Fahrzeugmasse_02 " ,  " Motor_16 " ,  0 ) ,       # Estimated vehicle mass from drivetrain coordinator   
			
		
	
		
		
			
				
					
					      ( " ACC_Status_ACC " ,  " ACC_06 " ,  0 ) ,               # ACC engagement status   
			
		
	
		
		
			
				
					
					      ( " ACC_Typ " ,  " ACC_06 " ,  0 ) ,                      # ACC type (follow to stop, stop&go)   
			
		
	
		
		
			
				
					
					      ( " ACC_Wunschgeschw " ,  " ACC_02 " ,  0 ) ,             # ACC set speed        ( " ACC_Wunschgeschw " ,  " ACC_02 " ,  0 ) ,             # ACC set speed   
			
		
	
		
		
			
				
					
					      ( " AWV2_Freigabe " ,  " ACC_10 " ,  0 ) ,                # FCW brake jerk release        ( " AWV2_Freigabe " ,  " ACC_10 " ,  0 ) ,                # FCW brake jerk release   
			
		
	
		
		
			
				
					
					      ( " ANB_Teilbremsung_Freigabe " ,  " ACC_10 " ,  0 ) ,    # AEB partial braking release        ( " ANB_Teilbremsung_Freigabe " ,  " ACC_10 " ,  0 ) ,    # AEB partial braking release   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -210,7 +216,6 @@ class CarState(CarStateBase): 
			
		
	
		
		
			
				
					
					      ( " ESP_19 " ,  100 ) ,       # From J104 ABS/ESP controller        ( " ESP_19 " ,  100 ) ,       # From J104 ABS/ESP controller   
			
		
	
		
		
			
				
					
					      ( " ESP_05 " ,  50 ) ,        # From J104 ABS/ESP controller        ( " ESP_05 " ,  50 ) ,        # From J104 ABS/ESP controller   
			
		
	
		
		
			
				
					
					      ( " ESP_21 " ,  50 ) ,        # From J104 ABS/ESP controller        ( " ESP_21 " ,  50 ) ,        # From J104 ABS/ESP controller   
			
		
	
		
		
			
				
					
					      ( " ACC_06 " ,  50 ) ,        # From J428 ACC radar control module   
			
		
	
		
		
			
				
					
					      ( " ACC_10 " ,  50 ) ,        # From J428 ACC radar control module        ( " ACC_10 " ,  50 ) ,        # From J428 ACC radar control module   
			
		
	
		
		
			
				
					
					      ( " Motor_20 " ,  50 ) ,      # From J623 Engine control module        ( " Motor_20 " ,  50 ) ,      # From J623 Engine control module   
			
		
	
		
		
			
				
					
					      ( " TSK_06 " ,  50 ) ,        # From J623 Engine control module        ( " TSK_06 " ,  50 ) ,        # From J623 Engine control module   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -245,7 +250,11 @@ class CarState(CarStateBase): 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    signals  =  [      signals  =  [   
			
		
	
		
		
			
				
					
					      # sig_name, sig_address, default        # sig_name, sig_address, default   
			
		
	
		
		
			
				
					
					      ( " LDW_Status_LED_gruen " ,  " LDW_02 " ,  0 ) ,             # Lane Assist status LED        ( " LDW_SW_Warnung_links " ,  " LDW_02 " ,  0 ) ,           # Blind spot in warning mode on left side due to lane departure   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					      ( " LDW_SW_Warnung_rechts " ,  " LDW_02 " ,  0 ) ,          # Blind spot in warning mode on right side due to lane departure   
			
		
	
		
		
			
				
					
					      ( " LDW_Seite_DLCTLC " ,  " LDW_02 " ,  0 ) ,               # Direction of most likely lane departure (left or right)   
			
		
	
		
		
			
				
					
					      ( " LDW_DLC " ,  " LDW_02 " ,  0 ) ,                        # Lane departure, distance to line crossing   
			
		
	
		
		
			
				
					
					      ( " LDW_TLC " ,  " LDW_02 " ,  0 ) ,                        # Lane departure, time to line crossing   
			
		
	
		
		
			
				
					
					    ]      ]   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    checks  =  [      checks  =  [