mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-12 07:23:45 +08:00
Enable Enhanced Stops by default on new installs
This commit is contained in:
@@ -84,7 +84,7 @@ from openpilot.starpilot.controllers.toyota_cruise import capability as toyota_c
|
||||
GLOBAL_BOOL_PREFERENCES = frozenset((LEAD_APPROACH_KEY, LEAD_TAKEOFF_KEY, NUDGE_KEY, "DisengageOnAccelerator"))
|
||||
|
||||
BOOL_DEFAULTS = {
|
||||
"GMPedalLongitudinal": False, "ForceStops": False, "AlwaysAllowUploads": False, "TurnAssist": True,
|
||||
"GMPedalLongitudinal": False, "ForceStops": True, "AlwaysAllowUploads": False, "TurnAssist": True,
|
||||
"SubaruAvhStartup": False,
|
||||
"SubaruStopStartOff": False,
|
||||
"SubaruSNG": False,
|
||||
|
||||
@@ -78,7 +78,7 @@ def manager_init() -> None:
|
||||
for k in params.all_keys():
|
||||
if k == b"LKASButtonControl":
|
||||
continue # Card enrolls the vehicle-specific default after identification.
|
||||
default_value = not os.path.lexists(params.get_param_path("Version")) if k == b"LaneCentering" else params.get_default_value(k)
|
||||
default_value = not os.path.lexists(params.get_param_path("Version")) if k in (b"LaneCentering", b"ForceStops") else params.get_default_value(k)
|
||||
if default_value is not None and not os.path.lexists(params.get_param_path(k)):
|
||||
params.put(k, default_value, block=True)
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import ast
|
||||
import os
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from openpilot.common.params import Params
|
||||
|
||||
|
||||
class TestEnhancedStopsDefaults(unittest.TestCase):
|
||||
def test_typed_enrollment_preserves_existing_choices(self):
|
||||
source = Path(__file__).resolve().parents[1] / "manager.py"
|
||||
tree = ast.parse(source.read_text())
|
||||
loop = next(node for node in ast.walk(tree) if isinstance(node, ast.For) and
|
||||
ast.unparse(node.iter) == "params.all_keys()")
|
||||
code = compile(ast.fix_missing_locations(ast.Module(body=[loop], type_ignores=[])), str(source), "exec")
|
||||
for upgrade in (False, True):
|
||||
for saved in (None, b"0", b"1", b"malformed"):
|
||||
with self.subTest(upgrade=upgrade, saved=saved), tempfile.TemporaryDirectory() as root:
|
||||
params = Params(root)
|
||||
if upgrade:
|
||||
params.put("Version", "7.0", block=True)
|
||||
path = Path(params.get_param_path("ForceStops"))
|
||||
if saved is not None:
|
||||
path.write_bytes(saved)
|
||||
exec(code, {"params": params, "os": os})
|
||||
self.assertEqual(path.read_bytes(), saved if saved is not None else b"0" if upgrade else b"1")
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "26ffbe8157fb1f59f9cdf5141380ff040e251450435acd02ac0dfe08c5bffe4f", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "29623ab48d26c161d75502f9ddeeb5cf416cc2f4e5bdafa8243660fadf9c4e96", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user