Restore Volt cruise engagement

This commit is contained in:
firestar5683
2026-10-07 02:38:46 -05:00
parent e58a905e07
commit 6affbf97eb
3 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -502,7 +502,8 @@ class CarState(CarStateBase):
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
is_ordinary_cc_profile(self.CP) or is_conventional_cc_pedal_profile(self.CP))
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:
ret.accFaulted = False
ret.cruiseState.enabled = bool(pt_cp.vl["ECMCruiseControl"]["CruiseActive"])
@@ -569,6 +570,7 @@ class CarState(CarStateBase):
ret.stockFcw = self.stock_fcw_alert != 0
if self.volt_cc_pedal_profile is not None:
ret.cruiseState.nonAdaptive = False
ret.brakePressed = bool(pt_cp.vl["ECMEngineStatus"]["BrakePressed"])
ret.accFaulted = False # ACC status is not a conventional-cruise fault source.
ret.cruiseState.enabled = bool(pt_cp.vl["ECMCruiseControl"]["CruiseActive"])
@@ -33,6 +33,11 @@ class TestVoltCcGas(unittest.TestCase):
for source in sources:
native('rx', source, now // 1000)
self.assertTrue(out.canValid)
self.assertFalse(out.cruiseState.nonAdaptive)
from openpilot.selfdrive.car.car_events import CarEvents
from openpilot.cereal import log
events = CarEvents(cp).update(out, structs.CarState(), structs.CarControl())
self.assertNotIn(log.OnroadEvent.EventName.wrongCruiseMode, events.names)
return cp, ci, packer, now
@staticmethod
@@ -715,6 +715,7 @@ class TestVoltCcPedalProfiles(unittest.TestCase):
self.assertIsNotNone(volt_cc_pedal_profile(cp))
def test_actual_parser_keeps_cc_engagement_and_pedal_telemetry_distinct(self):
from openpilot.selfdrive.car.car_events import CarEvents, EventName
from itertools import product
from opendbc.can import CANPacker, CANParser
from opendbc.car import Bus
@@ -762,6 +763,9 @@ class TestVoltCcPedalProfiles(unittest.TestCase):
self.assertTrue(state.canValid)
self.assertTrue(state.cruiseState.enabled)
self.assertAlmostEqual(state.cruiseState.speed, 80 / 3.6, places=4)
self.assertFalse(state.cruiseState.nonAdaptive)
events = CarEvents(cp).update(state.as_reader(), structs.CarState().as_reader(), command.as_reader())
self.assertNotIn(EventName.wrongCruiseMode, events.names)
self.assertFalse(state.accFaulted)
if release:
self.assertFalse(any(a == 0x200 for a, _, _ in tx))