Files
NODEDC_MISSION_CORE/plugins/vesc/runtime/maintenance_state.py
DCCONSTRUCTIONS f32c7b400b 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.
2026-10-29 09:09:59 +03:00

40 lines
1.5 KiB
Python

"""Quiescence proof excludes every powered/pending owner; closes transport only."""
def idle(service):
remote = service.remote
trace=getattr(remote,"trace",None)
if trace and (trace.active() or not trace.log.closed):
return "diagnostic-capture-active"
with remote.lock:
if remote.lease.live() or (remote.thread and remote.thread.is_alive()):
return "control-active"
if remote.release_confirmed is False:
return "release-unconfirmed"
if service.motor.active:
return "motor-procedure-active"
with service.firmware_update.lock:
if service.firmware_update.active:
return "firmware-active"
patterns = ("limits_*.json", "*pending*.json", "code-execution-*.json")
if any(any(service.root.glob(pattern)) for pattern in patterns):
return "device-change-unresolved"
with service.lock:
devices = list(service.devices.values())
if any(service.samples.active(d) for d in devices):
return "sample-capture-active"
return None
def quiesce(service):
# Admission is closed and both discovery/observer callbacks have drained.
# No stop/current/lease/release/configuration RPC is issued here.
with service.lock:
devices = list(service.devices.values())
service.devices.clear()
for device in devices:
device.close()
with service.remote.lock:
service.remote.primed = False
service.remote.state = "observing"