mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 05:23:41 +08:00
a82935f326
Integrate onroad views, configurable widgets, local settings, steering-profile contracts, Bluetooth and Android Auto with their device and runtime services. Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Daniel Koepping <elkoled@gmail.com> Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: Shane Smiskol <shane@smiskol.com> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: stef <19478336+stefpi@users.noreply.github.com> Co-authored-by: whoisdomi <dcantu83@gmail.com> Co-authored-by: Intelli <contact@intelli.software> Co-authored-by: pharmacomaniac <blittle65@gmail.com> Co-authored-by: prabhaavp <prabhaav@msu.edu>
52 lines
2.7 KiB
Python
52 lines
2.7 KiB
Python
import unittest
|
|
|
|
from opendbc.car.hyundai.canfd_stock_aol import qualified_long
|
|
from opendbc.car.hyundai.torque_ev_startup import candidate
|
|
from opendbc.car.hyundai.values import CAR, HyundaiFlags
|
|
from openpilot.starpilot.aol.tests.test_canfd_stock_profiles import params
|
|
from openpilot.starpilot.car.hyundai.aol import native_accepts_cp, policy_for
|
|
|
|
|
|
class TestCanfdLongProfiles(unittest.TestCase):
|
|
def test_actual_factory_candidate_and_exact_final_marker(self):
|
|
for identity in (CAR.HYUNDAI_IONIQ_5, CAR.HYUNDAI_KONA_EV_2ND_GEN):
|
|
for alternate in (False, True):
|
|
stock = params(identity, alternate)
|
|
cp = candidate(stock, requested=True, is_release=False)
|
|
self.assertIsNotNone(cp)
|
|
assert cp is not None
|
|
self.assertEqual(cp.safetyConfigs[0].safetyParam, 0x95 if alternate else 0x15)
|
|
self.assertTrue(qualified_long(cp))
|
|
self.assertFalse(qualified_long(cp, marked_only=True))
|
|
policy = policy_for(cp)
|
|
self.assertEqual(policy.safety_param_addition, 0x800)
|
|
self.assertEqual(policy.alternative_experience_addition, 32)
|
|
cp.safetyConfigs[0].safetyParam |= policy.safety_param_addition
|
|
cp.alternativeExperience |= policy.alternative_experience_addition
|
|
self.assertTrue(qualified_long(cp, marked_only=True))
|
|
model = int(cp.safetyConfigs[0].safetyModel.raw)
|
|
self.assertTrue(native_accepts_cp(cp, model, 0x895 if alternate else 0x815))
|
|
self.assertFalse(native_accepts_cp(cp, model, 0x815 if alternate else 0x895))
|
|
self.assertIsNone(candidate(stock, requested=True, is_release=True))
|
|
self.assertIsNone(candidate(stock, requested=False, is_release=False))
|
|
self.assertFalse(qualified_long(stock))
|
|
|
|
def test_identity_topology_axis_and_experience_negatives(self):
|
|
cp = candidate(params(CAR.HYUNDAI_IONIQ_5), requested=True, is_release=False)
|
|
assert cp is not None
|
|
for field, value in (('carFingerprint', CAR.HYUNDAI_IONIQ_6), ('pcmCruise', True),
|
|
('openpilotLongitudinalControl', False), ('passive', True),
|
|
('dashcamOnly', True), ('notCar', True), ('alternativeExperience', 32)):
|
|
bad = cp.as_reader().as_builder()
|
|
setattr(bad, field, value)
|
|
self.assertFalse(qualified_long(bad))
|
|
for flag in (HyundaiFlags.CANFD_ALT_BUTTONS, HyundaiFlags.CANFD_CAMERA_SCC,
|
|
HyundaiFlags.HYBRID, HyundaiFlags.CANFD_ANGLE_STEERING):
|
|
bad = cp.as_reader().as_builder()
|
|
bad.flags = int(bad.flags) | int(flag)
|
|
self.assertFalse(qualified_long(bad))
|
|
for word in (0x11, 0x91, 0x815, 0x895, 0x8015, 0x8815, 0x1815):
|
|
bad = cp.as_reader().as_builder()
|
|
bad.safetyConfigs[0].safetyParam = word
|
|
self.assertFalse(qualified_long(bad))
|