Update sensor calibration breakout condition

This commit is contained in:
grove5_admin committed 2026-05-04 19:23:28 -07:00
1 parent f2aed8b8af
commit 8deacf9f89
2 files changed
+16 -6

No files matched your search

+13 -3
View File
@@ -241,6 +241,13 @@ class Processor:
points = list(raw.sweep)
now_established = bool(self.baseline and self.baseline.established)
# The firmware's burn_in flag stays True until we echo back
# baseline_established=true (a write-back channel not yet implemented).
# Use the daemon's own baseline truth instead so downstream gates and
# the UI transition correctly once we've accumulated enough samples.
if now_established and raw.burn_in:
raw = raw.model_copy(update={"burn_in": False})
# Pick correction inputs. See _select_*_source for the policy;
# log only on source transitions to avoid per-payload spam.
corr_temp, temp_src = self._select_temp_source(raw)
@@ -753,17 +760,20 @@ class BaselineBuilder:
"""
Add a payload to the accumulator. Rejects payloads that would
poison the baseline:
- burn_in=True (firmware is still conditioning the MOX film)
- ambient invalid
- no usable sweep points (every point ADC-railed)
Note: burn_in is NOT rejected here. The firmware's one-shot warmup
(_warmup(), 30 cycles) completes before the first collect() returns,
so all arriving payloads carry reliable gas data. The firmware's
burn_in=true only means Linux hasn't echoed back yet — it is not a
data-quality signal at this point in the pipeline.
TODO(#9): once we have a few runs of real data, also reject
payloads where idac is pinned at 0x00 or 0x7F for upper-zone
points — that indicates the DAC rail, meaning the heater never
reached target regardless of what heater_stable says.
"""
if raw.burn_in:
return
if not raw.ambient.valid:
return
+3 -3
View File
@@ -266,9 +266,9 @@ async def insert_payload(
int(raw.health.temp_ok),
int(raw.health.humidity_ok),
int(raw.baseline.established),
raw.baseline.n_samples,
int(raw.burn_in),
int(processed.baseline.established),
processed.baseline.n_samples,
int(processed.burn_in),
),
) as cur:
payload_id = cur.lastrowid