mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 03:03:41 +08:00
Jetlink +tici support in controller
This commit is contained in:
@@ -10,7 +10,7 @@ import os
|
||||
import time
|
||||
|
||||
API = 4 # the jetlink.openpilot API this adapter is written to
|
||||
UNSUPPORTED = "Jetlink requires a comma 3X or comma 4"
|
||||
UNSUPPORTED = "Jetlink requires a comma 3, comma 3X or comma 4"
|
||||
# AOL steers on its own axes, and a paused AOL is still armed: only its intent says so
|
||||
AOL_SERVICES = ("aolIntentWire", "aolAxisState")
|
||||
AOL_AXES = ("desiredLateral", "desiredLongitudinal", "lateralActive", "longitudinalActive")
|
||||
@@ -25,7 +25,7 @@ def supported_device(device_type=None) -> bool:
|
||||
if device_type is None:
|
||||
from openpilot.common.hardware import HARDWARE
|
||||
device_type = HARDWARE.get_device_type()
|
||||
return device_type in ("tizi", "mici")
|
||||
return device_type in ("tici", "tizi", "mici")
|
||||
|
||||
|
||||
def aol_in_control(intent, alive, axes, waiting=False) -> bool:
|
||||
|
||||
@@ -108,7 +108,7 @@ class JetlinkSettings:
|
||||
raise ValueError("Invalid phone charging setting")
|
||||
view = self.snapshot()
|
||||
if payload.get("mode", "off") != "off" and not view["supported"]:
|
||||
raise ValueError("Jetlink requires a comma 3X or comma 4")
|
||||
raise ValueError(UNSUPPORTED)
|
||||
if payload.get("mode", "off") != "off" and view["chestnut"]:
|
||||
raise ValueError("Chestnut is connected; Jetlink cannot run alongside it")
|
||||
if payload.get("mode", "off") != "off" and self._wired_session_running():
|
||||
|
||||
@@ -100,13 +100,13 @@ def test_small_reset_only_for_the_catalog_runner():
|
||||
|
||||
|
||||
def test_unsupported_device():
|
||||
assert adapter.supported_device("tizi")
|
||||
assert adapter.supported_device("mici")
|
||||
for device in ("tici", "pc", "unknown", "neo"):
|
||||
for device in ("tici", "tizi", "mici"):
|
||||
assert adapter.supported_device(device)
|
||||
for device in ("pc", "unknown", "neo"):
|
||||
assert not adapter.supported_device(device)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("device,camera", [("tizi", (1928, 1208)), ("mici", (1344, 760))])
|
||||
@pytest.mark.parametrize("device,camera", [("tici", (1928, 1208)), ("tizi", (1928, 1208)), ("mici", (1344, 760))])
|
||||
def test_jetlink_runs_the_driving_warp_modeld_ships(device, camera):
|
||||
op = adapter.adapter()
|
||||
with patch("openpilot.common.hardware.HARDWARE.get_device_type", return_value=device):
|
||||
|
||||
@@ -73,8 +73,8 @@ class TestJetlinkSettings(unittest.TestCase):
|
||||
self.owner.configure({"mode": "usb"})
|
||||
self.owner.configure({"mode": "off"})
|
||||
self.chestnut = False
|
||||
self.device = "tici"
|
||||
with self.assertRaisesRegex(ValueError, "3X"):
|
||||
self.device = "pc"
|
||||
with self.assertRaisesRegex(ValueError, "requires a comma"):
|
||||
self.owner.configure({"mode": "ios"})
|
||||
self.owner.configure({"mode": "off"})
|
||||
self.device = "mici"
|
||||
|
||||
Reference in New Issue
Block a user