mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-05 13:32:05 +08:00
volt
This commit is contained in:
@@ -273,6 +273,7 @@ class CarState(CarStateBase):
|
||||
ret.cruiseState.enabled = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] != AccState.OFF
|
||||
ret.cruiseState.standstill = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.STANDSTILL
|
||||
self.stock_fcw_alert = 0
|
||||
ret.stockFcw = False
|
||||
if self.CP.networkLocation == NetworkLocation.fwdCamera and not self.CP.flags & GMFlags.NO_CAMERA.value:
|
||||
has_acc_dashboard_status = self.CP.carFingerprint not in CC_ONLY_CAR or self.CP.carFingerprint == CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL
|
||||
if has_acc_dashboard_status:
|
||||
@@ -288,8 +289,9 @@ class CarState(CarStateBase):
|
||||
# Preserve the stock camera FCW level from 0x370 so the controller can
|
||||
# replay it when that message is blocked and spoofed by openpilot long.
|
||||
self.stock_fcw_alert = int(acc_dashboard_status["FCWAlert"])
|
||||
ret.stockFcw = self.stock_fcw_alert != 0
|
||||
|
||||
if self.CP.carFingerprint not in (SDGM_CAR | ASCM_INT):
|
||||
if self.CP.carFingerprint not in SDGM_CAR:
|
||||
ret.stockAeb = cam_cp.vl["AEBCmd"]["AEBCmdActive"] != 0
|
||||
else:
|
||||
ret.stockAeb = False
|
||||
@@ -479,7 +481,13 @@ class CarState(CarStateBase):
|
||||
]
|
||||
if CP.enableBsm:
|
||||
cam_messages.append(("BCMBlindSpotMonitor", 10))
|
||||
elif CP.carFingerprint not in (SDGM_CAR | ASCM_INT):
|
||||
elif CP.carFingerprint in ASCM_INT:
|
||||
# Volt/ASCM-int variants don't reliably have AEBCmd present at startup,
|
||||
# but when it appears we still want to surface OEM AEB state.
|
||||
cam_messages += [
|
||||
("AEBCmd", 0),
|
||||
]
|
||||
elif CP.carFingerprint not in SDGM_CAR:
|
||||
cam_messages += [
|
||||
("AEBCmd", 10),
|
||||
]
|
||||
|
||||
@@ -3,9 +3,10 @@ from types import SimpleNamespace
|
||||
from parameterized import parameterized
|
||||
|
||||
from opendbc.can import CANPacker, CANParser
|
||||
from opendbc.car import Bus, DT_CTRL
|
||||
from opendbc.car import Bus, DT_CTRL, structs
|
||||
from opendbc.car.car_helpers import interfaces
|
||||
from opendbc.car.gm import gmcan
|
||||
from opendbc.car.gm.carstate import CarState as GMCarState
|
||||
from opendbc.car.gm.carcontroller import (
|
||||
VisualAlert,
|
||||
get_acc_dashboard_fcw_alert,
|
||||
@@ -131,6 +132,20 @@ class TestGMInterface:
|
||||
assert "ECMAcceleratorPos" not in pt_parser.vl
|
||||
assert "EBCMBrakePedalPosition" in pt_parser.vl
|
||||
|
||||
def test_volt_ascm_cam_parser_includes_optional_aeb_cmd(self):
|
||||
cam_parser = GMCarState.get_can_parsers(SimpleNamespace(
|
||||
carFingerprint=CAR.CHEVROLET_VOLT_ASCM,
|
||||
networkLocation=structs.CarParams.NetworkLocation.fwdCamera,
|
||||
flags=0,
|
||||
transmissionType=structs.CarParams.TransmissionType.direct,
|
||||
enableGasInterceptorDEPRECATED=False,
|
||||
enableBsm=False,
|
||||
))[Bus.cam]
|
||||
aeb_addr = cam_parser.dbc.name_to_msg["AEBCmd"].address
|
||||
|
||||
assert "AEBCmd" in cam_parser.vl
|
||||
assert cam_parser.message_states[aeb_addr].ignore_alive
|
||||
|
||||
def test_bolt_gen2_pedal_cancel_remap_sets_alt_exp(self):
|
||||
CarInterface = interfaces[CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL]
|
||||
fingerprint = _empty_fingerprint()
|
||||
@@ -317,6 +332,14 @@ class TestGMCarController:
|
||||
|
||||
assert get_acc_dashboard_fcw_alert(VisualAlert.none, cs) == 0x3
|
||||
|
||||
def test_acc_dashboard_fcw_alert_falls_back_to_stock_fcw_event(self):
|
||||
cs = SimpleNamespace(
|
||||
stock_fcw_alert=0,
|
||||
out=SimpleNamespace(stockAeb=False, stockFcw=True),
|
||||
)
|
||||
|
||||
assert get_acc_dashboard_fcw_alert(VisualAlert.none, cs) == 0x3
|
||||
|
||||
def test_acc_dashboard_status_values_use_openpilot_hud_when_enabled(self):
|
||||
cs = SimpleNamespace(
|
||||
stock_acc_cruise_state=5,
|
||||
|
||||
Reference in New Issue
Block a user