mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 09:03:43 +08:00
Require factory SET or RESUME before Kona SE engagement
This commit is contained in:
@@ -417,6 +417,11 @@ class CarState(CarStateBase):
|
||||
ret.buttonEvents = button_events
|
||||
|
||||
ret.blockPcmEnable = not self.recent_button_interaction()
|
||||
if self.CP.carFingerprint == CAR.HYUNDAI_KONA_EV_2023_NON_SCC:
|
||||
set_or_resume = next((not main and button in (Buttons.SET_DECEL, Buttons.RES_ACCEL)
|
||||
for button, main in zip(reversed(self.cruise_buttons), reversed(self.main_buttons), strict=True)
|
||||
if main or button in ENABLE_BUTTONS), False)
|
||||
ret.blockPcmEnable = not set_or_resume or ret.brakePressed or ret.gasPressed
|
||||
|
||||
# low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s)
|
||||
if ret.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.:
|
||||
|
||||
@@ -89,3 +89,19 @@ class TestKonaElectricSE(TestCase):
|
||||
del fp[2][0x421]
|
||||
fp[1][0x329] = 7
|
||||
self.assertIsNone(kona_electric_se_candidate(SE_VIN, fp, firmware))
|
||||
|
||||
def test_only_regular_set_and_resume_allow_pcm_enable(self):
|
||||
from opendbc.can import CANPacker
|
||||
|
||||
for main, button, permitted in ((True, 0, False), (False, 4, False), (True, 2, False),
|
||||
(False, 2, True), (False, 1, True)):
|
||||
with self.subTest(main=main, button=button):
|
||||
ci = interface(SE_VIN)
|
||||
packer = CANPacker('hyundai_can_generated')
|
||||
stamp = 1_000_000_000
|
||||
ci.CS.cruise_buttons.append(button)
|
||||
ci.CS.main_buttons.append(main)
|
||||
active = packer.make_can_msg('LABEL11', 0, {'CC_React': 1, 'CC_Engaged': 1})
|
||||
result = ci.update([(stamp, [active])])
|
||||
self.assertTrue(result.cruiseState.available and result.cruiseState.enabled)
|
||||
self.assertEqual(not result.blockPcmEnable, permitted)
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "cfe68f6e0bd14e793a4c2240add89bf49b6e1dcfdaef8deb731ba3a257a520e1", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "6bf8757a417f15eecccc73d5b571f3c773ffb9ba7b04fa9025a7f3eb28331b1d", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user