mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 18:23:51 +08:00
mici: fade everything with status_fade (#39356)
This commit is contained in:
committed by
firestar5683
parent
88fa0e0596
commit
125c98bfef
@@ -11,6 +11,7 @@ from openpilot.starpilot.ui.raylib import rl
|
||||
|
||||
from opendbc.car.structs import car
|
||||
from openpilot.common.filter_simple import FirstOrderFilter
|
||||
from openpilot.selfdrive.ui.mici.onroad import blend_colors
|
||||
from openpilot.starpilot.ui.onroad_customization import offset as widget_offset, placement, rgba, widget_size
|
||||
from openpilot.starpilot.ui.onroad_state import AlertSize, ObservationKind, OnroadState, is_lane_change_notice, manual_slc_confirmation
|
||||
from openpilot.starpilot.ui.onroad_curve import controlling as curve_controlling
|
||||
@@ -259,6 +260,7 @@ class MiciSidebarWidgets:
|
||||
self.fonts = fonts
|
||||
self.personality = PersonalityWidget(fonts)
|
||||
self._confidence_filter = FirstOrderFilter(-0.5, 0.5, 1 / 60)
|
||||
self._confidence_tint = CompactStatusFade(0.25)
|
||||
self._confidence_drive_frame: int | None = None
|
||||
self._confidence_stamp_ns: int | None = None
|
||||
|
||||
@@ -325,9 +327,12 @@ class MiciSidebarWidgets:
|
||||
if (stamp is None or state.model_confidence is None or state.stock_confidence_drive_frame != self._confidence_drive_frame or
|
||||
self._confidence_stamp_ns is not None and (stamp < self._confidence_stamp_ns or stamp - self._confidence_stamp_ns > 200_000_000)):
|
||||
self._confidence_filter.x = -0.5
|
||||
self._confidence_tint.reset()
|
||||
self._confidence_drive_frame = state.stock_confidence_drive_frame
|
||||
self._confidence_stamp_ns = stamp
|
||||
if active and stamp is not None and state.model_confidence is not None:
|
||||
visible = active and stamp is not None and state.model_confidence is not None
|
||||
tint = self._confidence_tint.update(state, visible)
|
||||
if visible and state.model_confidence is not None:
|
||||
confidence = self._confidence_filter.update(state.model_confidence)
|
||||
if confidence > 0.5:
|
||||
top, bottom = rl.Color(0, 255, 204, 255), rl.Color(0, 255, 38, 255)
|
||||
@@ -335,6 +340,8 @@ class MiciSidebarWidgets:
|
||||
top, bottom = rl.Color(255, 200, 0, 255), rl.Color(255, 115, 0, 255)
|
||||
else:
|
||||
top, bottom = rl.Color(255, 0, 21, 255), rl.Color(255, 0, 89, 255)
|
||||
top = blend_colors(rl.WHITE, top, tint)
|
||||
bottom = blend_colors(rl.Color(82, 82, 82, 255), bottom, tint)
|
||||
else:
|
||||
top, bottom = rl.Color(50, 50, 50, 255), rl.Color(13, 13, 13, 255)
|
||||
rl.draw_rectangle_gradient_v(int(center_x - radius), int(center_y - radius), 2 * radius, 2 * radius, top, bottom)
|
||||
|
||||
Reference in New Issue
Block a user