Update readme and add UDS

This commit is contained in:
2026-01-30 16:53:05 +03:00
parent 19d3885bb2
commit cfccf5e75c
10 changed files with 1736 additions and 105 deletions

View File

@@ -78,14 +78,21 @@ class PageManager:
generator=self._generate_app_status_page,
))
# Page 4: UPS Status
# Page 4: UDS Extended Data
self._pages.append(PageDefinition(
page_type=PageType.INFO,
title="UDS Data",
generator=self._generate_uds_page,
))
# Page 5: UPS Status
self._pages.append(PageDefinition(
page_type=PageType.INFO,
title="UPS Status",
generator=self._generate_ups_page,
))
# Page 5: Actions Menu (last navigable page)
# Page 6: Actions Menu (last navigable page)
self._pages.append(PageDefinition(
page_type=PageType.MENU,
title="Actions",
@@ -343,14 +350,14 @@ class PageManager:
if self._pending_action:
action = self._pending_action
self._pending_action = None
self._current_index = 5 # Back to actions menu
self._current_index = 6 # Back to actions menu
return self.execute_action(action)
return False, "No pending action"
def cancel_action(self) -> None:
"""Cancel pending action."""
self._pending_action = None
self._current_index = 5 # Back to actions menu
self._current_index = 6 # Back to actions menu
def _get_action_success_message(self, action_id: ActionID) -> str:
"""Get success message for action."""
@@ -516,6 +523,62 @@ class PageManager:
return Page(PageType.INFO, "System", lines)
def _generate_uds_page(self, mgr: "PageManager") -> Page:
"""Generate UDS extended diagnostics page."""
uds_values = mgr.get_data("uds_values", {})
uds_stats = mgr.get_data("uds_stats", {})
if not uds_values and not uds_stats:
lines = ["UDS not enabled", "", "Enable in config.json:", '"uds": {"enabled": true}']
return Page(PageType.INFO, "UDS Data", lines)
lines = []
# Key UDS values
# Boost pressure (0x202A)
if 0x202A in uds_values:
v = uds_values[0x202A]
lines.append(f"Boost: {v.value:.0f} kPa")
# Torque (0x437C)
if 0x437C in uds_values:
v = uds_values[0x437C]
lines.append(f"Torque: {v.value:.0f} Nm")
# Lambda (0x10C0)
if 0x10C0 in uds_values:
v = uds_values[0x10C0]
lines.append(f"Lambda: {v.value:.3f}")
# Ignition timing (0x2004)
if 0x2004 in uds_values:
v = uds_values[0x2004]
lines.append(f"Timing: {v.value:.1f} deg")
# Wastegate (0x39A2)
if 0x39A2 in uds_values:
v = uds_values[0x39A2]
lines.append(f"Wastegate: {v.value:.0f}%")
# Gear (0x3816)
if 0x3816 in uds_values:
v = uds_values[0x3816]
gear = int(v.value)
gear_str = "R" if gear == -1 else ("N" if gear == 0 else str(gear))
lines.append(f"Gear: {gear_str}")
# Stats
if uds_stats:
queries = uds_stats.get("queries", 0)
successes = uds_stats.get("successes", 0)
rate = (successes / queries * 100) if queries > 0 else 0
lines.append(f"UDS: {rate:.0f}% success")
if not lines:
lines = ["Waiting for UDS data..."]
return Page(PageType.INFO, "UDS Data", lines)
def _generate_actions_page(self, mgr: "PageManager") -> Page:
"""Generate actions menu page."""
actions = [