mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-04 13:02:09 +08:00
Volt no camera?
This commit is contained in:
@@ -53,6 +53,15 @@ def should_spoof_dash_speed(CP, starpilot_toggles):
|
||||
return True
|
||||
|
||||
|
||||
def should_send_acc_dashboard_status(CP, dash_speed_spoof_active):
|
||||
status_car = CP.carFingerprint not in CC_ONLY_CAR or CP.carFingerprint == CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL
|
||||
volt_camera_no_camera = (
|
||||
CP.carFingerprint == CAR.CHEVROLET_VOLT_CAMERA and
|
||||
bool(getattr(CP, "flags", 0) & GMFlags.NO_CAMERA.value)
|
||||
)
|
||||
return status_car and (dash_speed_spoof_active or volt_camera_no_camera)
|
||||
|
||||
|
||||
ECM_CRUISE_SPOOF_CARS = {
|
||||
CAR.CHEVROLET_BOLT_CC_2017,
|
||||
CAR.CHEVROLET_BOLT_CC_2018_2021,
|
||||
@@ -556,8 +565,7 @@ class CarController(CarControllerBase):
|
||||
can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, friction_brake_bus, self.apply_brake,
|
||||
idx, CC.enabled, near_stop, at_full_stop, self.CP))
|
||||
|
||||
is_bolt_acc_pedal = self.CP.carFingerprint == CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL
|
||||
if dash_speed_spoof_active and (self.CP.carFingerprint not in CC_ONLY_CAR or is_bolt_acc_pedal):
|
||||
if should_send_acc_dashboard_status(self.CP, dash_speed_spoof_active):
|
||||
send_fcw = hud_alert == VisualAlert.fcw
|
||||
can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled,
|
||||
hud_v_cruise * CV.MS_TO_KPH, hud_control, send_fcw))
|
||||
|
||||
@@ -6,7 +6,7 @@ from opendbc.can import CANPacker
|
||||
from opendbc.car import Bus, DT_CTRL
|
||||
from opendbc.car.car_helpers import interfaces
|
||||
from opendbc.car.gm import gmcan
|
||||
from opendbc.car.gm.carcontroller import should_send_cc_button_spam, should_spoof_dash_speed
|
||||
from opendbc.car.gm.carcontroller import should_send_acc_dashboard_status, should_send_cc_button_spam, should_spoof_dash_speed
|
||||
import opendbc.car.gm.interface as gm_interface
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.gm.fingerprints import FINGERPRINTS
|
||||
@@ -108,6 +108,21 @@ class TestGMCarController:
|
||||
|
||||
assert should_spoof_dash_speed(cp, SimpleNamespace(disable_openpilot_long=False))
|
||||
|
||||
def test_volt_camera_no_camera_sends_acc_dashboard_without_dash_spoof(self):
|
||||
cp = SimpleNamespace(carFingerprint=CAR.CHEVROLET_VOLT_CAMERA, flags=GMFlags.NO_CAMERA.value)
|
||||
|
||||
assert should_send_acc_dashboard_status(cp, dash_speed_spoof_active=False)
|
||||
|
||||
def test_acc_dashboard_no_camera_exception_is_volt_camera_only(self):
|
||||
assert not should_send_acc_dashboard_status(
|
||||
SimpleNamespace(carFingerprint=CAR.CHEVROLET_VOLT_CAMERA, flags=0),
|
||||
dash_speed_spoof_active=False,
|
||||
)
|
||||
assert not should_send_acc_dashboard_status(
|
||||
SimpleNamespace(carFingerprint=CAR.CHEVROLET_VOLT_CC, flags=GMFlags.NO_CAMERA.value),
|
||||
dash_speed_spoof_active=False,
|
||||
)
|
||||
|
||||
def test_cc_button_spam_does_not_require_stock_cruise_enabled(self):
|
||||
cp = SimpleNamespace(flags=GMFlags.CC_LONG.value, minEnableSpeed=10.0)
|
||||
cc = SimpleNamespace(longActive=True)
|
||||
|
||||
Reference in New Issue
Block a user