feat(dev): correlate telemetry recovery, safety stops and passive drive evidence
This commit is contained in:
@@ -1,18 +1,26 @@
|
||||
"""Versioned opt-in capture choices. Local-only sends no diagnostic rows."""
|
||||
LEGACY_OPTIONS = {"live": True, "core_trace": True, "motor_samples": True, "network": True,
|
||||
"live_kbps": 32, "core_kbps": 32}
|
||||
LOCAL_OPTIONS = {**LEGACY_OPTIONS, "live": False, "core_trace": False, "live_kbps": 16, "core_kbps": 16}
|
||||
"live_kbps": 32, "core_kbps": 32, "router": False,
|
||||
"system": False, "passive": False}
|
||||
LOCAL_OPTIONS = {**LEGACY_OPTIONS, "live": False, "core_trace": False,
|
||||
"live_kbps": 16, "core_kbps": 16}
|
||||
|
||||
PASSIVE_OPTIONS = {**LOCAL_OPTIONS, "passive": True, "router": True, "system": True}
|
||||
|
||||
|
||||
def diagnostic_options(value):
|
||||
if value is None:
|
||||
return dict(LEGACY_OPTIONS)
|
||||
if not isinstance(value, dict) or set(value) != set(LEGACY_OPTIONS):
|
||||
if (not isinstance(value, dict) or set(value) - set(LEGACY_OPTIONS)
|
||||
or set(LEGACY_OPTIONS) - {"router", "system", "passive"} - set(value)):
|
||||
raise ValueError("Invalid diagnostic options")
|
||||
for key in ("live", "core_trace", "motor_samples", "network"):
|
||||
value = {"router": False, "system": False, "passive": False, **value}
|
||||
for key in ("live", "core_trace", "motor_samples", "network", "router", "system", "passive"):
|
||||
if type(value[key]) is not bool:
|
||||
raise ValueError("Invalid diagnostic option")
|
||||
for key in ("live_kbps", "core_kbps"):
|
||||
if type(value[key]) is not int or value[key] not in (8, 16, 32, 64):
|
||||
raise ValueError("Invalid diagnostic rate")
|
||||
if value["passive"] and (value["live"] or value["core_trace"]):
|
||||
raise ValueError("Passive capture cannot transmit diagnostic events")
|
||||
return dict(value)
|
||||
|
||||
Reference in New Issue
Block a user