IQ.Pilot Release Commit @ d2ce8a8

This commit is contained in:
IQ.Lvbs CI [bot]
2026-08-28 08:35:52 -05:00
parent 9206164707
commit ee1dca77c7
210 changed files with 19726 additions and 455 deletions

View File

@@ -0,0 +1,71 @@
"""
Copyright © IQ.Lvbs, apart of Project Teal Lvbs, All Rights Reserved, licensed under https://konn3kt.com/tos/
"""
import math
from enum import IntEnum
import pyray as rl
from iqpilot.common.params import Params
from iqpilot.system.ui.lib.text_measure import measure_text_cached
class SourceState(IntEnum):
HIDDEN = 0
LOADING = 1
ACTIVE = 2
FAILED = 3
CROSSED = 4
_GREEN = rl.Color(46, 204, 113, 255)
_ORANGE = rl.Color(255, 115, 0, 255)
_WHITE = rl.Color(255, 255, 255, 255)
def _emac_state(params: Params, engaged: bool) -> SourceState:
if not params.get_bool("MacModelReachable"):
return SourceState.HIDDEN
if params.get_bool("MacModelActive"):
return SourceState.ACTIVE
if params.get_bool("MacModelFailed"):
return SourceState.CROSSED if engaged else SourceState.FAILED
return SourceState.LOADING
def _egpu_state(params: Params, engaged: bool) -> SourceState:
if not params.get_bool("UsbGpuPresent"):
return SourceState.HIDDEN
if params.get_bool("UsbGpuActive"):
return SourceState.ACTIVE
if params.get_bool("UsbGpuFailed"):
return SourceState.CROSSED if engaged else SourceState.FAILED
return SourceState.LOADING
def resolve_source(params: Params, engaged: bool) -> tuple[str, SourceState]:
if params.get_bool("IQEmacEnabled"):
return "MAC", _emac_state(params, engaged)
if params.get_bool("UsbGpuPresent") or params.get_bool("IQEgpuEnabled"):
return "GPU", _egpu_state(params, engaged)
return "", SourceState.HIDDEN
def draw_source_label(font: rl.Font, label: str, state: SourceState,
pos: rl.Vector2, font_size: int) -> None:
if state == SourceState.HIDDEN or not label:
return
if state == SourceState.ACTIVE:
color, opacity, strike = _GREEN, 1.0, False
elif state == SourceState.FAILED:
color, opacity, strike = _ORANGE, 1.0, False
elif state == SourceState.CROSSED:
color, opacity, strike = _WHITE, 0.65, True
else:
color, opacity, strike = _WHITE, 0.35 + 0.65 * (0.5 - 0.5 * math.cos(rl.get_time() * 6.0)), False
col = rl.Color(color.r, color.g, color.b, int(255 * opacity))
rl.draw_text_ex(font, label, pos, font_size, 0, col)
if strike:
size = measure_text_cached(font, label, font_size)
y = int(pos.y + size.y / 2)
rl.draw_line_ex(rl.Vector2(pos.x - 2, y), rl.Vector2(pos.x + size.x + 2, y), 4, col)

View File

@@ -0,0 +1,44 @@
"""
Copyright © IQ.Lvbs, apart of Project Teal Lvbs, All Rights Reserved, licensed under https://konn3kt.com/tos/
"""
import time
import pyray as rl
from iqpilot.common.params import Params
from iqpilot.ui.onroad.big_model_status import SourceState, draw_source_label, resolve_source
from iqpilot.selfdrive.ui import UI_BORDER_SIZE
from iqpilot.selfdrive.ui.onroad.driver_state import BTN_SIZE
from iqpilot.selfdrive.ui.ui_state import ui_state
from iqpilot.system.ui.lib.application import FontWeight, gui_app
from iqpilot.system.ui.lib.text_measure import measure_text_cached
from iqpilot.system.ui.widgets import Widget
_POLL_S = 1.0
_FONT_SIZE = 70
class EmacStatusRenderer(Widget):
def __init__(self):
super().__init__()
self._params = Params()
self._font = gui_app.font(FontWeight.SEMI_BOLD)
self._last_poll = 0.0
self._label = ""
self._state = SourceState.HIDDEN
def update(self):
now = time.monotonic()
if now - self._last_poll < _POLL_S:
return
self._last_poll = now
self._label, self._state = resolve_source(self._params, ui_state.engaged)
def _render(self, rect: rl.Rectangle):
if self._state == SourceState.HIDDEN:
return
size = measure_text_cached(self._font, self._label, _FONT_SIZE)
x = rect.x + UI_BORDER_SIZE + BTN_SIZE // 2 - size.x / 2
y = rect.y + rect.height / 2 - size.y / 2
draw_source_label(self._font, self._label, self._state, rl.Vector2(x, y), _FONT_SIZE)

View File

@@ -16,6 +16,7 @@ from iqpilot.ui.onroad.hud_overlays import (
)
from iqpilot.ui.onroad.nav_map_panel import NavMapPanel
from iqpilot.ui.onroad.soft_warning import SoftWarningRenderer
from iqpilot.ui.onroad.emac_status import EmacStatusRenderer
ENABLE_FLOATING_NAV_MAP_PANEL = False
ENABLE_SPLIT_NAV_MAP_PANEL = True
@@ -25,6 +26,7 @@ class IQHudRenderer(HudRenderer):
def __init__(self):
super().__init__()
self.developer_ui = IQDevMetricsOverlay()
self.emac_status = EmacStatusRenderer()
self.nav_map_panel = NavMapPanel()
self.road_name_renderer = RoadNameRenderer()
self.rocket_fuel = IQAccelBar()
@@ -38,6 +40,7 @@ class IQHudRenderer(HudRenderer):
super()._update_state()
if ENABLE_FLOATING_NAV_MAP_PANEL or ENABLE_SPLIT_NAV_MAP_PANEL:
self.nav_map_panel.update()
self.emac_status.update()
self.road_name_renderer.update()
self.speed_limit_renderer.update()
has_limit = self.speed_limit_renderer.speed_limit_valid or self.speed_limit_renderer.speed_limit_last_valid
@@ -65,6 +68,7 @@ class IQHudRenderer(HudRenderer):
self.developer_ui.render(rect)
if ENABLE_FLOATING_NAV_MAP_PANEL:
self.nav_map_panel.render(rect)
self.emac_status.render(rect)
self.road_name_renderer.render(torque_rect)
self.turn_signal_controller.render(rect)
self.soft_warning_renderer.render(rect)