mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-06 20:43:46 +08:00
Restore Volt cruise engagement
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user