fix(lane-status): drop busy TTL 90s -> 5s (camera re-fires ~1s)
Measured the real re-fire rate on the camera: while a vehicle is in the zone it POSTs `active` about every ~1 second (not the ~30-80s I'd guessed). The camera sends no leave signal, so "free" is timeout-driven — but with a ~1s re-fire, 90s made the lane stay red for a minute and a half after the car left. 5s of silence reliably means the car is gone; the light now clears within seconds. Still override-able via LANE_BUSY_TTL_MS. Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
@@ -14,11 +14,13 @@ import { directionOf } from "./device-resolve.js";
|
|||||||
// flips free after BUSY_TTL_MS. A "both"-direction camera marks BOTH lanes.
|
// flips free after BUSY_TTL_MS. A "both"-direction camera marks BOTH lanes.
|
||||||
|
|
||||||
/** How long after the last vehicle detection a lane stays "busy" before clearing.
|
/** How long after the last vehicle detection a lane stays "busy" before clearing.
|
||||||
* Must exceed the camera's `active` re-fire interval (observed ~30-80s on the test
|
* Must exceed the camera's `active` re-fire interval so a still-present car keeps the
|
||||||
* unit) so a parked car keeps the lane busy. Override with LANE_BUSY_TTL_MS. */
|
* lane busy. Measured on the test unit: while a vehicle is in the zone the camera
|
||||||
|
* re-fires `active` about every ~1s — so a few seconds of silence reliably means the
|
||||||
|
* car has left. 5s gives fast clearing without flicker. Override with LANE_BUSY_TTL_MS. */
|
||||||
export function busyTtlMs(): number {
|
export function busyTtlMs(): number {
|
||||||
const raw = Number(process.env.LANE_BUSY_TTL_MS ?? 90_000);
|
const raw = Number(process.env.LANE_BUSY_TTL_MS ?? 5_000);
|
||||||
return Number.isFinite(raw) && raw > 0 ? raw : 90_000;
|
return Number.isFinite(raw) && raw > 0 ? raw : 5_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LaneStatus {
|
export class LaneStatus {
|
||||||
|
|||||||
Reference in New Issue
Block a user