feat: Squash all core features into min

This commit is contained in:
Rick Lan
2026-01-23 11:48:04 +08:00
parent 6928314c89
commit 0076d30d62
68 changed files with 1196 additions and 141 deletions
+7 -6
View File
@@ -27,12 +27,13 @@ def _char_sets():
for language, code in _languages().items():
unifont.update(language)
po_path = TRANSLATIONS_DIR / f"app_{code}.po"
try:
chars = set(po_path.read_text(encoding="utf-8"))
except FileNotFoundError:
continue
(unifont if code in UNIFONT_LANGUAGES else base).update(chars)
for prefix in ("app_", "dragonpilot_"):
po_path = TRANSLATIONS_DIR / f"{prefix}{code}.po"
try:
chars = set(po_path.read_text(encoding="utf-8"))
except FileNotFoundError:
continue
(unifont if code in UNIFONT_LANGUAGES else base).update(chars)
return tuple(sorted(ord(c) for c in base)), tuple(sorted(ord(c) for c in unifont))
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+3 -1
View File
@@ -82,6 +82,8 @@ class Car:
is_release = self.params.get_bool("IsReleaseBranch")
dp_params = 0
if CI is None:
# wait for one pandaState and one CAN packet
print("Waiting for CAN messages...")
@@ -99,7 +101,7 @@ class Car:
with car.CarParams.from_bytes(cached_params_raw) as _cached_params:
cached_params = _cached_params
self.CI = get_car(*self.can_callbacks, obd_callback(self.params), alpha_long_allowed, is_release, num_pandas, cached_params)
self.CI = get_car(*self.can_callbacks, obd_callback(self.params), alpha_long_allowed, is_release, num_pandas, dp_params, cached_params)
self.RI = interfaces[self.CI.CP.carFingerprint].RadarInterface(self.CI.CP)
self.CP = self.CI.CP
+1 -1
View File
@@ -12,7 +12,7 @@ V_CRUISE_MIN = 8
V_CRUISE_MAX = 145
V_CRUISE_UNSET = 255
V_CRUISE_INITIAL = 40
V_CRUISE_INITIAL_EXPERIMENTAL_MODE = 105
V_CRUISE_INITIAL_EXPERIMENTAL_MODE = 50
IMPERIAL_INCREMENT = round(CV.MPH_TO_KPH, 1) # round here to avoid rounding errors incrementing set speed
ButtonEvent = car.CarState.ButtonEvent
+1 -1
View File
@@ -149,7 +149,7 @@ class TestCarModelBase(unittest.TestCase):
cls.openpilot_enabled = cls.car_safety_mode_frame is not None
cls.CarInterface = interfaces[cls.platform]
cls.CP = cls.CarInterface.get_params(cls.platform, cls.fingerprint, car_fw, alpha_long, False, docs=False)
cls.CP = cls.CarInterface.get_params(cls.platform, cls.fingerprint, car_fw, alpha_long, False, dp_params=0, docs=False)
assert cls.CP
assert cls.CP.carFingerprint == cls.platform
@@ -26,6 +26,8 @@ MIN_ALLOW_THROTTLE_SPEED = 2.5
_A_TOTAL_MAX_V = [1.7, 3.2]
_A_TOTAL_MAX_BP = [20., 40.]
class DPFlags:
pass
def get_max_accel(v_ego):
return np.interp(v_ego, A_CRUISE_MAX_BP, A_CRUISE_MAX_VALS)
@@ -89,7 +91,7 @@ class LongitudinalPlanner:
throttle_prob = 1.0
return x, v, a, j, throttle_prob
def update(self, sm):
def update(self, sm, dp_flags = 0):
mode = 'blended' if sm['selfdriveState'].experimentalMode else 'acc'
if len(sm['carControl'].orientationNED) == 3:
+4 -2
View File
@@ -4,7 +4,7 @@ from openpilot.common.params import Params
from openpilot.common.realtime import Priority, config_realtime_process
from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.controls.lib.ldw import LaneDepartureWarning
from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner
from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner, DPFlags
import cereal.messaging as messaging
@@ -22,10 +22,12 @@ def main():
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'liveParameters', 'radarState', 'modelV2', 'selfdriveState'],
poll='modelV2')
dp_flags = 0
while True:
sm.update()
if sm.updated['modelV2']:
longitudinal_planner.update(sm)
longitudinal_planner.update(sm, dp_flags)
longitudinal_planner.publish(sm, pm)
ldw.update(sm.frame, sm['modelV2'], sm['carState'], sm['carControl'])
+1 -1
View File
@@ -123,7 +123,7 @@ class SelfdriveD:
self.rk = Ratekeeper(100, print_delay_threshold=None)
# Determine startup event
self.startup_event = EventName.startup if build_metadata.openpilot.comma_remote and build_metadata.tested_channel else EventName.startupMaster
self.startup_event = EventName.startup #if build_metadata.openpilot.comma_remote and build_metadata.tested_channel else EventName.startupMaster
if HARDWARE.get_device_type() == 'mici':
self.startup_event = None
if not car_recognized:
+1 -1
View File
@@ -227,6 +227,6 @@ class HomeLayout(Widget):
self._prev_alerts_present = alerts_present
def _get_version_text(self) -> str:
brand = "openpilot"
brand = "dragonpilot"
description = self.params.get("UpdaterCurrentDescription")
return f"{brand} {description}" if description else brand
+13 -1
View File
@@ -2,13 +2,18 @@ from openpilot.common.params import Params
from openpilot.selfdrive.ui.widgets.ssh_key import ssh_key_item
from openpilot.selfdrive.ui.ui_state import ui_state
from openpilot.system.ui.widgets import Widget
from openpilot.system.ui.widgets.list_view import toggle_item
from openpilot.system.ui.widgets.list_view import toggle_item, button_item
from openpilot.system.ui.widgets.scroller_tici import Scroller
from openpilot.system.ui.widgets.confirm_dialog import ConfirmDialog
from openpilot.system.ui.lib.application import gui_app
from openpilot.system.ui.lib.multilang import tr, tr_noop
from openpilot.system.ui.widgets import DialogResult
# rick - for show error logs
from openpilot.system.ui.widgets.html_render import HtmlModal
import os
from openpilot.common.basedir import BASEDIR
# Description constants
DESCRIPTIONS = {
'enable_adb': tr_noop(
@@ -33,6 +38,7 @@ class DeveloperLayout(Widget):
super().__init__()
self._params = Params()
self._is_release = self._params.get_bool("IsReleaseBranch")
self._last_error_log_dialog: HtmlModal | None = None
# Build items and keep references for callbacks/state updates
self._adb_toggle = toggle_item(
@@ -91,6 +97,7 @@ class DeveloperLayout(Widget):
self._long_maneuver_toggle,
self._alpha_long_toggle,
self._ui_debug_toggle,
button_item(lambda: tr("Show Last Errors"), lambda: tr("Show"), callback=self._on_show_last_errors),
], line_separator=True, spacing=0)
# Toggles should be not available to change in onroad state
@@ -183,3 +190,8 @@ class DeveloperLayout(Widget):
self._params.put_bool("AlphaLongitudinalEnabled", False)
self._params.put_bool("OnroadCycleRequested", True)
self._update_toggles()
def _on_show_last_errors(self):
if not self._last_error_log_dialog:
self._last_error_log_dialog = HtmlModal(text=(self._params.get("dp_dev_last_log") or ""))
gui_app.set_modal_overlay(self._last_error_log_dialog)
@@ -13,6 +13,7 @@ from openpilot.system.ui.lib.text_measure import measure_text_cached
from openpilot.system.ui.lib.wifi_manager import WifiManager
from openpilot.system.ui.widgets import Widget
from openpilot.system.ui.widgets.network import NetworkUI
from dragonpilot.selfdrive.ui.layouts.settings.dragonpilot import DragonpilotLayout
# Constants
SIDEBAR_WIDTH = 500
@@ -37,6 +38,7 @@ class PanelType(IntEnum):
SOFTWARE = 3
FIREHOSE = 4
DEVELOPER = 5
DRAGONPILOT = 6
@dataclass
@@ -62,6 +64,7 @@ class SettingsLayout(Widget):
PanelType.SOFTWARE: PanelInfo(tr_noop("Software"), SoftwareLayout()),
PanelType.FIREHOSE: PanelInfo(tr_noop("Firehose"), FirehoseLayout()),
PanelType.DEVELOPER: PanelInfo(tr_noop("Developer"), DeveloperLayout()),
PanelType.DRAGONPILOT: PanelInfo("dp", DragonpilotLayout()),
}
self._font_medium = gui_app.font(FontWeight.MEDIUM)
+14
View File
@@ -31,6 +31,8 @@ DESCRIPTIONS = {
'RecordFront': tr_noop("Upload data from the driver facing camera and help improve the driver monitoring algorithm."),
"IsMetric": tr_noop("Display speed in km/h instead of mph."),
"RecordAudio": tr_noop("Record and store microphone audio while driving. The audio will be included in the dashcam video in comma connect."),
"DisableLogging": tr("Disable logging service"),
"DisableUpdates": tr("Disable update service"),
}
@@ -90,6 +92,18 @@ class TogglesLayout(Widget):
"metric.png",
False,
),
"DisableLogging": (
lambda: tr("Disable Logging"),
DESCRIPTIONS["DisableLogging"],
"",
False,
),
"DisableUpdates": (
lambda: tr("Disable Updates"),
DESCRIPTIONS["DisableUpdates"],
"",
False,
),
}
self._long_personality_setting = multiple_button_item(
+2 -2
View File
@@ -43,7 +43,7 @@ class DeviceStatus(Widget):
self._version_text = self._get_version_text()
def _get_version_text(self) -> str:
brand = "openpilot"
brand = "dragonpilot"
description = ui_state.params.get("UpdaterCurrentDescription")
return f"{brand} {description}" if description else brand
@@ -109,7 +109,7 @@ class MiciHomeLayout(Widget):
self._cell_high_txt = gui_app.texture("icons_mici/settings/network/cell_strength_high.png", 55, 35)
self._cell_full_txt = gui_app.texture("icons_mici/settings/network/cell_strength_full.png", 55, 35)
self._openpilot_label = MiciLabel("openpilot", font_size=96, color=rl.Color(255, 255, 255, int(255 * 0.9)), font_weight=FontWeight.DISPLAY)
self._openpilot_label = MiciLabel("dragonpilot", font_size=96, color=rl.Color(255, 255, 255, int(255 * 0.9)), font_weight=FontWeight.DISPLAY)
self._version_label = MiciLabel("", font_size=36, font_weight=FontWeight.ROMAN)
self._large_version_label = MiciLabel("", font_size=64, color=rl.GRAY, font_weight=FontWeight.ROMAN)
self._date_label = MiciLabel("", font_size=36, color=rl.GRAY, font_weight=FontWeight.ROMAN)
+1 -1
View File
@@ -20,7 +20,7 @@ class ExpButton(Widget):
self._white_color: rl.Color = rl.Color(255, 255, 255, 255)
self._black_bg: rl.Color = rl.Color(0, 0, 0, 166)
self._txt_wheel: rl.Texture = gui_app.texture('icons/chffr_wheel.png', icon_size, icon_size)
self._txt_wheel: rl.Texture = gui_app.texture('../../dragonpilot/selfdrive/assets/icons/chffr_wheel.png', icon_size, icon_size)
self._txt_exp: rl.Texture = gui_app.texture('icons/experimental.png', icon_size, icon_size)
self._rect = rl.Rectangle(0, 0, button_size, button_size)
+7
View File
@@ -40,3 +40,10 @@ def update_translations():
if __name__ == "__main__":
update_translations()
# Also update dragonpilot translations if available
try:
from dragonpilot.selfdrive.ui.update_translations import update_translations as update_dp_translations
update_dp_translations()
except ImportError:
pass