Compare commits

..

10 Commits

Author SHA1 Message Date
royjr 62c313771c Merge branch 'master' into chestnut-show-with-mads 2026-09-06 15:47:21 -04:00
royjr 75fec0de58 Update opendbc_repo 2026-09-02 15:18:09 -04:00
royjr f700614975 Update opendbc_repo 2026-09-02 15:17:34 -04:00
royjr 5683b7c39a Revert "Update opendbc_repo"
This reverts commit d3d8a351ea.
2026-09-02 15:17:30 -04:00
royjr 78658ee0de Merge branch 'master' into chestnut-show-with-mads 2026-09-02 15:17:01 -04:00
royjr d3d8a351ea Update opendbc_repo 2026-09-02 15:16:56 -04:00
royjr 9bd8bf12cb move to sp 2026-09-02 02:28:52 -04:00
royjr f73584ab5b Revert "try simple"
This reverts commit b951385080.
2026-08-31 10:28:21 -04:00
royjr 2bce77a18e try simple 2026-08-31 10:28:20 -04:00
royjr 63f875d6a0 ui engaged 2026-08-31 10:28:20 -04:00
3 changed files with 20 additions and 30 deletions
@@ -62,25 +62,7 @@ class MiciFccModal(NavRawScrollPanel):
rl.draw_texture_ex(self._fcc_logo, fcc_pos, 0.0, 1.0, rl.WHITE)
class DisengageDialog(BigDialog):
def __init__(self, title: str, description: str, disengaged_callback: Callable[[], None]):
super().__init__(title, description)
self._disengaged_callback = disengaged_callback
def _update_state(self):
super()._update_state()
if not ui_state.engaged and not self.is_dismissing:
self.dismiss(self._disengaged_callback)
class EngagedConfirmationDialog(BigConfirmationDialog):
def _update_state(self):
super()._update_state()
if ui_state.engaged and not self.is_dismissing:
self.dismiss()
def engaged_confirmation_click(callback: Callable, action_text: str, icon: rl.Texture, exit_on_confirm: bool = True, red: bool = False):
def _engaged_confirmation_click(callback: Callable, action_text: str, icon: rl.Texture, exit_on_confirm: bool = True, red: bool = False):
if not ui_state.engaged:
def confirm_callback():
# Check engaged again in case it changed while the dialog was open
@@ -88,26 +70,23 @@ def engaged_confirmation_click(callback: Callable, action_text: str, icon: rl.Te
if not ui_state.engaged:
callback()
gui_app.push_widget(EngagedConfirmationDialog(f"slide to\n{action_text.lower()}", icon, confirm_callback,
exit_on_confirm=exit_on_confirm, red=red))
gui_app.push_widget(BigConfirmationDialog(f"slide to\n{action_text.lower()}", icon, confirm_callback, exit_on_confirm=exit_on_confirm, red=red))
else:
gui_app.push_widget(DisengageDialog("", f"Disengage to {action_text}",
lambda: engaged_confirmation_click(callback, action_text, icon,
exit_on_confirm=exit_on_confirm, red=red)))
gui_app.push_widget(BigDialog("", f"Disengage to {action_text}"))
class EngagedConfirmationCircleButton(BigCircleButton):
def __init__(self, title: str, icon: rl.Texture, callback: Callable[[], None], exit_on_confirm: bool = True,
red: bool = False, icon_offset: tuple[int, int] = (0, 0)):
super().__init__(icon, red, icon_offset)
self.set_click_callback(lambda: engaged_confirmation_click(callback, title, icon, exit_on_confirm=exit_on_confirm, red=red))
self.set_click_callback(lambda: _engaged_confirmation_click(callback, title, icon, exit_on_confirm=exit_on_confirm, red=red))
class EngagedConfirmationButton(BigButton):
def __init__(self, text: str, action_text: str, icon: rl.Texture, callback: Callable[[], None],
exit_on_confirm: bool = True, red: bool = False):
super().__init__(text, "", icon)
self.set_click_callback(lambda: engaged_confirmation_click(callback, action_text, icon, exit_on_confirm=exit_on_confirm, red=red))
self.set_click_callback(lambda: _engaged_confirmation_click(callback, action_text, icon, exit_on_confirm=exit_on_confirm, red=red))
class DeviceInfoLayoutMici(Widget):
@@ -6,9 +6,9 @@ See the LICENSE.md file in the root directory for more details.
"""
from openpilot.selfdrive.ui.mici.layouts.settings import settings as OP
from openpilot.selfdrive.ui.mici.layouts.settings.settings import SettingsBigButton
from openpilot.selfdrive.ui.mici.layouts.settings.device import DeviceLayoutMici, engaged_confirmation_click
from openpilot.selfdrive.ui.mici.layouts.settings.device import DeviceLayoutMici
from openpilot.selfdrive.ui.mici.widgets.button import BigCircleButton
from openpilot.selfdrive.ui.mici.widgets.dialog import BigConfirmationDialog
from openpilot.selfdrive.ui.mici.widgets.dialog import BigConfirmationDialog, BigDialog
from openpilot.selfdrive.ui.sunnypilot.mici.layouts.sunnylink import SunnylinkLayoutMici
from openpilot.selfdrive.ui.sunnypilot.mici.layouts.models import ModelsLayoutMici
from openpilot.selfdrive.ui.ui_state import ui_state
@@ -93,6 +93,10 @@ class SettingsLayoutSP(OP.SettingsLayout):
dlg = BigConfirmationDialog(tr("slide to exit always offroad"), self.icon_offroad_slider, red=False,
confirm_callback=lambda: _set_offroad_status(False))
else:
engaged_confirmation_click(lambda: _set_offroad_status(True), "force offroad", self.icon_offroad_slider, red=True)
return
if ui_state.engaged:
gui_app.push_widget(BigDialog(tr("disengage to enable always offroad"), "", ))
return
dlg = BigConfirmationDialog(tr("slide to force offroad"), self.icon_offroad_slider, red=True,
confirm_callback=lambda: _set_offroad_status(True))
gui_app.push_widget(dlg)
@@ -8,17 +8,24 @@ import pyray as rl
from openpilot.selfdrive.ui.mici.onroad.hud_renderer import HudRenderer
from openpilot.selfdrive.ui.sunnypilot.onroad.blind_spot_indicators import BlindSpotIndicators
from openpilot.selfdrive.ui.ui_state import ui_state
class HudRendererSP(HudRenderer):
def __init__(self):
super().__init__()
self.blind_spot_indicators = BlindSpotIndicators()
self._sp_engaged: bool = False
def _update_state(self) -> None:
super()._update_state()
self.blind_spot_indicators.update()
sp_engaged = ui_state.engaged
if sp_engaged != self._sp_engaged:
self._chestnut_fade_time = rl.get_time() if sp_engaged else 0
self._sp_engaged = sp_engaged
def _render(self, rect: rl.Rectangle) -> None:
super()._render(rect)
self.blind_spot_indicators.render(rect)