diff --git a/opendbc_repo/opendbc/car/gm/carcontroller.py b/opendbc_repo/opendbc/car/gm/carcontroller.py index a061a6417..2784fac51 100644 --- a/opendbc_repo/opendbc/car/gm/carcontroller.py +++ b/opendbc_repo/opendbc/car/gm/carcontroller.py @@ -110,6 +110,13 @@ def should_send_acc_dashboard_status(CP, dash_speed_spoof_active): return status_car and (dash_speed_spoof_active or volt_camera_no_camera) +def get_acc_dashboard_status_active(CP, CC): + if CC.enabled: + return True + + return CP.carFingerprint == CAR.BUICK_LACROSSE_ASCM and CC.latActive + + def get_acc_dashboard_fcw_alert(hud_alert, CS): if hud_alert == VisualAlert.fcw: return 0x3 @@ -1016,7 +1023,8 @@ class CarController(CarControllerBase): if should_send_acc_dashboard_status(self.CP, dash_speed_spoof_active): fcw_alert = get_acc_dashboard_fcw_alert(hud_alert, CS) - can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, + acc_dashboard_status_active = get_acc_dashboard_status_active(self.CP, CC) + can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, acc_dashboard_status_active, hud_v_cruise * CV.MS_TO_KPH, hud_control, fcw_alert)) # Radar needs to know current speed and yaw rate (50hz), diff --git a/opendbc_repo/opendbc/car/gm/tests/test_carcontroller.py b/opendbc_repo/opendbc/car/gm/tests/test_carcontroller.py index 53b5c47ed..6bef21d9d 100644 --- a/opendbc_repo/opendbc/car/gm/tests/test_carcontroller.py +++ b/opendbc_repo/opendbc/car/gm/tests/test_carcontroller.py @@ -50,6 +50,7 @@ from opendbc.car.gm.carcontroller import ( get_lka_steering_cmd_counter, get_volt_one_pedal_target_decel, get_testing_ground_1_brake_switch_bias, + get_acc_dashboard_status_active, get_stock_cc_active_for_cancel, shape_truck_positive_accel, should_use_fixed_stopping_brake, @@ -312,6 +313,20 @@ def test_ascm_int_cars_do_not_send_radar_status(): assert not should_send_adas_status(SimpleNamespace(carFingerprint=CAR.CHEVROLET_VOLT_ASCM, **common), is_kaofui_car=True) +def test_lacrosse_ascm_marks_acc_dashboard_active_for_aol_only(): + cc = SimpleNamespace(enabled=False, latActive=True) + + assert get_acc_dashboard_status_active(SimpleNamespace(carFingerprint=CAR.BUICK_LACROSSE_ASCM), cc) + assert not get_acc_dashboard_status_active(SimpleNamespace(carFingerprint=CAR.CHEVROLET_VOLT_ASCM), cc) + assert not get_acc_dashboard_status_active(SimpleNamespace(carFingerprint=CAR.CHEVROLET_BOLT_ACC_2022_2023), cc) + + +def test_acc_dashboard_status_active_for_normal_enabled_cars(): + cc = SimpleNamespace(enabled=True, latActive=False) + + assert get_acc_dashboard_status_active(SimpleNamespace(carFingerprint=CAR.CHEVROLET_VOLT_ASCM), cc) + + def test_volt_auto_hold_requires_toggle_supported_non_cc_only_volt_and_stock_safety(): stock_safety = [SimpleNamespace(safetyParam=0x8000)] no_safety = [SimpleNamespace(safetyParam=0)]