feat(v1): edit detection sensitivity from the settings tab

Adds write_local_event_tuning and a sensitivity group (confirm window,
horizontal angle, require-rapid-drop, require-lower-body) that persists to
the untracked local config and applies next start. 79 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ila
2026-07-22 00:00:51 +08:00
co-authored by Claude Opus 4.8
parent 922609f236
commit d3cd8ecb55
7 changed files with 123 additions and 4 deletions
+25
View File
@@ -196,6 +196,31 @@ def write_local_camera_source(
return path
def write_local_event_tuning(
config_path: Path,
require_rapid_drop: bool,
require_lower_body: bool,
horizontal_angle_threshold_degrees: float,
confirm_window_seconds: float,
) -> Path:
"""Persist detection-sensitivity tuning into the local config's event block.
Only the tuning keys are updated; other event fields are preserved. Applies
at the next start (the running config is a start-time snapshot).
"""
path = Path(config_path)
data = json.loads(path.read_text(encoding="utf-8"))
event = dict(data.get("event", {}))
event["require_rapid_drop"] = bool(require_rapid_drop)
event["require_lower_body"] = bool(require_lower_body)
event["horizontal_angle_threshold_degrees"] = float(horizontal_angle_threshold_degrees)
event["confirm_window_seconds"] = float(confirm_window_seconds)
data["event"] = event
path.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
return path
def load_config(path: Path) -> AppConfig:
"""Load one public/local configuration pair without persisting credentials.