优化后端
This commit is contained in:
@@ -377,14 +377,18 @@ def decode_feedback(frame: CanFrame) -> dict[str, Any]:
|
||||
"rear_brightness_level": (
|
||||
rear_brightness_raw - 1 if 1 <= rear_brightness_raw <= 6 else None
|
||||
),
|
||||
# Sheet1 rows 1896-1897 define 0x01-0x1F as colors and
|
||||
# 0x20-0x7F as reserved. Do not expose a reserved raw value
|
||||
# as though it were a real cabin color.
|
||||
# 0x42E carries a 7-bit vehicle-profile color index. The
|
||||
# generic matrix labels 0x20-0x7F as reserved, but the N7
|
||||
# 127-color profile and its verified control/HIL contract use
|
||||
# the complete 0x01-0x7F range. Preserve that authoritative
|
||||
# index for display and feedback matching; zero remains the
|
||||
# matrix-defined invalid value. Exact RGB still cannot be
|
||||
# inferred from this frame.
|
||||
"front_color_index": (
|
||||
front_color if 1 <= front_color <= 0x1F else None
|
||||
front_color if 1 <= front_color <= 0x7F else None
|
||||
),
|
||||
"rear_color_index": (
|
||||
rear_color if 1 <= rear_color <= 0x1F else None
|
||||
rear_color if 1 <= rear_color <= 0x7F else None
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ from cognitive_agent.application.mode_profile_intent import ( # noqa: E402
|
||||
from cognitive_agent.application.seat_service import ( # noqa: E402
|
||||
LOCAL_CONTROL_BUDGET_MS,
|
||||
SeatDemoService,
|
||||
WIRELESS_MQTT_TRANSPORT,
|
||||
)
|
||||
from cognitive_agent.application.self_extension import ( # noqa: E402
|
||||
ExtensionIntegrationError,
|
||||
@@ -341,7 +342,11 @@ class SeatDemoHandler(BaseHTTPRequestHandler):
|
||||
vehicle_id,
|
||||
control_transport=control_transport,
|
||||
hardware_client_id=hardware_client_id,
|
||||
hardware_access_bypass=self._hardware_access_bypass_allowed(),
|
||||
hardware_access_bypass=(
|
||||
self._passive_state_access_bypass_allowed(
|
||||
control_transport
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
except HardwareAccessRequiredError as exc:
|
||||
@@ -3645,6 +3650,23 @@ class SeatDemoHandler(BaseHTTPRequestHandler):
|
||||
and self._session_username() is not None
|
||||
)
|
||||
|
||||
def _passive_state_access_bypass_allowed(
|
||||
self,
|
||||
control_transport: str,
|
||||
) -> bool:
|
||||
"""Keep cached MQTT telemetry readable without widening control access.
|
||||
|
||||
The wireless state endpoints only consume the process-local snapshot
|
||||
populated by the persistent MQTT subscription; they never publish a
|
||||
frame or reserve the local CAN bench. Mutating control handlers must
|
||||
continue to call ``_hardware_access_bypass_allowed`` directly.
|
||||
"""
|
||||
|
||||
return (
|
||||
control_transport == WIRELESS_MQTT_TRANSPORT
|
||||
or self._hardware_access_bypass_allowed()
|
||||
)
|
||||
|
||||
def _require_local_decision_point(self) -> bool:
|
||||
if self._is_unproxied_loopback_request():
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user