mici: no override blink, static lead car when disengaged (#39335)

This commit is contained in:
Adeeb Shihadeh
2026-11-28 16:38:53 -06:00
committed by firestar5683
parent 651f2f36dd
commit 939bdbf000
2 changed files with 11 additions and 3 deletions
+4 -2
View File
@@ -53,8 +53,10 @@ class PersonalityWidget:
texture = gui_app.texture('icons_mici/longitudinal/speed_dial.png')
self._draw_centered((texture, 56, 48), rect, 126, 0.9)
return
self.draw(rect, personality=state.personality, has_lead=state.lead_detected, longitudinal_active=state.cruise_active,
traffic_mode=state.traffic_selected or state.traffic_mode, gas_override=state.gas_pressed_override, visible=routine)
driver_feedback = profile == Profile.LARGE or state.appearance.wheel_pedal_feedback
self.draw(rect, personality=state.personality, has_lead=state.lead_detected and (state.cruise_active or driver_feedback),
longitudinal_active=state.cruise_active, traffic_mode=state.traffic_selected or state.traffic_mode,
gas_override=state.gas_pressed_override and driver_feedback, visible=routine)
def draw(self, rect: rl.Rectangle, *, personality: int, has_lead: bool, longitudinal_active: bool,
traffic_mode: bool = False, gas_override: bool = False, visible: bool = True, fit: bool = True) -> None:
@@ -8,6 +8,7 @@ import pytest
from openpilot.selfdrive.ui.mici.onroad import long_indicator as native
from openpilot.starpilot.ui import onroad_personality as indicator
from openpilot.starpilot.ui.appearance_preferences import OnroadAppearance
from openpilot.starpilot.ui.onroad_customization import default_document
from openpilot.starpilot.ui.onroad_state import AlertSize, OnroadAlert, OnroadState, SpeedLimitObservation
from openpilot.starpilot.ui.presentation import BitmapFonts, Profile
@@ -44,7 +45,8 @@ def test_same_selected_bars_and_lead_on_both_profiles(display, profile, personal
assert all(draws[2 + 2*i].args[3] == pytest.approx(.9 if i <= personality else .35, abs=.001) for i in range(3))
for has_lead, active, white, green in ((False, True, .35, 0), (True, False, 1, 0), (True, True, 0, 1)):
draws = settle(display, road(lead_detected=has_lead, longitudinal_active=active))
assert draws[0].args[3] == pytest.approx(white, abs=.001)
expected_white = .35 if profile == Profile.COMPACT and not active else white
assert draws[0].args[3] == pytest.approx(expected_white, abs=.001)
assert draws[1].args[3] == pytest.approx(green, abs=.001)
@@ -87,6 +89,10 @@ def test_gas_override_blinks_only_selected_bars_and_clears_on_disengagement(disp
monkeypatch.setattr(rl, 'get_time', lambda: 1.1)
state = road(personality=1, gas_pressed_override=True)
draws = settle(display, state)
assert draws[2].args[3] == pytest.approx(.9, abs=.001)
assert draws[4].args[3] == pytest.approx(.9, abs=.001)
state = replace(state, appearance=OnroadAppearance(wheel_pedal_feedback=True))
draws = settle(display, state)
assert draws[2].args[3] == pytest.approx(.35, abs=.001)
assert draws[4].args[3] == pytest.approx(.35, abs=.001)
assert draws[6].args[3] == pytest.approx(.35, abs=.001)