IQ.Pilot Release Commit @ e46d557
This commit is contained in:
@@ -22,7 +22,7 @@ from pathlib import Path
|
||||
from typing import NamedTuple
|
||||
from importlib.resources import as_file, files
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.system.hardware import HARDWARE, PC
|
||||
from openpilot.system.hardware import EGL_DMA_BUF_SUPPORTED, HARDWARE, PC
|
||||
from openpilot.system.ui.lib.multilang import multilang
|
||||
from openpilot.common.realtime import Ratekeeper
|
||||
|
||||
@@ -326,7 +326,7 @@ class GuiApplication(IQAppHooks):
|
||||
rl.glfw_swap_interval(0)
|
||||
except Exception:
|
||||
pass
|
||||
if not PC and rl.is_window_ready() and not OFFSCREEN:
|
||||
if EGL_DMA_BUF_SUPPORTED and rl.is_window_ready() and not OFFSCREEN:
|
||||
try:
|
||||
from openpilot.system.ui.lib.egl import set_swap_interval
|
||||
set_swap_interval(0)
|
||||
@@ -349,7 +349,7 @@ class GuiApplication(IQAppHooks):
|
||||
glfw_vsync = False
|
||||
|
||||
egl_vsync = False
|
||||
if not PC:
|
||||
if EGL_DMA_BUF_SUPPORTED:
|
||||
try:
|
||||
from openpilot.system.ui.lib.egl import set_swap_interval
|
||||
egl_vsync = set_swap_interval(interval)
|
||||
@@ -367,7 +367,7 @@ class GuiApplication(IQAppHooks):
|
||||
rl.rl_draw_render_batch_active()
|
||||
|
||||
def _apply_display_sync_before_swap(self) -> None:
|
||||
if PC or OFFSCREEN or not DISPLAY_SYNC_BEFORE_SWAP or self._display_sync_available is False:
|
||||
if not EGL_DMA_BUF_SUPPORTED or OFFSCREEN or not DISPLAY_SYNC_BEFORE_SWAP or self._display_sync_available is False:
|
||||
return
|
||||
try:
|
||||
self._flush_raylib_batch()
|
||||
@@ -395,7 +395,7 @@ class GuiApplication(IQAppHooks):
|
||||
# intermittent screen tearing when scrolling (the content moves, so a mid-scanout swap is
|
||||
# visible). eglSwapInterval is a trivial call, so re-assert it every frame to keep FIFO vsync
|
||||
# pinned instead of relying on the slow (VSYNC_REAPPLY_INTERVAL) full re-apply below.
|
||||
if self._paced_by_vsync and self._vsync_interval > 0 and not PC and rl.is_window_ready():
|
||||
if self._paced_by_vsync and self._vsync_interval > 0 and EGL_DMA_BUF_SUPPORTED and rl.is_window_ready():
|
||||
try:
|
||||
from openpilot.system.ui.lib.egl import set_swap_interval
|
||||
set_swap_interval(self._vsync_interval)
|
||||
@@ -850,7 +850,7 @@ class GuiApplication(IQAppHooks):
|
||||
# full-res frame texture can make the Adreno/GBM driver silently reset the swap interval to 0
|
||||
# *after* that call but before this swap, which reintroduced tearing. This is the swap that
|
||||
# actually matters, so pin the interval here too.
|
||||
if (ENABLE_VSYNC and not OFFSCREEN and not PC and self._paced_by_vsync
|
||||
if (ENABLE_VSYNC and not OFFSCREEN and EGL_DMA_BUF_SUPPORTED and self._paced_by_vsync
|
||||
and self._vsync_interval > 0 and rl.is_window_ready()):
|
||||
try:
|
||||
from openpilot.system.ui.lib.egl import set_swap_interval
|
||||
|
||||
@@ -961,6 +961,10 @@ class WifiManager:
|
||||
settings['connection'] = {}
|
||||
|
||||
changes = False
|
||||
# NetworkManager updates an active modem connection in place. Quectel
|
||||
# modems keep the existing PDP bearer in that case, so an APN change
|
||||
# does not take effect until LTE is disconnected and reactivated.
|
||||
apn_settings_changed = False
|
||||
auto_config = apn == ""
|
||||
initial_eps_apn = apn if not auto_config else ""
|
||||
|
||||
@@ -968,11 +972,13 @@ class WifiManager:
|
||||
cloudlog.warning(f'Changing gsm.auto-config to {auto_config}')
|
||||
settings['gsm']['auto-config'] = ('b', auto_config)
|
||||
changes = True
|
||||
apn_settings_changed = True
|
||||
|
||||
if settings['gsm'].get('apn', ('s', ''))[1] != apn:
|
||||
cloudlog.warning(f'Changing gsm.apn to {apn}')
|
||||
settings['gsm']['apn'] = ('s', apn)
|
||||
changes = True
|
||||
apn_settings_changed = True
|
||||
|
||||
if settings['gsm'].get('home-only', ('b', False))[1] == roaming:
|
||||
cloudlog.warning(f'Changing gsm.home-only to {not roaming}')
|
||||
@@ -983,11 +989,13 @@ class WifiManager:
|
||||
cloudlog.warning(f'Changing gsm.initial-eps-bearer-configure to {bool(initial_eps_apn)}')
|
||||
settings['gsm']['initial-eps-bearer-configure'] = ('b', bool(initial_eps_apn))
|
||||
changes = True
|
||||
apn_settings_changed = True
|
||||
|
||||
if settings['gsm'].get('initial-eps-bearer-apn', ('s', ''))[1] != initial_eps_apn:
|
||||
cloudlog.warning(f'Changing gsm.initial-eps-bearer-apn to {initial_eps_apn}')
|
||||
settings['gsm']['initial-eps-bearer-apn'] = ('s', initial_eps_apn)
|
||||
changes = True
|
||||
apn_settings_changed = True
|
||||
|
||||
# Unknown means NetworkManager decides
|
||||
metered_int = int(MeteredType.UNKNOWN if metered else MeteredType.NO)
|
||||
@@ -1005,7 +1013,10 @@ class WifiManager:
|
||||
cloudlog.warning(f"Failed to update GSM settings: {reply}")
|
||||
return
|
||||
|
||||
self._activate_modem_connection(lte_connection_path)
|
||||
if apn_settings_changed:
|
||||
self._restart_modem_connection(lte_connection_path)
|
||||
else:
|
||||
self._activate_modem_connection(lte_connection_path)
|
||||
except Exception as e:
|
||||
cloudlog.exception(f"Error updating GSM settings: {e}")
|
||||
|
||||
@@ -1034,6 +1045,40 @@ class WifiManager:
|
||||
except Exception as e:
|
||||
cloudlog.exception(f"Error activating modem connection: {e}")
|
||||
|
||||
def _restart_modem_connection(self, connection_path: str):
|
||||
"""Reconnect LTE so a changed APN is used for a new PDP bearer."""
|
||||
try:
|
||||
for active_conn in self._get_active_connections():
|
||||
conn_addr = DBusAddress(active_conn, bus_name=NM, interface=NM_ACTIVE_CONNECTION_IFACE)
|
||||
active_conn_path = self._router_main.send_and_get_reply(Properties(conn_addr).get('Connection')).body[0][1]
|
||||
if active_conn_path == connection_path:
|
||||
cloudlog.warning("Restarting LTE connection to apply APN settings")
|
||||
reply = self._router_main.send_and_get_reply(new_method_call(self._nm, 'DeactivateConnection', 'o', (active_conn,)))
|
||||
if reply.header.message_type == MessageType.error:
|
||||
cloudlog.warning(f"Failed to deactivate LTE connection: {reply}")
|
||||
return
|
||||
|
||||
for _ in range(20):
|
||||
if not self._is_connection_active(connection_path):
|
||||
break
|
||||
time.sleep(0.25)
|
||||
else:
|
||||
cloudlog.warning("LTE connection did not deactivate after APN change")
|
||||
return
|
||||
break
|
||||
|
||||
self._activate_modem_connection(connection_path)
|
||||
except Exception as e:
|
||||
cloudlog.exception(f"Error restarting modem connection: {e}")
|
||||
|
||||
def _is_connection_active(self, connection_path: str) -> bool:
|
||||
for active_conn in self._get_active_connections():
|
||||
conn_addr = DBusAddress(active_conn, bus_name=NM, interface=NM_ACTIVE_CONNECTION_IFACE)
|
||||
active_conn_path = self._router_main.send_and_get_reply(Properties(conn_addr).get('Connection')).body[0][1]
|
||||
if active_conn_path == connection_path:
|
||||
return True
|
||||
return False
|
||||
|
||||
def stop(self):
|
||||
if not self._exit:
|
||||
self._exit = True
|
||||
|
||||
Reference in New Issue
Block a user