mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-18 03:12:05 +08:00
VW MQB: Cleanup stock LKAS signal forwarding (#22180)
* VW MQB: Cleanup stock LKAS signal forwarding * apply review suggestion
This commit is contained in:
@@ -79,9 +79,7 @@ class CarController():
|
||||
|
||||
can_sends.append(volkswagencan.create_mqb_hud_control(self.packer_pt, CANBUS.pt, enabled,
|
||||
CS.out.steeringPressed, hud_alert, left_lane_visible,
|
||||
right_lane_visible, CS.ldw_lane_warning_left,
|
||||
CS.ldw_lane_warning_right, CS.ldw_side_dlc_tlc,
|
||||
CS.ldw_dlc, CS.ldw_tlc, CS.out.standstill,
|
||||
right_lane_visible, CS.ldw_stock_values,
|
||||
left_lane_depart, right_lane_depart))
|
||||
|
||||
# **** ACC Button Controls ********************************************** #
|
||||
|
||||
@@ -83,11 +83,7 @@ class CarState(CarStateBase):
|
||||
|
||||
# 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"]
|
||||
self.ldw_stock_values = cam_cp.vl["LDW_02"] if self.CP.networkLocation == NetworkLocation.fwdCamera else {}
|
||||
|
||||
# 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
|
||||
@@ -235,21 +231,23 @@ class CarState(CarStateBase):
|
||||
@staticmethod
|
||||
def get_cam_can_parser(CP):
|
||||
|
||||
signals = [
|
||||
# sig_name, sig_address, default
|
||||
("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
|
||||
]
|
||||
signals = []
|
||||
checks = []
|
||||
|
||||
checks = [
|
||||
# sig_address, frequency
|
||||
("LDW_02", 10) # From R242 Driver assistance camera
|
||||
]
|
||||
|
||||
if CP.networkLocation == NetworkLocation.gateway:
|
||||
if CP.networkLocation == NetworkLocation.fwdCamera:
|
||||
signals += [
|
||||
# sig_name, sig_address, default
|
||||
("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 += [
|
||||
# sig_address, frequency
|
||||
("LDW_02", 10) # From R242 Driver assistance camera
|
||||
]
|
||||
else:
|
||||
# Radars are here on CANBUS.cam
|
||||
signals += MqbExtraSignals.fwd_radar_signals
|
||||
checks += MqbExtraSignals.fwd_radar_checks
|
||||
|
||||
@@ -16,26 +16,20 @@ def create_mqb_steering_control(packer, bus, apply_steer, idx, lkas_enabled):
|
||||
return packer.make_can_msg("HCA_01", bus, values, idx)
|
||||
|
||||
def create_mqb_hud_control(packer, bus, enabled, steering_pressed, hud_alert, left_lane_visible, right_lane_visible,
|
||||
ldw_lane_warning_left, ldw_lane_warning_right, ldw_side_dlc_tlc, ldw_dlc, ldw_tlc,
|
||||
standstill, left_lane_depart, right_lane_depart):
|
||||
ldw_stock_values, left_lane_depart, right_lane_depart):
|
||||
# Lane color reference:
|
||||
# 0 (LKAS disabled) - off
|
||||
# 1 (LKAS enabled, no lane detected) - dark gray
|
||||
# 2 (LKAS enabled, lane detected) - light gray on VW, green or white on Audi depending on year or virtual cockpit. On a color MFD on a 2015 A3 TDI it is white, virtual cockpit on a 2018 A3 e-Tron its green.
|
||||
# 3 (LKAS enabled, lane departure detected) - white on VW, red on Audi
|
||||
|
||||
values = {
|
||||
# 0 (LKAS disabled) - off
|
||||
# 1 (LKAS enabled, no lane detected) - dark gray
|
||||
# 2 (LKAS enabled, lane detected) - light gray on VW, green or white on Audi depending on year or virtual cockpit. On a color MFD on a 2015 A3 TDI it is white, virtual cockpit on a 2018 A3 e-Tron its green.
|
||||
# 3 (LKAS enabled, lane departure detected) - white on VW, red on Audi
|
||||
values = ldw_stock_values.copy()
|
||||
values.update({
|
||||
"LDW_Status_LED_gelb": 1 if enabled and steering_pressed else 0,
|
||||
"LDW_Status_LED_gruen": 1 if enabled and not steering_pressed else 0,
|
||||
"LDW_Lernmodus_links": 3 if left_lane_depart else 1 + left_lane_visible,
|
||||
"LDW_Lernmodus_rechts": 3 if right_lane_depart else 1 + right_lane_visible,
|
||||
"LDW_Texte": hud_alert,
|
||||
"LDW_SW_Warnung_links": ldw_lane_warning_left,
|
||||
"LDW_SW_Warnung_rechts": ldw_lane_warning_right,
|
||||
"LDW_Seite_DLCTLC": ldw_side_dlc_tlc,
|
||||
"LDW_DLC": ldw_dlc,
|
||||
"LDW_TLC": ldw_tlc
|
||||
}
|
||||
})
|
||||
return packer.make_can_msg("LDW_02", bus, values)
|
||||
|
||||
def create_mqb_acc_buttons_control(packer, bus, buttonStatesToSend, CS, idx):
|
||||
|
||||
Reference in New Issue
Block a user