mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-09-30 03:13:41 +08:00
feat: Squash all min-features into full
This commit is contained in:
@@ -21,7 +21,12 @@ from openpilot.system.hardware import HARDWARE, PC
|
||||
from openpilot.system.ui.lib.multilang import multilang
|
||||
from openpilot.common.realtime import Ratekeeper
|
||||
|
||||
_DEFAULT_FPS = int(os.getenv("FPS", {'tizi': 20}.get(HARDWARE.get_device_type(), 60)))
|
||||
try:
|
||||
from openpilot.common.params import Params
|
||||
except ImportError:
|
||||
Params = None
|
||||
|
||||
_DEFAULT_FPS = int(os.getenv("FPS", {'tici': 20, 'tizi': 20}.get(HARDWARE.get_device_type(), 60)))
|
||||
FPS_LOG_INTERVAL = 5 # Seconds between logging FPS drops
|
||||
FPS_DROP_THRESHOLD = 0.9 # FPS drop threshold for triggering a warning
|
||||
FPS_CRITICAL_THRESHOLD = 0.5 # Critical threshold for triggering strict actions
|
||||
@@ -193,13 +198,17 @@ class MouseState:
|
||||
class GuiApplication:
|
||||
def __init__(self, width: int | None = None, height: int | None = None):
|
||||
self._fonts: dict[FontWeight, rl.Font] = {}
|
||||
self._width = width if width is not None else GuiApplication._default_width()
|
||||
self._height = height if height is not None else GuiApplication._default_height()
|
||||
if Params is not None:
|
||||
dp_ui_mici = Params().get_bool("dp_ui_mici")
|
||||
else:
|
||||
dp_ui_mici = False
|
||||
self._width = width if width is not None else GuiApplication._default_width(dp_ui_mici)
|
||||
self._height = height if height is not None else GuiApplication._default_height(dp_ui_mici)
|
||||
|
||||
if PC and os.getenv("SCALE") is None:
|
||||
self._scale = self._calculate_auto_scale()
|
||||
else:
|
||||
self._scale = SCALE
|
||||
self._scale = 4.0 if dp_ui_mici else SCALE
|
||||
|
||||
# Scale, then ensure dimensions are even
|
||||
self._scaled_width = int(self._width * self._scale)
|
||||
@@ -725,12 +734,13 @@ class GuiApplication:
|
||||
return max(0.3, min(w / self._width, h / self._height) * 0.95)
|
||||
|
||||
@staticmethod
|
||||
def _default_width() -> int:
|
||||
return 2160 if GuiApplication.big_ui() else 536
|
||||
def _default_width(dp_ui_four: bool = False) -> int:
|
||||
return 536 if dp_ui_four else 2160 if GuiApplication.big_ui() else 536
|
||||
|
||||
@staticmethod
|
||||
def _default_height() -> int:
|
||||
return 1080 if GuiApplication.big_ui() else 240
|
||||
def _default_height(dp_ui_four: bool = False) -> int:
|
||||
return 240 if dp_ui_four else 1080 if GuiApplication.big_ui() else 240
|
||||
|
||||
|
||||
@staticmethod
|
||||
def big_ui() -> bool:
|
||||
|
||||
@@ -161,6 +161,13 @@ class AdvancedNetworkSettings(Widget):
|
||||
metered = self._params.get_bool("GsmMetered")
|
||||
self._wifi_manager.update_gsm_settings(roaming_enabled, self._params.get("GsmApn") or "", metered)
|
||||
|
||||
# dp - retain tethering after reboot
|
||||
# same logic as _toggle_tethering()
|
||||
if self._params.get_bool("dp_dev_tethering"):
|
||||
self._tethering_action.set_enabled(False)
|
||||
self._wifi_metered_action.set_enabled(False)
|
||||
self._wifi_manager.set_tethering_active(True)
|
||||
|
||||
def _on_network_updated(self, networks: list[Network]):
|
||||
self._tethering_action.set_enabled(True)
|
||||
self._tethering_action.set_state(self._wifi_manager.is_tethering_active())
|
||||
@@ -176,6 +183,7 @@ class AdvancedNetworkSettings(Widget):
|
||||
|
||||
def _toggle_tethering(self):
|
||||
checked = self._tethering_action.get_state()
|
||||
self._params.put_bool_nonblocking("dp_dev_tethering", checked)
|
||||
self._tethering_action.set_enabled(False)
|
||||
if checked:
|
||||
self._wifi_metered_action.set_enabled(False)
|
||||
|
||||
Reference in New Issue
Block a user