feat(vesc): extend motor diagnostics, configuration and transport recovery
Add firmware and extension catalogues, configuration transactions, sample review and QML diagnostics. Preserve explicit authority, bounded retries and stop recovery in motor transport.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Read-only recovery of missing bound devices before motor ownership began."""
|
||||
import copy
|
||||
import re
|
||||
|
||||
from .release_observation import ReleaseObservation
|
||||
|
||||
|
||||
class PreflightRecovery:
|
||||
def __init__(self, profile):
|
||||
self.profile = copy.deepcopy(profile)
|
||||
self.proof = None
|
||||
|
||||
def reset(self):
|
||||
self.proof = None
|
||||
|
||||
def check(self, profile, devices, now, receiver_active, limits_pending):
|
||||
if profile != self.profile:
|
||||
self.reset()
|
||||
return False
|
||||
selected = []
|
||||
for binding in self.profile["bindings"].values():
|
||||
matches = [d for d in devices if d.id == binding["device_id"]]
|
||||
if len(matches) != 1:
|
||||
self.reset()
|
||||
return False
|
||||
d = matches[0]
|
||||
expected = binding.get("uuid", "")
|
||||
if (not re.fullmatch(r"[0-9a-f]{24}", expected)
|
||||
or d.identity.get("uuid") != expected
|
||||
or getattr(d, "identified_session", None) != d.session
|
||||
or not d.link or not getattr(d.link, "alive", True)
|
||||
or limits_pending(d)):
|
||||
self.reset()
|
||||
return False
|
||||
selected.append(d)
|
||||
if not selected:
|
||||
return False
|
||||
if self.proof is None:
|
||||
self.proof = ReleaseObservation(selected, now)
|
||||
return self.proof.check(selected, now, receiver_active)
|
||||
Reference in New Issue
Block a user