diff --git a/CREDITS.md b/CREDITS.md index 9faa38b618..1a24599ac0 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -49,3 +49,7 @@ The explicit StarPilot [jacobw Subaru adapter](opendbc_repo/opendbc/car/subaru/J The previous optional StarPilot Controller, formerly in `openpilot/starpilot/car/ford/starpilot_tuning.py`, restored demand tuning from StarPilot `8da0c9d916^`, descended from BluePilot bp-7.0 `e1d051d7ba270261b4455068bd68f1a58db15a4a` through StarPilot `2efe6017bfe14cee4807833e05f9a7f6ba255cdb`. Contributors to that lineage include Alan Polk, John Christman, Jacob Neulight, tonesto7 and Haibin Wen. The current protocol adapter is maintained by StarPilot separately from the pinned BluePilot library; this attribution does not imply BluePilot maintains or endorses the adapted tune. The current StarPilot Controller replaces that historical curvature-primary tune with a separately maintained adaptation of BluePilot v0.2.1's angle strategy (`2b9dc6cc784faac47a1885d0bda0561f7b76f74d`, `core/lateral_angle_ext.py`). Alan Polk is the principal controller author; John Christman contributed angle-mode anti-stall work, Jacob Neulight the pinion/shadow measurement, Nathan Ingraham and Praeuner high-speed damping, and other contributors are retained in the pinned library's `CREDITS.md`. StarPilot adds bounded small-signal conditioning ahead of the unchanged angle limit chain. This adaptation is not maintained or endorsed by BluePilot; the pinned library and its imported hooks are unchanged. + +## Uniden radar detector link + +The Uniden detector link builds on **inauner's** earlier Uniden R4/R8/R9 work in [inauner/StarPilot, uniden](https://github.com/inauner/StarPilot/tree/c4b694b2ac8742ddec44123d53f1f84d2990b47e) (`uniden_protocol.py`, `uniden_r4.py`, `uniden_radar_d.py`, the Galaxy Uniden panel and the radar alert banner), which established the detector's BLE alert flow and the Galaxy/UI integration approach. This branch's monitor, transport, widgets and tests are a separate implementation on the current StarPilot Bluetooth owner; the experimental settings and speed-limit slowdown logic are not included. The alert parser and command framing are based on AegisX86/UnidenR8wlink (see THIRD_PARTY_NOTICES.md). diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 7824526215..8e22925790 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -154,3 +154,7 @@ The Subaru angle implementation includes work from Jacob Waller's `jul-angle-bas The historical tuning formerly in `openpilot/starpilot/car/ford/starpilot_tuning.py` included the BluePilot bp-7.0-derived work identified in [CREDITS.md](CREDITS.md#starpilot-ford-demand-tuning). The published upstream license notices retained above and in the pinned BluePilot library remain applicable to the adapted source. StarPilot's separate protocol adapter does not modify those notices or resolve their scope. The angle-primary adaptation in `openpilot/starpilot/car/ford/starpilot_controller.py` is derived from BluePilot v0.2.1. It retains the complete MIT copyright and permission notice in `opendbc_repo/opendbc/bluepilot_lateral/LICENSE`, including Comma.ai, BluePilot and StarPilot contributors. See the contributor attribution in `CREDITS.md`. + +## Uniden detector protocol + +The detector alert parser and command framing in `openpilot/starpilot/uniden/` are based on [AegisX86/UnidenR8wlink](https://github.com/AegisX86/UnidenR8wlink)'s MIT-licensed protocol documentation, copyright (c) 2026 Aegis "P.R Aigis". The complete notice is retained in [UPSTREAM-LICENSE](openpilot/starpilot/uniden/UPSTREAM-LICENSE). diff --git a/openpilot/common/libcommon.a b/openpilot/common/libcommon.a index 8e80bfd4d0..2d6cdb2c91 100644 Binary files a/openpilot/common/libcommon.a and b/openpilot/common/libcommon.a differ diff --git a/openpilot/common/libparams_c.so b/openpilot/common/libparams_c.so index 7776f1a8cb..dbaac48a59 100755 Binary files a/openpilot/common/libparams_c.so and b/openpilot/common/libparams_c.so differ diff --git a/openpilot/common/params_keys.h b/openpilot/common/params_keys.h index 6e89643124..931710b49c 100644 --- a/openpilot/common/params_keys.h +++ b/openpilot/common/params_keys.h @@ -136,6 +136,7 @@ inline static std::unordered_map keys = { {"LaneCenterOffset", {PERSISTENT, FLOAT, "0.0"}}, {"LaneCenteringE2EAuthority", {PERSISTENT, FLOAT, "0.5"}}, {"LaneCenteringStrength", {PERSISTENT, FLOAT, "1.5"}}, + {"UnidenConfig", {PERSISTENT | DONT_LOG, JSON}}, {"StarPortEnabled", {PERSISTENT | DONT_LOG, BOOL, "0"}}, {"AdvancedLateralTune", {PERSISTENT, BOOL}}, {"LateralControllerSelection", {PERSISTENT | DONT_LOG, JSON}}, diff --git a/openpilot/selfdrive/ui/ui.py b/openpilot/selfdrive/ui/ui.py index f9f9819ac2..037626cbfd 100755 --- a/openpilot/selfdrive/ui/ui.py +++ b/openpilot/selfdrive/ui/ui.py @@ -29,6 +29,7 @@ def update_frame(preview=None, controllers=None, star=None, game_mode=None, arab star._poll_projection_bookmark(time.monotonic_ns()) star._poll_projection_slc(time.monotonic_ns()) poll_screen_off_wheel(star, device.awake, time.monotonic_ns()) + star._poll_detector() if game_mode is not None: game_mode() if controllers is not None: diff --git a/openpilot/starpilot/bluetooth/owner.py b/openpilot/starpilot/bluetooth/owner.py index bcb1359423..16c2fd0a86 100644 --- a/openpilot/starpilot/bluetooth/owner.py +++ b/openpilot/starpilot/bluetooth/owner.py @@ -45,6 +45,9 @@ def set_device_class(major: int, minor: int) -> bool: BLUEZ = 'org.bluez' ADAPTER = 'org.bluez.Adapter1' DEVICE = 'org.bluez.Device1' +# BlueZ Connect failures that mean the device never answered. +UNREACHABLE_ERRORS = ('org.bluez.Error.Failed', 'org.bluez.Error.NotAvailable', 'org.bluez.Error.NotReady', + 'org.bluez.Error.ConnectionAttemptFailed', 'org.bluez.Error.BREDR.ProfileUnavailable') AGENT = 'org.bluez.Agent1' AGENT_PATH = '/org/starpilot/bluetooth/pairing' ADMISSION_LOCK = Path('/data/starpilot/bluetooth-owner.lock') @@ -294,8 +297,18 @@ class BlueZ: path = self._device_path(address) if operation == 'forget': self._call(adapter_path, ADAPTER, 'RemoveDevice', 'o', (path,)) - elif operation in ('connect', 'disconnect'): - self._call(path, DEVICE, operation.capitalize()) + elif operation == 'connect': + try: + self._call(path, DEVICE, 'Connect') + except TimeoutError: + raise BluetoothRejected('Device did not respond', code='unreachable') from None + except BluetoothRejected as error: + # Off, out of range or held by another phone/app; not a changed device. + if str(error) in UNREACHABLE_ERRORS: + raise BluetoothRejected(f'Device did not respond ({error})', code='unreachable') from None + raise + elif operation == 'disconnect': + self._call(path, DEVICE, 'Disconnect') else: raise ValueError('Unsupported Bluetooth operation') @@ -583,6 +596,7 @@ class BluetoothOwner: self.admission_lock = admission_lock self.admission_file = None self.power_change_active = False + self.uniden: Any = None def _admission_enter(self) -> None: if self.admission_file is not None: @@ -951,6 +965,7 @@ class BluetoothOwner: self._client().operation(operation, address) if operation == 'forget': assert address is not None + self.uniden = None self._forget_starport_car(address) if operation == 'power' and not enabled: self.systemctl(['sudo', '-n', 'systemctl', 'stop', RADIO_UNIT], check=True, timeout=15) diff --git a/openpilot/starpilot/bluetooth/tests/test_owner.py b/openpilot/starpilot/bluetooth/tests/test_owner.py index 24fdba0d4a..a56bccf70a 100644 --- a/openpilot/starpilot/bluetooth/tests/test_owner.py +++ b/openpilot/starpilot/bluetooth/tests/test_owner.py @@ -838,6 +838,32 @@ class BluetoothOwnerTest(unittest.TestCase): bluez.snapshot() self.assertIn('Set', calls) + + def test_connect_to_silent_device_reports_unreachable_not_changed(self): + bluez = BlueZ.__new__(BlueZ) + objects = { + '/org/bluez/hci0': {'org.bluez.Adapter1': {'Powered': ('b', True)}}, + '/org/bluez/hci0/dev_AA_BB_CC_DD_EE_FF': {'org.bluez.Device1': {'Address': ('s', 'AA:BB:CC:DD:EE:FF'), 'Paired': ('b', True)}}, + } + failure = [] + + def call(path, interface, member, signature=None, body=()): + if member == 'GetManagedObjects': + return (objects,) + raise failure[0] + + self.enterContext(patch.object(bluez, '_call', call)) + for error, code in [(BluetoothRejected('org.bluez.Error.Failed'), 'unreachable'), (TimeoutError(), 'unreachable'), + (BluetoothRejected('org.bluez.Error.NotAuthorized'), 'changed')]: + failure[:] = [error] + with self.assertRaises(BluetoothRejected) as raised: + bluez.operation('connect', 'AA:BB:CC:DD:EE:FF') + self.assertEqual(raised.exception.code, code) + failure[:] = [BluetoothRejected('org.bluez.Error.Failed')] + with self.assertRaises(BluetoothRejected) as raised: + bluez.operation('disconnect', 'AA:BB:CC:DD:EE:FF') + self.assertEqual(raised.exception.code, 'changed') + def test_each_bluez_close_releases_router_and_underlying_connection(self): closed = [] diff --git a/openpilot/starpilot/galaxy/server.py b/openpilot/starpilot/galaxy/server.py index eee9fa374d..a13753b455 100644 --- a/openpilot/starpilot/galaxy/server.py +++ b/openpilot/starpilot/galaxy/server.py @@ -254,6 +254,8 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe plots_lock = threading.Lock() bluetooth_lock = threading.Lock() bluetooth_source = bluetooth + uniden_source = None + uniden_lock = threading.Lock() starport_setup_source = starport_setup spotify_setup_source = spotify_setup starport_client_source = starport_client @@ -390,6 +392,15 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe link_music_phone(address) spotify_owner().adopt_phone(address, name, uuids) + def uniden_owner(): + nonlocal uniden_source + with uniden_lock: + if uniden_source is None: + from openpilot.common.params import Params + from openpilot.starpilot.uniden.service import DetectorService + uniden_source = DetectorService(Params(), configuration_allowed) + return uniden_source + def bluetooth_owner(): nonlocal bluetooth_source with bluetooth_lock: @@ -1737,7 +1748,7 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe '/api/spotify/enable', '/api/spotify/key', '/api/spotify/preferences', '/api/spotify/control', '/api/spotify/maintenance', '/api/ui/layout', '/api/ui/layout/preview', '/api/favorites/slots', '/api/maps/start', '/api/maps/cancel', - '/api/bluetooth/action', '/api/controllers/action', + '/api/bluetooth/action', '/api/bluetooth/uniden', '/api/controllers/action', '/api/models/active', '/api/models/preferences', '/api/models/download', '/api/models/download_all', '/api/models/cancel', '/api/models/delete', '/api/models/refresh_manifest', '/api/models/jetlink', '/api/models/laboratory', '/api/models/laboratory/download', '/api/models/laboratory/delete', @@ -2811,6 +2822,45 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe else: self.json(401, {'error': 'Sign in to Galaxy'}) return + if path == '/api/bluetooth/uniden': + identity = self.settings_session() + if identity is None: + self.json(401, {'error': 'Sign in to Galaxy'}) + return + def detector_exchange(config, mute, situation=None): + from openpilot.starpilot.uniden.transport import exchange + if self.settings_session() != identity: + raise BluetoothRejected('Session expired', code='session_expired') + if starport_setup_owner().enabled(): + try: + delegated = self.starport_command(identity, 'uniden', address=config['address'], model=config['model'], mute=mute, + auto_mute=config['auto_mute'], frequency_rules=config['frequency_rules'], + situation=situation) + except (OSError, RuntimeError): + if mute is not None: + raise BluetoothUnavailable('Mute delivery was not confirmed; check the detector') from None + delegated = {'handled': False} # Local admission still fails if AA owns the lock. + if delegated.get('handled'): + if 'error_code' in delegated: + message, code = delegated.get('message'), delegated['error_code'] + raise BluetoothRejected(message if isinstance(message, str) else 'Bluetooth is busy', code=code if isinstance(code, str) else 'busy') + return delegated['detector'] + return exchange(bluetooth_owner(), config['address'], config['model'], identity, mute=mute, + auto_mute=config['auto_mute'], frequency_rules=config['frequency_rules'], situation=situation) + try: + result = uniden_owner().request(payload, detector_exchange, valid=lambda: self.settings_session() == identity) + except ValueError as error: + self.json(400, {'error': str(error)}) + except BluetoothRejected as error: + self.json(409, {'error': str(error), 'code': error.code}) + except (BluetoothUnavailable, OSError, RuntimeError): + self.json(503, {'error': 'Detector connection unavailable'}) + else: + if self.settings_session() == identity: + self.json(200, result) + else: + self.json(401, {'error': 'Sign in to Galaxy'}) + return if path == '/api/bluetooth/action': identity = self.settings_session() if identity is None: @@ -2858,8 +2908,10 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe raise BluetoothUnavailable('service_unavailable') if 'error_code' in delegated: code = delegated['error_code'] - if type(code) is str and code in ('busy', 'park_required', 'changed', 'session_expired', 'projection_active'): - raise BluetoothRejected('Android Auto could not complete the Bluetooth change', code=code) + if type(code) is str and code in ('busy', 'park_required', 'changed', 'session_expired', 'projection_active', 'unreachable'): + why = delegated.get('message') + raise BluetoothRejected(f'Android Auto: {why}' if type(why) is str and why else + 'Android Auto could not complete the Bluetooth change', code=code) unavailable = ('service_unavailable', 'adapter_unavailable', 'radio_unavailable', 'radio_preference_unavailable') raise BluetoothUnavailable('Android Auto Bluetooth service is unavailable', code=code if type(code) is str and code in unavailable else 'service_unavailable') diff --git a/openpilot/starpilot/galaxy/test_projection_bluetooth_http.py b/openpilot/starpilot/galaxy/test_projection_bluetooth_http.py index 20b7458fec..357c03f6e5 100644 --- a/openpilot/starpilot/galaxy/test_projection_bluetooth_http.py +++ b/openpilot/starpilot/galaxy/test_projection_bluetooth_http.py @@ -217,7 +217,7 @@ class ProjectionBluetoothHttpTest(unittest.TestCase): self.assertEqual(self.action('connect')[0], 503) def test_owner_busy_and_error_codes_never_fall_back(self): - for error, code in [('busy', 409), ('park_required', 409), ('changed', 409), ('service_unavailable', 503)]: + for error, code in [('busy', 409), ('park_required', 409), ('changed', 409), ('unreachable', 409), ('service_unavailable', 503)]: self.starport.result = {'handled': True, 'error_code': error} actual, result, _ = self.action() self.assertEqual(actual, code) diff --git a/openpilot/starpilot/galaxy/tests/browser/bluetooth-organization.cjs b/openpilot/starpilot/galaxy/tests/browser/bluetooth-organization.cjs new file mode 100644 index 0000000000..701bb34ca4 --- /dev/null +++ b/openpilot/starpilot/galaxy/tests/browser/bluetooth-organization.cjs @@ -0,0 +1,120 @@ +const { chromium } = require(process.env.PLAYWRIGHT_MODULE || 'playwright') +const { readFileSync } = require('node:fs') +const path = require('node:path') +const assert = require('node:assert/strict') +const web = path.resolve(__dirname, '../../web') +const detector = { name: 'Uniden R8', address: 'AA:BB:CC:DD:EE:FF', paired: true, trusted: true, connected: true } +const status = { version: 1, available: true, parked: true, powered: true, discovering: false, errorCode: null, pairing: null, + devices: [detector, { name: 'Steering remote', address: '11:22:33:44:55:66', paired: true, trusted: true, connected: false }] } +let config = { enabled: false, address: '', model: 'R8', transparency: 8, hide_when_no_alert: true, + auto_mute: false, hide_filtered: false, frequency_rules: [] } +const controller = { version: 1, available: true, editable: true, enabled: false, valid: true, + revision: 'a'.repeat(64), devices: [], slots: Array.from({ length: 13 }, (_, index) => ({ index, + label: index < 3 ? `Quick Select ${index + 1}` : `Button ${index - 2}`, key: null, available: index < 3 })), + options: [], bindings: [], learning: null, testing: false, lastPress: null } +;(async () => { + const browser = await chromium.launch({ headless: true, + ...(process.env.PLAYWRIGHT_EXECUTABLE_PATH ? { executablePath: process.env.PLAYWRIGHT_EXECUTABLE_PATH } : {}) }) + try { + const page = await browser.newPage({ viewport: { width: 390, height: 844 } }) + const errors = [], requests = [], actions = [] + page.on('pageerror', error => errors.push(error.message)) + await page.route('http://bluetooth.test/**', async route => { + const pathname = new URL(route.request().url()).pathname + requests.push(pathname) + if (pathname === '/api/bluetooth/action') { + const body = route.request().postDataJSON(); actions.push(body) + const device = status.devices.find(device => device.address === body.address) + if (device && ['connect', 'disconnect'].includes(body.operation)) device.connected = body.operation === 'connect' + if (body.operation === 'forget') status.devices = status.devices.filter(device => device.address !== body.address) + if (body.operation === 'scan') status.discovering = true + if (body.operation === 'stop_scan') status.discovering = false + return route.fulfill({ json: status }) + } + if (pathname === '/api/bluetooth/status') return route.fulfill({ json: status }) + if (pathname === '/api/controllers/status') return route.fulfill({ json: controller }) + if (pathname === '/api/bluetooth/uniden') { + const body = route.request().postDataJSON() + if (body.operation === 'configure') config = body.config + return route.fulfill({ json: { config, connected: config.enabled, alerts: [] } }) + } + if (pathname === '/') return route.fulfill({ contentType: 'text/html', body: ` + +
` }) + return route.fulfill({ body: readFileSync(path.join(web, pathname)), + contentType: pathname.endsWith('.js') ? 'text/javascript' : pathname.endsWith('.css') ? 'text/css' : 'application/octet-stream' }) + }) + await page.goto('http://bluetooth.test/') + await page.getByRole('button', { name: 'Add a device', exact: true }).waitFor() + assert.equal(requests.includes('/api/controllers/status'), false) + assert.equal(requests.includes('/api/bluetooth/uniden'), false) + assert.equal(await page.getByRole('button', { name: 'Pair phone', exact: true }).count(), 0) + assert.equal(await page.getByRole('button', { name: 'Learn Button' }).count(), 0) + assert.equal(await page.getByText(detector.address, { exact: true }).isVisible(), false) + for (const theme of ['dark', 'light']) { + await page.locator('html').evaluate((el, theme) => el.dataset.theme = theme, theme) + for (const width of [390, 1280]) { + await page.setViewportSize({ width, height: 844 }) + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true) + await page.screenshot({ path: `/tmp/bluetooth-${theme}-${width}.png`, fullPage: true }) + } + } + await page.getByRole('button', { name: 'Add a device', exact: true }).click() + await page.getByRole('button', { name: 'Pair phone', exact: true }).waitFor() + await page.getByRole('button', { name: 'Search', exact: true }).click() + await page.getByRole('button', { name: 'Stop search', exact: true }).waitFor() + await page.getByRole('button', { name: 'Done', exact: true }).click() + await page.getByRole('button', { name: 'Add a device', exact: true }).waitFor() + assert.deepEqual(actions.map(action => action.operation), ['scan', 'stop_scan']) + await page.getByRole('button', { name: /^StarPort/ }).click() + assert.equal(await page.evaluate(() => window.app.path), '/starport') + assert.equal(actions.length, 2) + await page.evaluate(() => window.app.go('/bluetooth')) + await page.getByRole('button', { name: /^Uniden/ }).click() + await page.getByLabel('Uniden detector').selectOption(detector.address) + await page.getByRole('button', { name: 'Use this detector' }).click() + await page.getByRole('switch', { name: 'Automatically mute matching frequencies' }).waitFor() + assert.equal(await page.getByRole('button', { name: 'Pair phone' }).count(), 0) + assert.equal(await page.getByRole('button', { name: 'Search', exact: true }).count(), 0) + await page.evaluate(() => window.app.go('/bluetooth')) + await page.getByRole('button', { name: /^Controllers/ }).click() + await page.getByRole('heading', { name: 'Controllers', exact: true }).waitFor() + await page.getByRole('link', { name: 'pair in Bluetooth', exact: true }).waitFor() + assert.equal(await page.getByRole('button', { name: 'Pair phone' }).count(), 0) + assert.equal(await page.getByRole('button', { name: 'Search', exact: true }).count(), 0) + await page.evaluate(() => window.app.go('/bluetooth')) + await page.getByRole('button', { name: 'Add a device', exact: true }).waitFor() + const detectorRow = page.locator('.gx-bluetooth__device').filter({ hasText: 'Uniden R8' }) + assert.equal(await detectorRow.locator('summary').count(), 0) + await detectorRow.getByRole('button', { name: 'Disconnect', exact: true }).click() + await detectorRow.getByRole('button', { name: 'Connect', exact: true }).click() + await detectorRow.getByRole('button', { name: 'Disconnect', exact: true }).waitFor() + const remoteRow = page.locator('.gx-bluetooth__device').filter({ hasText: 'Steering remote' }) + await remoteRow.getByRole('button', { name: 'Forget', exact: true }).click() + const dialog = page.getByRole('alertdialog') + await dialog.getByRole('button', { name: 'Cancel', exact: true }).click() + assert.equal(actions.some(action => action.operation === 'forget'), false) + await remoteRow.getByRole('button', { name: 'Forget', exact: true }).click() + await dialog.getByRole('button', { name: 'Forget', exact: true }).click() + await dialog.getByRole('button', { name: 'Done', exact: true }).click() + assert.equal(await remoteRow.count(), 0) + assert.deepEqual(actions.slice(-3), [ + { operation: 'disconnect', address: detector.address }, + { operation: 'connect', address: detector.address }, + { operation: 'forget', address: '11:22:33:44:55:66' }, + ]) + status.parked = false + await page.evaluate(() => window.app.$refs.bluetooth.refresh()) + assert.equal(await page.getByRole('button', { name: 'Add a device', exact: true }).isDisabled(), true) + assert.equal(await detectorRow.getByRole('button', { name: 'Disconnect', exact: true }).isDisabled(), true) + assert.equal(await detectorRow.getByRole('button', { name: 'Forget', exact: true }).isDisabled(), true) + assert.deepEqual(errors, []) + console.log('Bluetooth tabs, shared pairing, device rows, StarPort link, Uniden selection and standalone controllers passed') + } finally { await browser.close() } +})().catch(error => { console.error(error); process.exitCode = 1 }) diff --git a/openpilot/starpilot/galaxy/tests/browser/uniden.cjs b/openpilot/starpilot/galaxy/tests/browser/uniden.cjs new file mode 100644 index 0000000000..9dbf43b034 --- /dev/null +++ b/openpilot/starpilot/galaxy/tests/browser/uniden.cjs @@ -0,0 +1,88 @@ +const { chromium } = require(process.env.PLAYWRIGHT_MODULE || 'playwright') +const { readFileSync } = require('node:fs') +const path = require('node:path') +const assert = require('node:assert/strict') +const web = path.resolve(__dirname, '../../web') +let config = { enabled: false, address: '', model: 'R8', auto_mute: false, hide_filtered: false, hide_below_limit: false, + hide_q_ride: false, hide_mute_memory: false, frequency_rules: [], quiet_ride: false, quiet_margin: 0, quiet_bands: ['X', 'K'], + auto_learn: false, learn_bands: ['X', 'K'], border_bands: ['KA', 'LASER'], border_colors: { KA: 'coral', K: 'amber', LASER: 'coral' }, + border_edge: { line: true, dashes: true, glow: false, veil: false, chevrons: true }, border_muted_percent: 50, + timed_mute: false, timed_mute_seconds: 5, timed_mute_strength: 6, timed_mute_bands: ['X', 'K', 'KA'], + timed_mute_settings: { X: { seconds: 5, strength: 6 }, K: { seconds: 5, strength: 6 }, KA: { seconds: 5, strength: 6 } } } +let connection = null +;(async () => { + const browser = await chromium.launch({ headless: true, + ...(process.env.PLAYWRIGHT_EXECUTABLE_PATH ? { executablePath: process.env.PLAYWRIGHT_EXECUTABLE_PATH } : {}) }) + try { + const page = await browser.newPage({ viewport: { width: 390, height: 844 } }) + const errors = [] + page.on('pageerror', error => errors.push(error.message)) + await page.route('http://uniden.test/**', async route => { + const pathname = new URL(route.request().url()).pathname + if (pathname === '/api/bluetooth/uniden') { + const body = route.request().postDataJSON() + if (body.operation === 'configure') config = body.config + return route.fulfill({ json: { config, connected: !!config.enabled, alerts: [], locks: [], candidates: [], learning: [], metric: false, ...(connection || {}) } }) + } + if (pathname === '/') return route.fulfill({ contentType: 'text/html', body: ` + +
` }) + return route.fulfill({ body: readFileSync(path.join(web, pathname)), + contentType: pathname.endsWith('.js') ? 'text/javascript' : pathname.endsWith('.css') ? 'text/css' : 'application/octet-stream' }) + }) + await page.goto('http://uniden.test/') + await page.getByLabel('Uniden detector').selectOption('AA:BB:CC:DD:EE:FF') + await page.getByRole('button', { name: 'Use this detector' }).click() + await page.getByRole('link', { name: 'Uniden settings' }).waitFor() + assert.equal(config.enabled, true) + assert.equal(await page.getByRole('button', { name: 'Use this detector' }).count(), 0) + await page.evaluate(() => window.panel.settings = true) + await page.getByRole('switch', { name: 'Automatically mute matching frequencies' }).check() + await page.getByRole('switch', { name: 'Hide lockouts and frequency rules' }).check() + await page.getByRole('button', { name: 'Rules', exact: true }).click() + await page.getByRole('button', { name: 'Add frequency' }).click() + await page.getByLabel('Label', { exact: true }).fill('Head unit') + await page.getByRole('button', { name: 'Save changes' }).click() + await page.getByRole('status').filter({ hasText: /^Saved$/ }).waitFor() + assert.equal(config.frequency_rules[0].frequency, 34.313) + assert.equal(config.auto_mute, true) + await page.reload() + await page.getByRole('link', { name: 'Uniden settings' }).waitFor() + await page.evaluate(() => window.panel.settings = true) + await page.getByRole('button', { name: 'Rules', exact: true }).click() + assert.equal(await page.getByLabel('Label', { exact: true }).inputValue(), 'Head unit') + for (const theme of ['dark', 'light']) { + await page.locator('html').evaluate((el, theme) => el.dataset.theme = theme, theme) + for (const width of [390, 1280]) { + await page.setViewportSize({ width, height: 844 }) + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true) + await page.screenshot({ path: `/tmp/uniden-${theme}-${width}.png`, fullPage: true }) + } + } + await page.getByLabel('Frequency (GHz)').fill('34.315') + for (const error of ['org.bluez.Error.Failed', 'Waiting to reconnect detector']) { + connection = { connected: false, connection_state: 'reconnecting', error } + await page.evaluate(() => window.panel.$refs.panel.refresh()) + await page.getByText('Reconnecting', { exact: true }).waitFor() + assert.equal(await page.getByText(error, { exact: true }).count(), 0) + assert.equal(await page.getByLabel('Frequency (GHz)').inputValue(), '34.315') + } + connection = null + await page.evaluate(() => window.panel.$refs.panel.refresh()) + await page.getByText('Connected', { exact: true }).waitFor() + await page.getByRole('button', { name: 'Discard changes' }).click() + assert.equal(await page.getByLabel('Frequency (GHz)').inputValue(), '34.313') + await page.evaluate(() => window.panel.parked = false) + await page.getByRole('button', { name: 'Preferences', exact: true }).click() + assert.equal(await page.getByRole('switch', { name: 'Enable Uniden integration' }).isDisabled(), true) + await page.evaluate(() => window.panel.devices = []) + await page.getByRole('link', { name: 'Pair in Bluetooth' }).waitFor() + assert.equal(await page.getByRole('button', { name: 'Add frequency' }).count(), 0) + assert.deepEqual(errors, []) + console.log('Uniden setup, saved state, rules, reload, discard, paired/parked gating and responsive layouts passed') + } finally { await browser.close() } +})().catch(error => { console.error(error); process.exitCode = 1 }) diff --git a/openpilot/starpilot/galaxy/tests/test_bluetooth_stability.mjs b/openpilot/starpilot/galaxy/tests/test_bluetooth_stability.mjs index 02c8583a11..6b6f11bc89 100644 --- a/openpilot/starpilot/galaxy/tests/test_bluetooth_stability.mjs +++ b/openpilot/starpilot/galaxy/tests/test_bluetooth_stability.mjs @@ -17,7 +17,7 @@ function harness(fetcher, unauthorized = () => {}) { test('first-load connection errors render without accessing missing adapter state', () => { const render = compile(BluetoothPage.template, {decodeEntities: value => value}); - const vm = {...BluetoothPage.data(), mode:'local', error:'Connection interrupted', unauthorized() {}}; + const vm = {...BluetoothPage.data(), mode:'local', unidenSettings: false, go() {}, error:'Connection interrupted', unauthorized() {}}; for (const [key, getter] of Object.entries(BluetoothPage.computed)) { Object.defineProperty(vm, key, {get: () => getter.call(vm)}); } diff --git a/openpilot/starpilot/galaxy/tests/test_controllers.mjs b/openpilot/starpilot/galaxy/tests/test_controllers.mjs index fa70173c57..9cf465608c 100644 --- a/openpilot/starpilot/galaxy/tests/test_controllers.mjs +++ b/openpilot/starpilot/galaxy/tests/test_controllers.mjs @@ -14,7 +14,9 @@ assert.equal(validControllersStatus({ ...status(), slots: status().slots.slice(1 assert.equal(validControllersStatus({ ...status(), options: [{ key: "x\n", label: "Bad", section: "Display" }] }), false) assert.equal(validControllersStatus({ ...status(), lastPress: { deviceId: "hardware-1", code: 65551, slot: null, executed: false, message: "Test press detected" } }), true) -assert.match(BluetoothPage.template, / { + assert.equal(typeof compile(UnidenPanel.template, { decodeEntities: value => value }), 'function') + const devices = [{ name: 'R8W@12', paired: true }, { name: 'Uniden R4', paired: true }, + { name: 'R8', paired: false }, { name: 'Phone', paired: true }, { name: 'R7', paired: true }] + assert.deepEqual(UnidenPanel.computed.detectors.call({ devices }), devices.slice(0, 2)) +}) +test('setup cannot save onroad or while another save is pending', async () => { + const state = { parked: false, busy: false, request: () => assert.fail('must not send') } + await UnidenPanel.methods.save.call(state) + state.parked = true; state.busy = true + await UnidenPanel.methods.save.call(state) +}) + +test('theme maker edits Uniden display settings through draft history', async () => { + const { OnroadLayoutPage } = await import('../web/js/onroad-layout.js') + const { ONROAD_LAYOUT_TEMPLATE } = await import('../web/js/onroad-layout-template.js') + assert.equal(typeof compile(ONROAD_LAYOUT_TEMPLATE, { decodeEntities: value => value }), 'function') + const position = { transparency: 8, hide_when_no_alert: true, scale: 100 } + const history = [] + const context = { editable: true, selectedWidget: { kind: 'uniden_alerts' }, selectedPosition: position, + state: { profile: 'large', selected: 'uniden_alerts', draft: { position } }, + finishColorEdit() {}, recordChange(before) { history.push(before) } } + const edit = (field, value) => OnroadLayoutPage.methods.setUnidenDisplay.call(context, field, value) + edit('transparency', 65) + edit('hide_when_no_alert', false) + edit('hide_quiet_ride', true) + edit('hide_mute_memory', true) + edit('scale', 130) + assert.deepEqual(position, { transparency: 65, hide_when_no_alert: false, scale: 130 }, 'retired layout fields are not editable') + assert.equal(history[0].position.transparency, 8) + assert.equal(history[1].position.hide_when_no_alert, true) + edit('transparency', 101) + edit('scale', 151) + edit('scale', 49) + edit('hide_quiet_ride', 1) + context.editable = false + edit('hide_when_no_alert', true) + assert.equal(history.length, 3) + assert.ok(!UnidenPanel.template.includes('uniden-transparency')) + assert.ok(ONROAD_LAYOUT_TEMPLATE.includes(`:save-value="(index, value) => setUnidenDisplay('hide_when_no_alert'`)) + for (const field of ['hide_quiet_ride', 'hide_mute_memory']) + assert.ok(!ONROAD_LAYOUT_TEMPLATE.includes(`setUnidenDisplay('${field}'`), 'which alerts show is a detector setting now') + for (const key of ['hide_filtered', 'hide_below_limit', 'hide_q_ride', 'hide_mute_memory']) + assert.ok(UnidenPanel.template.includes(`v-model="config.${key}"`), key) + assert.ok(ONROAD_LAYOUT_TEMPLATE.includes("setUnidenDisplay('scale'")) +}) + +test('saved setup only offers settings while matching a paired detector', () => { + const devices = [{ name: 'R8', address: 'AA:BB:CC:DD:EE:FF', paired: true }] + const state = { saved: { address: devices[0].address }, detectors: devices } + assert.equal(UnidenPanel.computed.ready.call(state), true) + state.detectors = [] + assert.equal(UnidenPanel.computed.ready.call(state), false) + assert.equal(UnidenPanel.computed.dirty.call({ saved: { enabled: true }, config: { enabled: true } }), false) + assert.equal(UnidenPanel.computed.dirty.call({ saved: { enabled: true }, config: { enabled: false } }), true) +}) + +test('selecting a paired detector infers model and enables integration', () => { + const state = { selected: { name: 'Uniden R4W' }, config: { enabled: false, model: 'R8' } } + UnidenPanel.methods.selectDetector.call(state) + assert.deepEqual(state.config, { enabled: true, model: 'R4' }) +}) + +test('reconnecting status stays stable and does not display transport errors', async () => { + const { detectorStatus } = await import('../web/js/uniden.js') + const failed = detectorStatus({ connected: false, connection_state: 'reconnecting', error: 'org.bluez.Error.Failed' }) + const waiting = detectorStatus({ connected: false, connection_state: 'reconnecting', error: 'Waiting to reconnect detector' }) + assert.deepEqual(failed, waiting) + assert.equal(failed.label, 'Reconnecting') + assert.equal(detectorStatus({ connected: true }).label, 'Connected') + assert.equal(detectorStatus({ connection_state: 'radio_off' }).label, 'Bluetooth off') + assert.equal(detectorStatus({ connection_state: 'detector_pairing_required' }).label, 'Check pairing') +}) + +test('rule summary explains exact matching and MHz tolerance in GHz', () => { + assert.equal(UnidenPanel.methods.ruleRange({ frequency: 34.313, tolerance_mhz: 0 }), 'Matches 34.313 GHz exactly') + assert.equal(UnidenPanel.methods.ruleRange({ frequency: 34.313, tolerance_mhz: 2 }), 'Matches 34.3110–34.3150 GHz') +}) + +test('one warning for every band: colors and on/off only, with a scenario preview beside the settings', () => { + assert.ok(!UnidenPanel.template.includes('border_styles'), 'no per-band style picker') + assert.deepEqual(Object.values(UnidenPanel.data().sections), ['Preferences', 'Colors', 'Rules', 'Lockouts']) + assert.equal(UnidenPanel.data().panel, 'alerts', 'opens on Preferences') + for (const hook of ['gx-layout__savebar', 'gx-layout__workspace', 'gx-layout__preview-card', 'aria-label="Preview scenario"', ' { + const { computed } = UnidenPanel + const learning = [{ id: 'a', band: 'K', frequency: 24.15, count: 2, need: 3, misses: 1 }, { id: 'b', band: 'KA', frequency: 34.7, count: 1, need: 5, misses: 0 }] + const panel = { saved: { auto_learn: false, learn_bands: [] }, config: { auto_learn: true, learn_bands: ['X', 'K'] }, learning } + panel.learningOn = computed.learningOn.call(panel) + assert.equal(panel.learningOn, true, 'follows the unsaved toggle') + const rows = computed.learningRows.call(panel) + assert.deepEqual(rows.map(r => [r.learnable, r.percent, r.left]), [[true, 67, 1], [false, 20, 4]]) + assert.deepEqual(rows.map(r => r.stage), ['Locks out next pass', 'Just started'], 'a stage, not a pass count') + assert.equal(computed.learningTitle.call(panel), 'Learning 2 sources') + assert.equal(computed.learningTitle.call({ ...panel, learning: [] }), 'Learning: watching for repeat sources') + assert.equal(computed.learningTitle.call({ ...panel, learningOn: false }), 'Learning is off') +}) + +test('edge preview follows the device rules', async () => { + const { EdgePreview, EdgeMotion, chevronCount, edgeAlpha } = await import('../web/js/uniden-preview.js') + const { EDGE_PARTS } = await import('../web/js/uniden.js') + assert.equal(typeof compile(EdgePreview.template, { decodeEntities: value => value }), 'function') + assert.deepEqual([1, 2, 3, 6, 7, 8].map(chevronCount), [1, 1, 2, 3, 4, 4]) + assert.equal(edgeAlpha({ glow: false }, 'K', 1), 0.85) + assert.equal(edgeAlpha({ glow: false }, 'LASER', 1), 1) + assert.ok(edgeAlpha({ glow: true }, 'K', 8) > edgeAlpha({ glow: true }, 'K', 1)) + assert.deepEqual(Object.keys(EDGE_PARTS), ['line', 'dashes', 'glow', 'veil', 'chevrons']) + const motion = new EdgeMotion() + motion.update({ band: 'K', strength: 3 }, 10, false) + assert.equal(motion.pulses[0][1], 2) + motion.update({ band: 'K', strength: 4 }, 11, false) + assert.equal(motion.boost(11.1), 0) + motion.update({ band: 'K', strength: 5 }, 12, false) + assert.ok(motion.boost(12.15) > 0.9) + motion.update({ band: 'LASER', strength: 5 }, 13, false) + assert.equal(motion.pulses.at(-1)[1], 3) + motion.update(null, 14, false) + assert.equal(motion.fading(14.25)[1], 0.5) + assert.equal(UnidenPanel.data().swatches, SWATCHES, 'every band lists the same current colors') + for (const retired of ['purple', 'violet', 'yellow']) assert.ok(!(retired in SWATCHES), retired) +}) + +test('frequency rules keep a stable client id that is never saved', () => { + const rule = { enabled: true, label: 'Head unit', band: 'KA', frequency: 34.313, tolerance_mhz: 0 } + const first = detectorConfig({ frequency_rules: [rule, { ...rule, label: 'Dash cam' }] }) + const [a, b] = first.frequency_rules.map(item => item.uid) + assert.ok(Number.isInteger(a) && a !== b) + const again = detectorConfig({ frequency_rules: [rule, { ...rule, label: 'Dash cam' }] }, first.frequency_rules) + assert.deepEqual(again.frequency_rules.map(item => item.uid), [a, b], 'a refresh keeps the rows') + assert.deepEqual(savedConfig(first).frequency_rules, [rule, { ...rule, label: 'Dash cam' }]) + for (const key of ['transparency', 'hide_when_no_alert', 'border_styles', 'unmute_on_breakthrough']) assert.ok(!(key in savedConfig(first)), key) + const state = { config: { frequency_rules: [...first.frequency_rules] } } + UnidenPanel.methods.addRule.call(state) + assert.ok(!first.frequency_rules.some(item => item.uid === state.config.frequency_rules[2].uid)) + assert.ok(UnidenPanel.template.includes(':key="rule.uid"')) +}) + +test('leaving with unsaved changes asks first, like the theme maker', async () => { + const { requestLeave, cancelLeave, discardAndLeave } = UnidenPanel.methods + const left = [] + const panel = { dirty: false, busy: false, leaveAction: null, leaveModal: false, $nextTick() {}, cancelLeave, cancel() { this.dirty = false } } + requestLeave.call(panel, () => left.push('clean')) + assert.deepEqual(left, ['clean']) + panel.dirty = true + requestLeave.call(panel, () => left.push('dirty'), 'modal') + assert.deepEqual(left, ['clean']) && assert.equal(panel.leaveModal, true) + assert.equal(UnidenPanel.computed.leaveInline.call(panel), false, 'menu navigation shows the dialog') + discardAndLeave.call(panel) + assert.deepEqual(left, ['clean', 'dirty']) + assert.equal(panel.leaveAction, null) + const { PREVIEW_SCENARIOS, previewScenario } = await import('../web/js/uniden-preview.js') + assert.ok(Object.keys(PREVIEW_SCENARIOS).length >= 2 && previewScenario('laser').alert.band === 'LASER') + assert.equal(previewScenario('missing').script, true, 'unknown scenarios fall back to the drive-by') +}) + +test('picking a color shows that band in the preview', () => { + const { pickColor } = UnidenPanel.methods + const panel = { config: { border_colors: { K: 'amber', KA: 'coral', LASER: 'coral' } }, scenario: 'drive', replay: 0 } + pickColor.call(panel, 'LASER', 'white') + assert.equal(panel.config.border_colors.LASER, 'white') + assert.equal(panel.scenario, 'laser') + pickColor.call(panel, 'LASER', 'lime') + assert.deepEqual([panel.scenario, panel.replay], ['laser', 1], 'already showing laser: replay it') + pickColor.call(panel, 'KA', 'magenta') + assert.equal(panel.scenario, 'ka-strong') + panel.scenario = 'drive' + pickColor.call(panel, 'K', 'ice') + assert.deepEqual([panel.scenario, panel.replay], ['drive', 2], 'the drive-by is a K pass') +}) + +test('turning on Ka or laser learning asks first; X, K and turning off do not', () => { + const { requestLearnBand, confirmLearnBand, toggleBand } = UnidenPanel.methods + const panel = { config: { learn_bands: ['X', 'K'] }, confirmLearn: null, toggleBand } + requestLearnBand.call(panel, 'KA') + assert.deepEqual([panel.confirmLearn, panel.config.learn_bands], ['KA', ['X', 'K']], 'waits for the dialog') + confirmLearnBand.call(panel) + assert.deepEqual([panel.confirmLearn, panel.config.learn_bands], [null, ['X', 'K', 'KA']]) + requestLearnBand.call(panel, 'LASER') + panel.confirmLearn = null // Keep it off + assert.ok(!panel.config.learn_bands.includes('LASER')) + requestLearnBand.call(panel, 'KA') + assert.ok(!panel.config.learn_bands.includes('KA') && panel.confirmLearn === null, 'turning off is immediate') + requestLearnBand.call(panel, 'X') + assert.ok(!panel.config.learn_bands.includes('X')) +}) + + +test('timed mute migrates shared settings and keeps band edits independent', () => { + const config = detectorConfig({ timed_mute_seconds: 12, timed_mute_strength: 0, timed_mute_bands: ['K'] }) + assert.deepEqual(config.timed_mute_settings, Object.fromEntries(['X', 'K', 'KA'].map(band => [band, { seconds: 12, strength: 0 }]))) + config.timed_mute_settings.KA.seconds = 30 + assert.equal(config.timed_mute_settings.K.seconds, 12) + assert.deepEqual(detectorConfig(config), config) + assert.deepEqual(config.timed_mute_bands, ['K']) +}) diff --git a/openpilot/starpilot/galaxy/tests/test_uniden_http.py b/openpilot/starpilot/galaxy/tests/test_uniden_http.py new file mode 100644 index 0000000000..a4a0a8fcf0 --- /dev/null +++ b/openpilot/starpilot/galaxy/tests/test_uniden_http.py @@ -0,0 +1,76 @@ +"""Real authenticated HTTP with only detector IO and configuration storage replaced.""" +import time +import unittest +from types import SimpleNamespace +from typing import Any, cast +from unittest.mock import Mock, patch + +from openpilot.starpilot.galaxy.tests import test_bluetooth_http as bluetooth_http +from openpilot.starpilot.uniden.service import DetectorService +from openpilot.starpilot.uniden.protocol import DEFAULT_CONFIG, alert_key, normalize_config, parse_alerts + +ADDRESS = 'AA:BB:CC:DD:EE:FF' +CONFIG = {**DEFAULT_CONFIG, 'enabled': True, 'address': ADDRESS, 'model': 'R8'} + + +class UnidenHttpTest(unittest.TestCase): + def setUp(self): + self.aa = Mock() + self.aa_enabled = False + original = bluetooth_http.make_server + def server(**kwargs): + kwargs.update(starport_setup=SimpleNamespace(enabled=lambda: self.aa_enabled), starport_client=self.aa) + return original(**kwargs) + with patch.object(bluetooth_http, 'make_server', side_effect=server): + bluetooth_http.BluetoothHttpTest.setUp(cast(Any, self)) + + def stop(self): + bluetooth_http.BluetoothHttpTest.stop(cast(Any, self)) + + def request(self, path, payload=None, cookie=''): + return bluetooth_http.BluetoothHttpTest.request(cast(Any, self), path, payload, cookie) + + def test_auth_configuration_and_onroad_mute(self): + payload = {'operation': 'status'} + assert self.request('/api/bluetooth/uniden', payload)[0] == 401 + _, _, headers = self.request('/api/auth/login', {'password': 'password123'}) + cookie = headers['Set-Cookie'].split(';', 1)[0] + params = Mock() + params.get.return_value = CONFIG + service = DetectorService(params, lambda: False) + state = {'connected': True, 'address': ADDRESS, 'model': 'R8', 'observed_at': time.monotonic(), + 'alerts': parse_alerts(b'1,00,KA,3,0,33.785,R,1'), 'can_mute': True} + with patch('openpilot.starpilot.uniden.service.DetectorService', return_value=service), \ + patch('openpilot.starpilot.uniden.transport.exchange', return_value=state) as exchange: + status, result, _ = self.request('/api/bluetooth/uniden', payload, cookie) + assert status == 200 and result['config'] == normalize_config(CONFIG) + assert self.request('/api/bluetooth/uniden', {'operation': 'configure', 'config': CONFIG}, cookie)[0] == 409 + params.put.assert_not_called() + mute = {'operation': 'mute', 'address': ADDRESS, 'observed_at': state['observed_at'], 'alerts': alert_key(state['alerts'])} + assert self.request('/api/bluetooth/uniden', mute, cookie)[0] == 200 + assert exchange.call_args.kwargs['mute'] == mute + assert self.request('/api/bluetooth/uniden', {'operation': 'write', 'command': 'arbitrary'}, cookie)[0] == 400 + assert self.request('/api/bluetooth/uniden', {**mute, 'address': 'another'}, cookie)[0] == 409 + + def test_projection_delegates_and_uncertain_mute_is_never_replayed_locally(self): + self.aa_enabled = True + _, _, headers = self.request('/api/auth/login', {'password': 'password123'}) + cookie = headers['Set-Cookie'].split(';', 1)[0] + params = Mock() + params.get.return_value = CONFIG + service = DetectorService(params, lambda: True) + self.aa.call.return_value = {'handled': True, 'detector': {'connected': True, 'alerts': []}} + with patch('openpilot.starpilot.uniden.service.DetectorService', return_value=service), \ + patch('openpilot.starpilot.uniden.transport.exchange') as local: + status, result, _ = self.request('/api/bluetooth/uniden', {'operation': 'status'}, cookie) + assert status == 200 and result['connected'] + assert self.aa.call.call_args.args == ('uniden',) + assert self.aa.call.call_args.kwargs['address'] == ADDRESS + assert self.aa.call.call_args.kwargs['auto_mute'] is False + assert self.aa.call.call_args.kwargs['frequency_rules'] == [] + self.aa.call.side_effect = TimeoutError('Uncertain delivery') + mute = {'operation': 'mute', 'address': ADDRESS, 'observed_at': time.monotonic(), 'alerts': []} + assert self.request('/api/bluetooth/uniden', mute, cookie)[0] == 503 + local.assert_not_called() + assert self.request('/api/bluetooth/uniden', {'operation': 'configure', 'config': {**CONFIG, 'enabled': False}}, cookie)[0] == 200 + params.put.assert_called_once_with('UnidenConfig', normalize_config({**CONFIG, 'enabled': False})) diff --git a/openpilot/starpilot/galaxy/web/css/galaxy.css b/openpilot/starpilot/galaxy/web/css/galaxy.css index 81a3f45710..104004747c 100644 --- a/openpilot/starpilot/galaxy/web/css/galaxy.css +++ b/openpilot/starpilot/galaxy/web/css/galaxy.css @@ -1632,6 +1632,8 @@ progress { max-width: 100%; accent-color: var(--primary); } .gx-driving .gx-row { flex-wrap: wrap; } .gx-driving .gx-row > strong { flex: 1; min-width: 0; overflow-wrap: anywhere; } .gx-bt-card > h3 { margin: 0 0 var(--sp-2); } +.gx-bluetooth__radio { padding-block: var(--sp-3); } +.gx-bluetooth__radio > .gx-row { min-height: var(--touch-target); padding-block: 0; } .gx-bt-adapter__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); } .gx-bt-adapter__actions > .gx-btn { padding-inline: var(--sp-2); white-space: nowrap; } .gx-row__desc.gx-bt-device__state { display: flex; align-items: center; gap: 6px; margin-top: 2px; } diff --git a/openpilot/starpilot/galaxy/web/css/settings.css b/openpilot/starpilot/galaxy/web/css/settings.css index 2266973dfb..4db249367c 100644 --- a/openpilot/starpilot/galaxy/web/css/settings.css +++ b/openpilot/starpilot/galaxy/web/css/settings.css @@ -989,3 +989,106 @@ html.gx-maker-open, html.gx-maker-open body { touch-action: manipulation; } .gx-maintenance > summary::-webkit-details-marker { display: none; } .gx-maintenance__chevron { margin-left: auto; } .gx-maintenance[open] .gx-maintenance__chevron { transform: rotate(180deg); } + +/* Simple Bluetooth device name and connection-status rows. */ +.gx-bluetooth__device + .gx-bluetooth__device { border-top: 1px solid var(--glass-border); } +.gx-bluetooth__device .gx-row__info { min-width: 0; overflow-wrap: anywhere; } +@media (max-width: 600px) { + .gx-bluetooth .gx-row { flex-wrap: wrap; } +} + +.gx-uniden { display: grid; gap: var(--sp-4); min-width: 0; } +.gx-uniden > .gx-card { margin: 0; } +.gx-uniden__fieldset { border: 0; padding: 0; margin: 0; min-width: 0; } +.gx-uniden__heading, .gx-uniden__rule-footer, .gx-uniden__savebar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); } +.gx-uniden__heading h3, .gx-uniden__heading h4, .gx-uniden__rule-footer p, .gx-uniden__empty p { margin: 0; } +.gx-uniden__heading h3, .gx-uniden__heading h4 { overflow-wrap: anywhere; } +.gx-uniden__eyebrow { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-2); } +.gx-uniden__status { flex-shrink: 0; font-size: var(--fs-xs); border-radius: 999px; padding: var(--sp-2) var(--sp-3); background: var(--surface-container); color: var(--text-muted); } +.gx-uniden__status--connected { color: var(--secondary); } +.gx-uniden__preference .gx-row__info { min-width: 0; } +.gx-uniden__preference .gx-switch { flex-shrink: 0; } +.gx-uniden__rule { display: grid; gap: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); } +.gx-uniden__enable { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-muted); font-size: var(--fs-xs); flex-shrink: 0; } +.gx-uniden__fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, .6fr) repeat(2, minmax(0, 1fr)); gap: var(--sp-3); } +.gx-uniden__field { display: grid; gap: var(--sp-2); min-width: 0; align-content: start; font-size: var(--fs-sm); } +.gx-uniden__field .gx-field { width: 100%; min-width: 0; box-sizing: border-box; } +.gx-uniden__rule-footer { align-items: flex-end; } +.gx-uniden__rule-footer > div { display: grid; gap: var(--sp-2); } +.gx-uniden__empty { display: grid; gap: var(--sp-2); padding: var(--sp-4) 0; } +.gx-uniden__savebar { flex-wrap: wrap; } +.gx-uniden__error { color: var(--error); } +.gx-uniden__sub { display: grid; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4) var(--sp-4); } +.gx-uniden__choices { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); } +.gx-uniden__narrow .gx-field { max-width: 180px; } +.gx-uniden__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: var(--sp-3); } +button.gx-chip.gx-uniden__choice { min-height: var(--touch-target); padding: 0 var(--sp-4); font-size: var(--fs-sm); } +button.gx-chip.gx-uniden__choice[aria-pressed="true"] { background: var(--primary); border-color: transparent; color: var(--on-primary); } +.gx-uniden__dot { width: var(--touch-target); height: var(--touch-target); padding: 0; border-radius: 50%; border: 2px solid var(--glass-border); cursor: pointer; } +.gx-uniden__dot[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface-container), 0 0 0 4px var(--primary); } +.gx-uniden__learning { display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); } +.gx-uniden__learning-head { display: flex; align-items: center; gap: var(--sp-2); } +.gx-uniden__learning-head strong { font-weight: var(--fw-bold); } +.gx-uniden__learning .gx-note, .gx-uniden__learning-list { margin: 0; } +.gx-uniden__learning-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--on-surface-variant); flex: none; } +.gx-uniden__learning--on .gx-uniden__learning-dot { background: var(--secondary); } +.gx-uniden__learning-list { display: grid; gap: var(--sp-3); padding: 0; list-style: none; } +.gx-uniden__learning-list li { display: grid; gap: 6px; } +.gx-uniden__learning-line { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; } +.gx-uniden__learning-count { color: var(--on-surface-variant); font-size: var(--fs-sm); white-space: nowrap; } +.gx-uniden__learning-item--paused { opacity: .6; } +.gx-uniden__meter { height: 4px; border-radius: 999px; background: var(--surface-container-high); overflow: hidden; } +.gx-uniden__meter > span { display: block; height: 100%; border-radius: inherit; background: color-mix(in srgb, var(--secondary) 55%, var(--on-surface-variant)); transition: width .3s ease; } +.gx-uniden__lock-source { display: inline-block; margin-left: var(--sp-2); padding: 2px 8px; border-radius: 999px; vertical-align: middle; font-size: var(--fs-xs); font-weight: var(--fw-bold); background: var(--surface-container-high); color: var(--text-muted); } +.gx-uniden__lock-source--auto { color: var(--on-surface-variant); } +/* Uniden editor: the theme maker's save bar and workspace, preview beside the settings. */ +.gx-uniden__controls { margin: 0; align-content: start; } +.gx-uniden__section { display: grid; gap: var(--sp-3); min-width: 0; } +.gx-uniden__section > .gx-section__header { padding: 0; background: none; } +.gx-uniden__section .gx-panel { padding: 0; } +.gx-uniden-editor { display: grid; gap: 12px; } +.gx-uniden__group { border-top: 1px solid var(--outline); } +.gx-uniden__group-head { display: grid; gap: 2px; padding: var(--sp-3) var(--sp-4) 0; } +.gx-uniden__group > .gx-note { padding: var(--sp-2) var(--sp-4) var(--sp-3); margin: 0; } +/* Set-up detector: one compact row, name and status, a one-line detail, Change on the right. */ +.gx-uniden__detector--compact > .gx-panel { padding: var(--sp-3) var(--sp-4); } +.gx-uniden__summary { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; } +.gx-uniden__summary-text { flex: 1 1 0; min-width: 0; display: grid; gap: 2px; } +.gx-uniden__summary-title { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; } +.gx-uniden__summary-title h3 { margin: 0; font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.gx-uniden__summary-title .gx-uniden__status { padding: 2px var(--sp-2); } +.gx-uniden__summary .gx-note { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.gx-uniden__summary-actions { display: flex; gap: var(--sp-2); flex: none; } +.gx-uniden__summary-actions .gx-btn { min-height: 36px; padding: 6px 14px; } +.gx-uniden__pages { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; } +.gx-uniden__pages > .gx-btn { flex: none; } +@container (max-width: 480px) { .gx-uniden__pages { width: 100%; } .gx-uniden__pages > .gx-btn { flex: 1 0 auto; padding-inline: 10px; font-size: var(--fs-sm); } } +.gx-uniden__page { margin: 0; } +.gx-uniden__preview-card > .gx-uniden__preview-canvas { margin-inline: 0; height: auto; aspect-ratio: 1860 / 1080; background: #000; } +/* The preview leads: on the left on desktop, pinned above the settings on narrow screens. */ +.gx-uniden__preview-card { order: -1; } +@container (min-width: 1041px) { .gx-uniden__workspace { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } } +.gx-uniden__bands { display: grid; gap: var(--sp-3); } +.gx-uniden__band { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); } +.gx-uniden__band--off .gx-uniden__choices { opacity: .45; } +/* Colors stay on one row and scroll sideways rather than wrapping; padding keeps the selected ring visible. */ +.gx-uniden__band .gx-uniden__choices { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding: 4px; margin: -4px; } +.gx-uniden__band .gx-uniden__choices::-webkit-scrollbar { display: none; } +.gx-uniden__band .gx-uniden__dot { flex: none; scroll-snap-align: start; } +.gx-uniden__edge-parts input[type="range"] { width: 100%; accent-color: var(--primary); } +.gx-uniden__edge-parts { display: grid; gap: 0; padding-block: 0 var(--sp-4); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); overflow: hidden; } +.gx-uniden__edge-parts > .gx-row:first-child { border-top: 0; } +.gx-uniden__edge-parts > .gx-uniden__field, .gx-uniden__edge-parts > .gx-note { padding-inline: var(--sp-4); } +.gx-uniden__edge-parts > .gx-uniden__field { padding-top: var(--sp-3); border-top: 1px solid var(--outline); } +@media (prefers-reduced-motion: reduce) { + .gx-uniden__meter > span { transition: none; } +} +@media (max-width: 600px) { + .gx-uniden__pair { grid-template-columns: minmax(0, 1fr); } +} +@media (max-width: 800px) { + .gx-uniden__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } + .gx-uniden__name { grid-column: 1 / -1; } + .gx-uniden__field:last-child { grid-column: 1 / -1; } + .gx-uniden__heading, .gx-uniden__rule-footer { flex-wrap: wrap; } +} diff --git a/openpilot/starpilot/galaxy/web/js/app.js b/openpilot/starpilot/galaxy/web/js/app.js index 31ce92350d..86783841ab 100644 --- a/openpilot/starpilot/galaxy/web/js/app.js +++ b/openpilot/starpilot/galaxy/web/js/app.js @@ -37,6 +37,7 @@ const PipPage = page(() => import("./pip.js").then((module) => module.PipPage)) import { DrivingPage, drivingPage } from "./driving.js" const LongitudinalCurvesPage = page(() => import("./longitudinal-curves.js").then((module) => module.LongitudinalCurvesPage)) import { DevicePreferencesPage, devicePage } from "./device-preferences.js" +const ControllersPage = page(() => import("./controllers.js").then((module) => module.ControllersPage)) const BluetoothPage = page(() => import("./bluetooth.js").then((module) => module.BluetoothPage)) const StarPortPage = page(() => import("./starport.js").then((module) => module.StarPortPage)) const SpotifyPage = page(() => import("./spotify.js").then((module) => module.SpotifyPage)) @@ -91,7 +92,7 @@ const auth = new LocalAuth({ publish: (update) => { createApp({ - components: { AppDownloadReminder, BottomNav, Home, LocalAccess, Tools, Logs, SoftwarePage, NavigationPage, ModelsPage, SettingsPage, SettingsRecoveryPage, ToggleSearch, SaveFeedback, FlmPage, LocalRecordingsPage, CamerasPage, SentryEventsPage, VasmPage, PipPage, DrivingPage, DevicePreferencesPage, BluetoothPage, StarPortPage, SpotifyPage, LongitudinalCurvesPage, OnroadLayoutPage, GalaxyPage, NetworksPage, DevicePicker, DeviceState, MenuTile }, + components: { AppDownloadReminder, BottomNav, Home, LocalAccess, Tools, Logs, SoftwarePage, NavigationPage, ModelsPage, SettingsPage, SettingsRecoveryPage, ToggleSearch, SaveFeedback, FlmPage, LocalRecordingsPage, CamerasPage, SentryEventsPage, VasmPage, PipPage, DrivingPage, DevicePreferencesPage, BluetoothPage, ControllersPage, StarPortPage, SpotifyPage, LongitudinalCurvesPage, OnroadLayoutPage, GalaxyPage, NetworksPage, DevicePicker, DeviceState, MenuTile }, data: () => ({ state, authState, authForm, route, NAV, routeDirection: 1, updateRestart, deviceRestart, nextLayoutLeavePresentation: "inline" }), computed: { visibleTools() { return state.tools.filter(tool => tool.visibility !== "authenticated" || @@ -101,6 +102,8 @@ createApp({ drivingSettingsPage() { return drivingPage(route.path) }, deviceSettingsPage() { return devicePage(route.path) }, pageName() { + if (route.path === "/bluetooth/controllers") return "Controllers" + if (route.path === "/bluetooth/uniden") return "Uniden" if (this.currentTool) return this.currentTool.name if (route.path === "/device-preferences") return "Force Drive State" return NAV.find((item) => item.path === route.path)?.name || "This page" @@ -179,6 +182,7 @@ createApp({ this.nextLayoutLeavePresentation = "inline" if (this.$refs.activeLayout) this.$refs.activeLayout.requestLeave(proceed, presentation) else if (this.$refs.activeSettings) this.$refs.activeSettings.requestRouteLeave(proceed) + else if (this.$refs.activeBluetooth) this.$refs.activeBluetooth.requestLeave(proceed, presentation) else proceed() }) }, @@ -260,7 +264,8 @@ createApp({ - + + diff --git a/openpilot/starpilot/galaxy/web/js/bluetooth-tabs.js b/openpilot/starpilot/galaxy/web/js/bluetooth-tabs.js new file mode 100644 index 0000000000..bccf6dc7cf --- /dev/null +++ b/openpilot/starpilot/galaxy/web/js/bluetooth-tabs.js @@ -0,0 +1,17 @@ +export const BluetoothTabs = { + props: { + active: { type: String, default: 'devices' }, + go: { type: Function, default: path => { location.hash = path } }, + }, + data: () => ({ tabs: [ + { id: 'devices', label: 'Devices', path: '/bluetooth' }, + { id: 'audio', label: 'Phones & Audio', path: '/spotify' }, + { id: 'starport', label: 'StarPort', path: '/starport' }, + { id: 'uniden', label: 'Uniden', path: '/bluetooth/uniden' }, + { id: 'controllers', label: 'Controllers', path: '/bluetooth/controllers' }, + ] }), + template: ``, +} diff --git a/openpilot/starpilot/galaxy/web/js/bluetooth.js b/openpilot/starpilot/galaxy/web/js/bluetooth.js index 6625c5ff80..d4a67bf588 100644 --- a/openpilot/starpilot/galaxy/web/js/bluetooth.js +++ b/openpilot/starpilot/galaxy/web/js/bluetooth.js @@ -1,9 +1,10 @@ import { WikiHelp } from './wiki-help.js' +import { UnidenPanel } from './uniden.js' import { GxState } from "./state.js" import { GxNotice } from "./notice.js" import { reportSave } from "./save-feedback.js" import { connectionError } from "./polling.js" -import { ControllersPage } from "./controllers.js" +import { BluetoothTabs } from "./bluetooth-tabs.js" import { BluetoothDeviceList } from "./bluetooth-devices.js" import { GxDialog } from "./dialog.js" @@ -20,6 +21,7 @@ const BLUETOOTH_ERRORS = { projection_active: "StarPort is using this device. Stop StarPort, then try again.", session_expired: "The pairing session expired. Refresh and start pairing again.", changed: "The Bluetooth device or pairing request changed. Refresh and try again.", + unreachable: "The device didn't respond. Make sure it's on, nearby and not connected to another phone or app (like the Uniden app), then try again.", } export const bluetoothError = (code) => BLUETOOTH_ERRORS[code] || "Bluetooth could not complete the request. Refresh to try again." const PROMPT_KINDS = new Set(["pin", "passkey", "confirmation", "authorization", "display_pin", "display_passkey"]) @@ -167,12 +169,12 @@ export class BluetoothFeed { } export const BluetoothPage = { - components: { WikiHelp, GxState, GxNotice, ControllersPage, GxDialog }, - props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, - data: () => ({ status: null, busy: false, error: "", pairValue: "", now: Date.now(), claimAt: Date.now(), forgetting: null }), + components: { WikiHelp, UnidenPanel, GxState, GxNotice, BluetoothTabs, GxDialog }, + props: { go: { type: Function, default: path => { location.hash = path } }, unidenSettings: Boolean, mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, + data: () => ({ status: null, busy: false, error: "", pairValue: "", now: Date.now(), claimAt: Date.now(), forgetting: null, adding: false, dismissedPairing: null }), mounted() { this.feed = new BluetoothFeed({ publish: (value) => Object.assign(this, value), unauthorized: this.unauthorized }) - this.visibility = () => document.hidden ? this.feed.stop(true) : this.feed.start() + this.visibility = () => this.mode !== "local" || document.hidden ? this.feed.stop(true) : this.feed.start() document.addEventListener("visibilitychange", this.visibility) this.clock = setInterval(() => { this.now = Date.now() }, 1000) if (this.mode === "local" && !document.hidden) this.feed.start() @@ -184,6 +186,8 @@ export const BluetoothPage = { 'status.claim'() { this.claimAt = Date.now(); this.now = this.claimAt }, }, computed: { + pairingKey() { return this.status?.pairing ? `${this.status.pairing.address}:${this.status.pairing.state}` : null }, + addingDevice() { return this.adding || !!this.status?.discovering }, saved() { return this.status?.devices?.filter((device) => device.paired || device.trusted) || [] }, // A phone running the StarPilot app is connected to comma's Bluetooth bridge but not bonded: list it apart from real pairings. appLinks() { return this.status?.devices?.filter((device) => device.connected && !device.paired && !device.trusted) || [] }, @@ -194,8 +198,30 @@ export const BluetoothPage = { methods: { reportSave, bluetoothError, + // Unsaved Uniden settings hold navigation the way the theme maker does. + requestLeave(proceed, presentation) { + if (this.$refs.uniden) this.$refs.uniden.requestLeave(proceed, presentation) + else proceed() + }, + async openAdd() { + this.adding = true + await this.$nextTick() + this.$refs.addDevice?.scrollIntoView({ block: 'nearest' }) + }, + async closeAdd() { + if (this.status?.discovering && !await this.action('stop_scan')) return + this.adding = false + }, refresh() { return this.feed.refresh() }, - action(operation, fields) { return this.feed.action(operation, fields) }, + async action(operation, fields) { + if (['pair', 'accept_pair'].includes(operation)) this.dismissedPairing = null + const accepted = await this.feed.action(operation, fields) + if (accepted && ['pair', 'accept_pair'].includes(operation)) { + await this.$nextTick() + ; (this.$refs.phonePairing || this.$refs.devicePairing)?.scrollIntoView({ block: 'nearest' }) + } + return accepted + }, respond(accepted) { const prompt = this.status?.pairing?.prompt if (!prompt || prompt.displayOnly || accepted && !validPairInput(prompt, this.pairValue)) return @@ -211,30 +237,30 @@ export const BluetoothPage = { closeForget() { if (this.forgetting?.state !== "working") this.forgetting = null }, }, template: ` -
-

Bluetooth

-

View, pair and manage nearby and saved devices.

+
+

{{ unidenSettings ? 'Uniden' : 'Bluetooth' }}

+

{{ unidenSettings ? 'Detector preferences and custom frequency rules.' : 'Pair and manage devices here. Use the tabs for integration settings.' }}

+ Bluetooth requires the device. No radio was checked in preview. -
`, +
`, } diff --git a/openpilot/starpilot/galaxy/web/js/onroad-layout-document.js b/openpilot/starpilot/galaxy/web/js/onroad-layout-document.js index 7caf9f7378..b51e0a92f0 100644 --- a/openpilot/starpilot/galaxy/web/js/onroad-layout-document.js +++ b/openpilot/starpilot/galaxy/web/js/onroad-layout-document.js @@ -50,6 +50,7 @@ export function widgetSize(widget, position) { const [width, height] = widget.sizes[position.size] return [width, height + (widget.wifiNameHeight && position.wifiName === true ? widget.wifiNameHeight : 0)].map(side => Math.round(side * scale)) } + if (widget.kind === "uniden_alerts" && Number.isInteger(position?.scale)) return [Math.round(widget.width * position.scale / 100), Math.round(widget.height * position.scale / 100)] if (widget.box) return [position?.width ?? widget.width, position?.height ?? widget.height] if (widget.resizable) return [position?.size ?? widget.width, position?.size ?? widget.height] return [widget.width, widget.height] @@ -179,8 +180,11 @@ export function validDocument(document, metadata) { const resizable = widget.resizable, box = widget.box, opacity = widget.opacity const rotate = wheelRotationAvailable(widget, name, metadata?.projection === true) && object(position) && Object.hasOwn(position, "rotate") return keysEqual(position, ["x", "y", "enabled", ...(resizable ? ["size"] : []), ...(box ? ["width", "height"] : []), - ...(opacity ? ["opacity"] : []), ...(widget.iconSize ? ["display"] : []), ...(widget.backgroundToggle ? ["background"] : []), ...(widget.collapseToggle ? ["collapse"] : []), ...(widget.bluetoothToggle ? ["bluetooth"] : []), ...(widget.wifiNameHeight ? ["wifiName"] : []), ...(widget.sizes ? ["size"] : []), ...(widget.scale ? ["scale"] : []), ...(rotate ? ["rotate"] : [])]) && + ...(widget.kind === "uniden_alerts" ? ["transparency", "hide_when_no_alert", "scale"] : []), ...(opacity ? ["opacity"] : []), ...(widget.iconSize ? ["display"] : []), ...(widget.backgroundToggle ? ["background"] : []), ...(widget.collapseToggle ? ["collapse"] : []), ...(widget.bluetoothToggle ? ["bluetooth"] : []), ...(widget.wifiNameHeight ? ["wifiName"] : []), ...(widget.sizes ? ["size"] : []), ...(widget.scale ? ["scale"] : []), ...(rotate ? ["rotate"] : [])]) && (!rotate || typeof position.rotate === "boolean") && + (widget.kind !== "uniden_alerts" || (Number.isInteger(position.transparency) && position.transparency >= 0 && + position.transparency <= 100 && typeof position.hide_when_no_alert === "boolean" && + Number.isInteger(position.scale) && position.scale >= 50 && position.scale <= 150)) && (!widget.iconSize || ["words", "icons"].includes(position.display)) && (!widget.backgroundToggle || typeof position.background === "boolean") && (!widget.collapseToggle || typeof position.collapse === "boolean") && diff --git a/openpilot/starpilot/galaxy/web/js/onroad-layout-template.js b/openpilot/starpilot/galaxy/web/js/onroad-layout-template.js index a633a3ba9c..abf27a7a08 100644 --- a/openpilot/starpilot/galaxy/web/js/onroad-layout-template.js +++ b/openpilot/starpilot/galaxy/web/js/onroad-layout-template.js @@ -252,6 +252,21 @@ export const ONROAD_LAYOUT_TEMPLATE = ` :value="selectedPosition.size" :disabled="!editAvailable || !!state.drag" @change="resizeSelected($event)"> +