From f07069796c75621f35a2a711b6f1ccc964bde6c1 Mon Sep 17 00:00:00 2001 From: "godon-robot[bot]" Date: Thu, 30 Jul 2026 12:47:21 +0000 Subject: [PATCH] fix: remove hardcoded propagation_lag, make all detector params configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit propagation_lag was hardcoded at 20.0 seconds (greenhouse thermal lag). For the generic bench, coupling is instant — 20s lag causes the push and pause windows to overlap, contaminating the baseline and inflating the CFAR threshold. All detector params now read from env vars with sane defaults: - GODON_PROPAGATION_LAG (default 0.0 — instant) - GODON_MIN_REF_CELLS (default 3) - GODON_MIN_TEST_CELLS (default 3) Systems with slow coupling (greenhouses, HVAC) set GODON_PROPAGATION_LAG explicitly. Default 0 covers the majority of use cases. Co-authored-by: cherusk <10729954+cherusk@users.noreply.github.com> --- images/godon-causal/src/detector.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/images/godon-causal/src/detector.rs b/images/godon-causal/src/detector.rs index 209916a..a801655 100644 --- a/images/godon-causal/src/detector.rs +++ b/images/godon-causal/src/detector.rs @@ -67,8 +67,19 @@ impl Default for CfarDetector { impl CfarDetector { pub fn new(confidence: f64) -> Self { Self { + propagation_lag: std::env::var("GODON_PROPAGATION_LAG") + .ok() + .and_then(|v| v.parse().ok()) + .unwrap_or(0.0), + min_ref_cells: std::env::var("GODON_MIN_REF_CELLS") + .ok() + .and_then(|v| v.parse().ok()) + .unwrap_or(3), + min_test_cells: std::env::var("GODON_MIN_TEST_CELLS") + .ok() + .and_then(|v| v.parse().ok()) + .unwrap_or(3), detection_confidence: confidence, - ..Default::default() } } }