mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-27 23:33:41 +08:00
Retain stock cruise ownership when GM speed control is disabled
This commit is contained in:
@@ -12,7 +12,7 @@ from opendbc.car.gm.values import (malibu_hybrid_profile, volt_cc_pedal_profile,
|
||||
is_ordinary_ascm_profile, is_ordinary_camera_profile, is_ordinary_sdgm_profile, is_bolt_euv_longitudinal,
|
||||
is_volt_gateway_profile, is_volt_cc_profile, is_silverado_cc_stock_profile,
|
||||
is_volt_ascm_longitudinal, is_volt_camera_stock, is_volt_camera_longitudinal,
|
||||
is_volt_camera_removed, is_volt_sdgm_profile, is_ordinary_cc_profile, is_conventional_cc_pedal_profile,
|
||||
is_volt_camera_removed, is_volt_sdgm_profile, is_ordinary_cc_profile, is_ordinary_cc_stock_profile, is_conventional_cc_pedal_profile,
|
||||
)
|
||||
from opendbc.car.gm.lateral import lane_centering_supported
|
||||
|
||||
@@ -73,7 +73,8 @@ def _qualified_gm_uncached(cp) -> bool:
|
||||
cp.carFingerprint == CAR.BUICK_LACROSSE and cp.openpilotLongitudinalControl))
|
||||
if is_ordinary_camera_profile(cp, longitudinal=cp.openpilotLongitudinalControl):
|
||||
return True
|
||||
if is_silverado_cc_stock_profile(cp) or is_ordinary_cc_profile(cp) or is_conventional_cc_pedal_profile(cp) or malibu_hybrid_profile(cp) is not None:
|
||||
if (is_silverado_cc_stock_profile(cp) or is_ordinary_cc_stock_profile(cp) or is_ordinary_cc_profile(cp) or
|
||||
is_conventional_cc_pedal_profile(cp) or malibu_hybrid_profile(cp) is not None):
|
||||
return True
|
||||
if is_ordinary_sdgm_profile(cp, longitudinal=False) or is_ordinary_sdgm_profile(cp, longitudinal=True):
|
||||
return True
|
||||
|
||||
@@ -31,6 +31,7 @@ from opendbc.car.gm.values import (DBC, CanBus, CarControllerParams, CruiseButto
|
||||
NO_ACC_BOLT_CAR, is_bolt_pedal_profile, is_bolt_pedal_removed_profile,
|
||||
is_bolt_present_no_acc_pedal_profile, is_bolt_euv_longitudinal,
|
||||
is_volt_cc_longitudinal, is_volt_cc_profile, is_silverado_cc_stock_profile, is_ordinary_cc_profile,
|
||||
is_ordinary_cc_stock_profile,
|
||||
CC_GATEWAY_STOCK_CAR, uses_camera_stock_controls, CAR, BOLT_CC_WORDS, is_bolt_cc_profile)
|
||||
from opendbc.car.interfaces import CarControllerBase
|
||||
|
||||
@@ -555,7 +556,7 @@ class CarController(CarControllerBase):
|
||||
if self.hybrid_profile is not None:
|
||||
stock_steer_ready = hybrid_lateral_ready(CS, now_nanos) and (aol_lateral or
|
||||
CS.out.cruiseState.enabled and not CS.out.brakePressed and not CS.out.gasPressed)
|
||||
if is_silverado_cc_stock_profile(self.CP):
|
||||
if (is_silverado_cc_stock_profile(self.CP) or is_ordinary_cc_stock_profile(self.CP)):
|
||||
sources = CS.silverado_stock_sources
|
||||
stock_steer_ready = (CS.out.canValid and not CS.out.canTimeout and len(sources) == 8 and
|
||||
all(0 < stamp <= now_nanos <= stamp + limit for stamp, limit in sources) and
|
||||
@@ -1199,7 +1200,7 @@ class CarController(CarControllerBase):
|
||||
# While car is braking, cancel button causes ECM to enter a soft disable state with a fault status.
|
||||
# A delayed cancellation allows camera to cancel and avoids a fault when user depresses brake quickly
|
||||
cancel_requested = CC.cruiseControl.cancel
|
||||
if is_silverado_cc_stock_profile(self.CP):
|
||||
if (is_silverado_cc_stock_profile(self.CP) or is_ordinary_cc_stock_profile(self.CP)):
|
||||
cancel_requested = cancel_requested and stock_cruise_fresh and CS.out.cruiseState.available and CS.out.cruiseState.enabled
|
||||
self.cancel_counter = self.cancel_counter + 1 if cancel_requested else 0
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from opendbc.car.gm.values import (DBC, AccState, CruiseButtons, STEER_THRESHOLD
|
||||
ASCM_INTERCEPT_CAR, ORDINARY_ASCM_CAR, ORDINARY_SDGM_CAR, GMFlags, GMSafetyFlags, NO_ACC_BOLT_CAR,
|
||||
CC_GATEWAY_STOCK_CAR, requires_camera_state_sources, is_conventional_cc_pedal_profile, is_silverado_cc_pedal_profile,
|
||||
is_volt_cc_profile, is_volt_cc_f1_profile, is_silverado_cc_stock_profile, is_ordinary_cc_profile,
|
||||
is_ordinary_cc_stock_profile,
|
||||
is_malibu_cc_f1_profile, VOLT_BSM_CAR, CAR,
|
||||
is_volt_gateway_profile, is_volt_gateway_alternate_brake, is_bolt_cc_profile, BOLT_CC_WORDS,
|
||||
is_bolt_pedal_profile, is_bolt_pedal_removed_profile, is_bolt_present_no_acc_pedal_profile, is_volt_camera_removed,
|
||||
@@ -226,7 +227,7 @@ class CarState(CarStateBase):
|
||||
if (self.CP.carFingerprint in CC_GATEWAY_STOCK_CAR or self.CP.carFingerprint == CAR.CHEVROLET_VOLT_CC):
|
||||
self.cc_gateway_buttons_ts_nanos = pt_cp.ts_nanos["ASCMSteeringButton"]["RollingCounter"]
|
||||
self.cc_gateway_cruise_ts_nanos = pt_cp.ts_nanos["ECMCruiseControl"]["CruiseActive"]
|
||||
if is_silverado_cc_stock_profile(self.CP):
|
||||
if (is_silverado_cc_stock_profile(self.CP) or is_ordinary_cc_stock_profile(self.CP)):
|
||||
fields = (("PSCMStatus", "LKATorqueDelivered", 300_000_000),
|
||||
("EBCMWheelSpdRear", "RLWheelSpd", 100_000_000),
|
||||
("ASCMSteeringButton", "RollingCounter", 300_000_000),
|
||||
@@ -562,7 +563,7 @@ class CarState(CarStateBase):
|
||||
if not is_conventional_cc_pedal_profile(self.CP):
|
||||
ret.cruiseState.standstill = False
|
||||
ret.cruiseState.speed = pt_cp.vl["ECMCruiseControl"]["CruiseSetSpeed"] * CV.KPH_TO_MS
|
||||
ret.cruiseState.nonAdaptive = not (is_silverado_cc_stock_profile(self.CP) or
|
||||
ret.cruiseState.nonAdaptive = not ((is_silverado_cc_stock_profile(self.CP) or is_ordinary_cc_stock_profile(self.CP)) or
|
||||
is_ordinary_cc_profile(self.CP) or is_conventional_cc_pedal_profile(self.CP) or
|
||||
is_volt_cc_profile(self.CP))
|
||||
if self.hybrid_profile is not None:
|
||||
|
||||
@@ -5,6 +5,7 @@ from opendbc.car.structs import CarParams
|
||||
from opendbc.car.gm.values import (malibu_hybrid_profile, control_flags, CAR, GMSafetyFlags, is_volt_gateway_profile,
|
||||
is_volt_ascm_longitudinal, is_volt_cc_profile, is_volt_sdgm_profile, is_volt_camera_removed,
|
||||
is_ordinary_ascm_profile, is_ordinary_camera_profile, is_ordinary_sdgm_profile, is_ordinary_cc_profile,
|
||||
is_ordinary_cc_stock_profile,
|
||||
is_conventional_cc_pedal_profile)
|
||||
|
||||
|
||||
@@ -24,7 +25,7 @@ def lane_centering_supported(cp) -> bool:
|
||||
return False
|
||||
if camera_acc_pedal_profile(cp) is not None or is_ordinary_camera_profile(cp, longitudinal=cp.openpilotLongitudinalControl):
|
||||
return True
|
||||
if is_ordinary_cc_profile(cp) or is_conventional_cc_pedal_profile(cp) or malibu_hybrid_profile(cp) is not None:
|
||||
if is_ordinary_cc_profile(cp) or is_ordinary_cc_stock_profile(cp) or is_conventional_cc_pedal_profile(cp) or malibu_hybrid_profile(cp) is not None:
|
||||
return True
|
||||
if (is_ordinary_ascm_profile(cp, longitudinal=cp.openpilotLongitudinalControl)
|
||||
or is_ordinary_sdgm_profile(cp, longitudinal=cp.openpilotLongitudinalControl)):
|
||||
|
||||
@@ -2,7 +2,7 @@ from opendbc.car.gm.values import gm_control_word, is_volt_one_pedal, camera_acc
|
||||
"""Finalized GM speed-control choices; existing native envelopes are retained."""
|
||||
|
||||
from opendbc.car.gm.values import (is_malibu_cc_f1_profile, MALIBU_CC_F1_STOCK_WORD, is_volt_gateway_profile, is_volt_cc_profile,
|
||||
is_ordinary_cc_profile, is_ordinary_camera_profile,
|
||||
is_ordinary_cc_profile, is_ordinary_cc_stock_profile, is_ordinary_camera_profile,
|
||||
is_conventional_cc_pedal_profile, is_silverado_cc_pedal_profile, SILVERADO_CC_PEDAL_WORDS,
|
||||
CONVENTIONAL_CC_PEDAL_STOCK_WORDS, GMFlags)
|
||||
from opendbc.car.gm.values import (is_volt_ascm_longitudinal, is_volt_camera_longitudinal, is_volt_sdgm_profile,
|
||||
@@ -14,7 +14,8 @@ def disable_long_supported(cp) -> bool:
|
||||
if malibu_hybrid_profile(cp) is not None:
|
||||
return True
|
||||
return (volt_cc_pedal_profile(cp) is not None or camera_acc_pedal_profile(cp) is not None or is_conventional_cc_pedal_profile(cp) or
|
||||
is_ordinary_cc_profile(cp) or is_ordinary_camera_profile(cp) or is_ordinary_camera_profile(cp, longitudinal=True) or
|
||||
is_ordinary_cc_profile(cp) or is_ordinary_cc_stock_profile(cp) or
|
||||
is_ordinary_camera_profile(cp) or is_ordinary_camera_profile(cp, longitudinal=True) or
|
||||
is_volt_gateway_profile(cp) or is_volt_cc_profile(cp) or
|
||||
is_volt_ascm_longitudinal(cp) or is_volt_camera_longitudinal(cp) or is_volt_sdgm_profile(cp, longitudinal=True) or
|
||||
is_volt_camera_removed(cp, longitudinal=True) or is_lacrosse_gateway_profile(cp))
|
||||
@@ -41,6 +42,14 @@ def prepare_disable_longitudinal(cp, requested: bool) -> None:
|
||||
cp.autoResumeSng = False
|
||||
cp.safetyConfigs[0].safetyParam = MALIBU_CC_F1_STOCK_WORD
|
||||
return
|
||||
if requested and (is_ordinary_cc_profile(cp) or is_ordinary_cc_stock_profile(cp)):
|
||||
cp.openpilotLongitudinalControl = False
|
||||
cp.pcmCruise = True
|
||||
cp.autoResumeSng = False
|
||||
cp.flags &= ~int(GMFlags.CC_LONG)
|
||||
cp.safetyConfigs[0].safetyParam = int(GMSafetyFlags.NO_ACC)
|
||||
cp.minEnableSpeed = -1.
|
||||
return
|
||||
cc_profile = volt_cc_pedal_profile(cp)
|
||||
if requested and cc_profile is not None:
|
||||
cp.safetyConfigs[0].safetyParam = 0xE610 + 4 * int(cc_profile.radar) + 2 * int(cc_profile.removed) + int(cc_profile.brake_source.value == "F1")
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
import os
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from opendbc.can import CANPacker
|
||||
from opendbc.car import Bus, structs
|
||||
from opendbc.car.gm.interface import CarInterface
|
||||
from opendbc.car.gm.values import (CAR, DBC, ORDINARY_CC_CAR, GMFlags, CruiseButtons,
|
||||
is_ordinary_cc_profile, is_ordinary_cc_stock_profile)
|
||||
from opendbc.car.gm.startup_preferences import prepare_disable_longitudinal, disable_long_supported
|
||||
from opendbc.car.gm.tests.test_ascm_intercept import params
|
||||
from opendbc.car.gm.tests.test_cc_gateway_stock import pt_frames, silverado_stock_params
|
||||
from opendbc.car.gm.tests.test_bolt_cc import native
|
||||
from opendbc.car.gm.gmcan import create_buttons
|
||||
from opendbc.safety.tests.libsafety import libsafety_py
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.common.prefix import OpenpilotPrefix
|
||||
|
||||
|
||||
class TestDisabledCcStock(unittest.TestCase):
|
||||
def test_finalized_stock_owner_is_exact_and_idempotent(self):
|
||||
from opendbc.car.gm.aol import qualified_gm
|
||||
from opendbc.car.gm.lateral import lane_centering_supported
|
||||
from opendbc.car.gm.feature_capabilities import longitudinal_supported
|
||||
for identity in ORDINARY_CC_CAR:
|
||||
for release in (False, True):
|
||||
cp = params(identity, release=release)
|
||||
before = cp.to_dict()
|
||||
prepare_disable_longitudinal(cp, False)
|
||||
self.assertEqual(cp.to_dict(), before)
|
||||
self.assertTrue(is_ordinary_cc_profile(cp))
|
||||
self.assertTrue(cp.openpilotLongitudinalControl)
|
||||
cp.flags |= int(GMFlags.HAS_BSM)
|
||||
prepare_disable_longitudinal(cp, True)
|
||||
self.assertTrue(is_ordinary_cc_stock_profile(cp), identity)
|
||||
self.assertFalse(is_ordinary_cc_profile(cp))
|
||||
self.assertTrue(cp.flags & GMFlags.HAS_BSM)
|
||||
self.assertTrue(cp.pcmCruise)
|
||||
self.assertFalse(cp.openpilotLongitudinalControl)
|
||||
self.assertEqual(cp.safetyConfigs[0].safetyParam, 16)
|
||||
self.assertEqual(cp.minEnableSpeed, -1.)
|
||||
self.assertTrue(qualified_gm(cp))
|
||||
self.assertTrue(lane_centering_supported(cp))
|
||||
self.assertFalse(longitudinal_supported(cp))
|
||||
self.assertTrue(disable_long_supported(cp))
|
||||
before = cp.to_dict()
|
||||
prepare_disable_longitudinal(cp, True)
|
||||
self.assertEqual(cp.to_dict(), before)
|
||||
for field in ('passive', 'dashcamOnly', 'notCar', 'openpilotLongitudinalControl', 'alphaLongitudinalAvailable'):
|
||||
denied = cp.as_reader().as_builder()
|
||||
setattr(denied, field, True)
|
||||
self.assertFalse(is_ordinary_cc_stock_profile(denied), field)
|
||||
silverado = silverado_stock_params()
|
||||
self.assertFalse(is_ordinary_cc_stock_profile(silverado))
|
||||
before = silverado.to_dict()
|
||||
prepare_disable_longitudinal(silverado, True)
|
||||
self.assertEqual(silverado.to_dict(), before)
|
||||
|
||||
def test_actual_card_parser_native_own_cruise_and_cancel(self):
|
||||
from openpilot.starpilot.aol.tests.test_gm import TestGmAol
|
||||
safety = libsafety_py.libsafety
|
||||
for identity in (CAR.CADILLAC_XT5_CC, CAR.CADILLAC_XT4_CC):
|
||||
with self.subTest(identity=identity), OpenpilotPrefix(), patch.dict(os.environ, {'SIMULATION': '1', 'AOL_REPLAY_RUNTIME': '0'}):
|
||||
settings = Params()
|
||||
settings.put_bool('DisableOpenpilotLongitudinal', True, block=True)
|
||||
settings.put_bool('AlwaysOnLateral', True, block=True)
|
||||
card = TestGmAol.card(params(identity), settings)
|
||||
cp, ci = card.CP, card.CI
|
||||
self.assertTrue(is_ordinary_cc_stock_profile(cp))
|
||||
self.assertFalse(card.volt_cc_selected)
|
||||
self.assertEqual(cp.alternativeExperience, 32)
|
||||
packer = CANPacker(DBC[identity][Bus.pt])
|
||||
safety.set_alternative_experience(cp.alternativeExperience)
|
||||
self.assertEqual(safety.set_safety_hooks(structs.CarParams.SafetyModel.gm, 16), 0)
|
||||
safety.init_tests()
|
||||
control = structs.CarControl(enabled=True, latActive=True, longActive=True)
|
||||
control.actuators.accel = 2.
|
||||
control.hudControl.setSpeed = 35.
|
||||
saw_cancel = False
|
||||
for tick in range(420):
|
||||
now = 1_000_000_000 + tick * 10_000_000
|
||||
cruise = 150 <= tick < 350
|
||||
main = tick < 390
|
||||
brake = 320 <= tick < 340
|
||||
gas = 300 <= tick < 310
|
||||
frames = [f for f in pt_frames(packer, cruise=cruise, main=main, brake=brake, gas=gas,
|
||||
counter=tick % 4) if f[0] not in (0x1E1, 0x34A, 0x17D)]
|
||||
frames += [packer.make_can_msg('ESPStatus', 0, {'TractionControlOn': 1}), create_buttons(packer, 0, tick % 4,
|
||||
CruiseButtons.DECEL_SET if tick in (90, 120) else CruiseButtons.RES_ACCEL if tick == 100 else CruiseButtons.UNPRESS),
|
||||
packer.make_can_msg('EBCMWheelSpdRear', 0, {'RLWheelSpd': 60, 'RRWheelSpd': 60, 'RLWheelDir': 1, 'RRWheelDir': 1})]
|
||||
safety.set_timer(now // 1000)
|
||||
for frame in frames:
|
||||
self.assertTrue(native('rx', frame, now // 1000), (tick, frame))
|
||||
safety.safety_tick()
|
||||
state = ci.update([(now, frames)])
|
||||
self.assertFalse(state.buttonEnable, 'Physical SET/RES cannot enable host before PCM acknowledges cruise')
|
||||
self.assertEqual(state.cruiseState.enabled, cruise)
|
||||
self.assertFalse(state.cruiseState.nonAdaptive)
|
||||
card.aol_card_intent.update(state, now_ns=now)
|
||||
safety.set_aol_test_heartbeat(True)
|
||||
safety.aol_set_host_request(1 if card.aol_card_intent.allowed_latch else 0)
|
||||
safety.set_timer(now // 1000 + 1)
|
||||
if tick >= 70:
|
||||
self.assertTrue(state.canValid)
|
||||
self.assertTrue(safety.safety_config_valid())
|
||||
self.assertEqual(bool(safety.aol_get_permission_mask() & 1), main)
|
||||
self.assertEqual(card.aol_card_intent.allowed_latch, main)
|
||||
if tick < 150:
|
||||
self.assertFalse(safety.get_controls_allowed())
|
||||
for button in (CruiseButtons.RES_ACCEL, CruiseButtons.DECEL_SET):
|
||||
self.assertFalse(native('tx', create_buttons(packer, 0, (tick + 1) % 4, button), now // 1000 + 1))
|
||||
control.cruiseControl.cancel = 200 <= tick < 240
|
||||
_, commands = ci.apply(control.as_reader(), now + 2)
|
||||
for address, data, bus in commands:
|
||||
self.assertIn(address, (0x180, 0x1E1))
|
||||
if address == 0x1E1:
|
||||
saw_cancel = True
|
||||
self.assertEqual((data[5] >> 4) & 7, CruiseButtons.CANCEL)
|
||||
self.assertEqual(data[4], tick % 4, 'Stock cancel keeps the physical counter')
|
||||
self.assertTrue(native('tx', (address, data, bus), now // 1000 + 2))
|
||||
self.assertTrue(saw_cancel)
|
||||
safety.set_alternative_experience(0)
|
||||
|
||||
def test_actual_selfdrived_stock_acknowledgment_and_override(self):
|
||||
from openpilot.starpilot.aol.tests.test_ioniq_availability import IoniqAvailabilityTests
|
||||
from openpilot.cereal import log, messaging
|
||||
fixture = IoniqAvailabilityTests()
|
||||
self.addCleanup(fixture.doCleanups)
|
||||
with OpenpilotPrefix():
|
||||
cp = params(CAR.CADILLAC_XT5_CC)
|
||||
prepare_disable_longitudinal(cp, True)
|
||||
sd, _, step = fixture._authority_callers(False, cp=cp, genuine_events=True)
|
||||
ci = CarInterface(cp)
|
||||
packer = CANPacker(DBC[cp.carFingerprint][Bus.pt])
|
||||
safety = libsafety_py.libsafety
|
||||
safety.set_alternative_experience(cp.alternativeExperience)
|
||||
self.assertEqual(safety.set_safety_hooks(structs.CarParams.SafetyModel.gm, 16), 0)
|
||||
safety.init_tests()
|
||||
for tick in range(420):
|
||||
now = 10_000_000_000 + tick * 10_000_000
|
||||
cruise = 150 <= tick < 320
|
||||
brake = 320 <= tick < 350
|
||||
gas = 290 <= tick < 300
|
||||
frames = [f for f in pt_frames(packer, cruise=cruise, brake=brake, gas=gas, counter=tick % 4)
|
||||
if f[0] not in (0x1E1, 0x34A, 0x17D)]
|
||||
button = CruiseButtons.DECEL_SET if tick == 80 else CruiseButtons.RES_ACCEL if tick == 100 else CruiseButtons.UNPRESS
|
||||
frames += [packer.make_can_msg('ESPStatus', 0, {'TractionControlOn': 1}), create_buttons(packer, 0, tick % 4, button),
|
||||
packer.make_can_msg('EBCMWheelSpdRear', 0, {'RLWheelSpd': 60, 'RRWheelSpd': 60, 'RLWheelDir': 1, 'RRWheelDir': 1})]
|
||||
for frame in frames:
|
||||
self.assertTrue(native('rx', frame, (now // 1000) % (2 ** 32)))
|
||||
safety.safety_tick()
|
||||
state = ci.update([(now, frames)])
|
||||
safety.set_aol_test_heartbeat(True)
|
||||
safety.aol_set_host_request(1)
|
||||
safety.set_timer((now // 1000 + 1) % (2 ** 32))
|
||||
mask = safety.aol_get_permission_mask()
|
||||
event = messaging.new_message('carState', valid=True, logMonoTime=now)
|
||||
event.carState = state
|
||||
axis, _, command = step(tick, car_state_message=event, allowed=bool(mask & 1),
|
||||
long_allowed=False, native_request_long=False,
|
||||
panda_controls_allowed=safety.get_controls_allowed())
|
||||
self.assertNotIn(log.OnroadEvent.EventName.controlsMismatch, sd.events.names, tick)
|
||||
self.assertFalse(command.longActive)
|
||||
if tick >= 80:
|
||||
self.assertTrue(command.latActive, (tick, sd.events.names, axis.faultReason))
|
||||
if 80 <= tick < 150:
|
||||
self.assertFalse(sd.enabled, 'SET/RES cannot create ordinary engagement without factory acknowledgment')
|
||||
safety.set_alternative_experience(0)
|
||||
@@ -351,8 +351,8 @@ class TestOrdinaryCc(unittest.TestCase):
|
||||
cp = params(identity)
|
||||
prepare_disable_longitudinal(cp, True)
|
||||
self.assertFalse(cp.openpilotLongitudinalControl)
|
||||
self.assertFalse(cp.pcmCruise)
|
||||
self.assertEqual(cp.safetyConfigs[0].safetyParam, 0xC160)
|
||||
self.assertTrue(cp.pcmCruise)
|
||||
self.assertEqual(cp.safetyConfigs[0].safetyParam, 16)
|
||||
ci = CarInterface(cp)
|
||||
packer = CANPacker(DBC[identity][Bus.pt])
|
||||
control = structs.CarControl(enabled=True, latActive=True, longActive=True)
|
||||
@@ -440,12 +440,12 @@ class TestOrdinaryCc(unittest.TestCase):
|
||||
with OpenpilotPrefix(), patch.dict(os.environ, {'SIMULATION': '1'}):
|
||||
saved = Params()
|
||||
saved.put_bool('OpenpilotEnabledToggle', True, block=True)
|
||||
saved.put_bool('DisableOpenpilotLongitudinal', True, block=True)
|
||||
saved.put_bool('DisableOpenpilotLongitudinal', False, block=True)
|
||||
saved.put_bool('IsMetric', True, block=True)
|
||||
cp = params(identity)
|
||||
ci = CarInterface(cp)
|
||||
card = Car(CI=ci, RI=RadarInterface(cp))
|
||||
self.assertFalse(card.CP.openpilotLongitudinalControl)
|
||||
self.assertTrue(card.CP.openpilotLongitudinalControl)
|
||||
self.assertFalse(card.CP.pcmCruise)
|
||||
self.assertEqual(card.CP.safetyConfigs[0].safetyParam, 0xC160)
|
||||
self.assertTrue(card.volt_cc_selected)
|
||||
|
||||
@@ -1052,6 +1052,20 @@ def is_silverado_cc_stock_profile(cp):
|
||||
ORDINARY_CC_CAR = CC_GATEWAY_STOCK_CAR - {CAR.CHEVROLET_SILVERADO_CC}
|
||||
ORDINARY_CC_WORD = 0xC160
|
||||
|
||||
def is_ordinary_cc_stock_profile(cp):
|
||||
"""Conventional cruise retains the stock owner when speed control is disabled."""
|
||||
try:
|
||||
return (cp.brand == 'gm' and cp.carFingerprint in ORDINARY_CC_CAR and
|
||||
cp.networkLocation == CarParams.NetworkLocation.gateway and
|
||||
cp.transmissionType == CarParams.TransmissionType.automatic and cp.radarUnavailable and
|
||||
cp.pcmCruise and not cp.openpilotLongitudinalControl and not cp.alphaLongitudinalAvailable and
|
||||
not cp.passive and not cp.dashcamOnly and not cp.notCar and control_flags(cp) == 0 and
|
||||
len(cp.safetyConfigs) == 1 and cp.safetyConfigs[0].safetyModel == CarParams.SafetyModel.gm and
|
||||
int(cp.safetyConfigs[0].safetyParam) == int(GMSafetyFlags.NO_ACC))
|
||||
except (AttributeError, IndexError, TypeError, ValueError):
|
||||
return False
|
||||
|
||||
|
||||
MALIBU_CC_F1_WORD = 0xC161
|
||||
MALIBU_CC_F1_STOCK_WORD = 0xC162
|
||||
MALIBU_CC_F1_SOURCES = {0x184: 8, 0x34A: 5, 0x348: 5, 0x1E1: 7, 0xF1: 6, 0x1C4: 8,
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "cbb143d0956d10e004944749c9c2e0bc65f30ee5d8d866beb9f8726185d33bfb", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "87fa3da6cd7a0c160e8a9da74b78a87df0ff2c16f7fe04b13cd7e27ed653d80d", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user