perf(homekit): optimize motion detector with frame-based timing
Replace time.Now() calls in hot path with frame-based timing: - Pre-compute triggerLevel (integer comparison instead of float division) - Calibrate hold/cooldown budgets from FPS (default 30fps) - Periodic FPS recalibration every 150 frames for accuracy - Active motion path: 47ns → 3.6ns (13x faster) Update schema.json with detect mode and motion_threshold. Add threshold tuning guide to README.
This commit is contained in:
+8
-2
@@ -338,13 +338,19 @@
|
||||
"default": false
|
||||
},
|
||||
"motion": {
|
||||
"description": "Motion detection mode for HKSV: `api` (triggered via HTTP API) or `continuous` (always report motion)",
|
||||
"description": "Motion detection mode for HKSV: `api` (triggered via HTTP API), `continuous` (always report motion), or `detect` (automatic detection based on P-frame size analysis)",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"api",
|
||||
"continuous"
|
||||
"continuous",
|
||||
"detect"
|
||||
],
|
||||
"default": "api"
|
||||
},
|
||||
"motion_threshold": {
|
||||
"description": "Motion detection sensitivity threshold for `detect` mode. Lower values = more sensitive. Uses EMA-based P-frame size analysis.",
|
||||
"type": "number",
|
||||
"default": 2.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user