添加无线模块

This commit is contained in:
minghanchen
2026-08-19 09:59:36 +08:00
parent 344f662970
commit 52c4dd08f9
33 changed files with 4740 additions and 246 deletions
@@ -113,6 +113,7 @@ class HardwareSeatExecutor:
firmware_guard: T2GFirmwareGuard | None = None,
synchronize_position_before_first_motion: bool = False,
position_sync_state: dict[str, bool] | None = None,
require_thermal_feedback: bool = True,
):
self.matrix = matrix
self.bus_factory = bus_factory
@@ -134,6 +135,7 @@ class HardwareSeatExecutor:
if position_sync_state is not None
else {"synchronized": False}
)
self.require_thermal_feedback = bool(require_thermal_feedback)
self._current_samples: dict[int, list[dict[str, Any]]] = {}
@classmethod
@@ -469,26 +471,30 @@ class HardwareSeatExecutor:
"feedback_value": raw,
}
@staticmethod
def _physical_state_complete(state: dict[str, Any]) -> bool:
def _physical_state_complete(self, state: dict[str, Any]) -> bool:
positions_complete = set(state.get("position", {})) == set(
PHYSICAL_MOTOR_AXES.values()
)
if not self.require_thermal_feedback:
return positions_complete
return (
set(state.get("position", {})) == set(PHYSICAL_MOTOR_AXES.values())
positions_complete
and isinstance(state.get("ventilation"), dict)
and isinstance(state.get("heating"), dict)
)
@staticmethod
def _physical_state_missing(state: dict[str, Any]) -> list[str]:
def _physical_state_missing(self, state: dict[str, Any]) -> list[str]:
missing = [
axis
for axis in PHYSICAL_MOTOR_AXES.values()
if axis not in state.get("position", {})
]
missing.extend(
feature
for feature in ("ventilation", "heating")
if not isinstance(state.get(feature), dict)
)
if self.require_thermal_feedback:
missing.extend(
feature
for feature in ("ventilation", "heating")
if not isinstance(state.get(feature), dict)
)
return missing
@staticmethod