STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
CaptureResult Struct Reference

Unit tests for fsw::calibration::CaptureWindow (pure, deterministic — no clock). More...

#include <CaptureWindow.hpp>

Public Attributes

bool ok = false
 false → the caller must NOT create a point
double adc_avg = 0.0
size_t n = 0
 samples inside the window
uint64_t span_ms = 0
 ts span actually covered
uint64_t age_ms = 0
 how old the newest sample is, our clock
uint64_t window_ms = kCaptureWindowMs
 the window this sensor's rate called for
uint64_t max_age_ms = kMaxSampleAgeMs
 the staleness limit it was held to
double spread = 0.0
 max - min inside the window
double drift = 0.0
 |mean(2nd half) - mean(1st half)|
double drift_z = 0.0
 drift in standard errors
bool settled = true
 false → recorded, but flagged
const char * reason = kReasonOk

Detailed Description

Unit tests for fsw::calibration::CaptureWindow (pure, deterministic — no clock).

House style: plain main(), return 0 on pass / 1 on failure (see test_board_clock_sync.cpp). Registered with CTest in lib/CMakeLists.txt.

The headline test is low_rate_step_after_settle: it replays the 2026-09-13 load-cell failure at the measured 13.7 Hz and asserts both that the bounded window is right AND that the old unbounded mean was wrong by the margin actually seen on the stand.

  1. low-rate step, captured after settling 5. clear() on reconnect
  2. window bound at high rate 6. settle detection (4 cases)
  3. stale sensor rejected, no fallback 7. ring eviction bounds
  4. no samples / too few 8. uids() skips empty
  5. ~1 Hz load cell captures (adaptive) 10. fast sensors keep the fixed bounds

Definition at line 104 of file CaptureWindow.hpp.

Member Data Documentation

◆ adc_avg

Definition at line 106 of file CaptureWindow.hpp.

◆ age_ms

how old the newest sample is, our clock

Definition at line 109 of file CaptureWindow.hpp.

◆ drift

|mean(2nd half) - mean(1st half)|

Definition at line 113 of file CaptureWindow.hpp.

◆ drift_z

drift in standard errors

Definition at line 114 of file CaptureWindow.hpp.

◆ max_age_ms

uint64_t fsw::calibration::CaptureResult::max_age_ms = kMaxSampleAgeMs

the staleness limit it was held to

Definition at line 111 of file CaptureWindow.hpp.

◆ n

samples inside the window

Definition at line 107 of file CaptureWindow.hpp.

◆ ok

false → the caller must NOT create a point

Definition at line 105 of file CaptureWindow.hpp.

◆ reason

const char* fsw::calibration::CaptureResult::reason = kReasonOk

Definition at line 116 of file CaptureWindow.hpp.

◆ settled

false → recorded, but flagged

Definition at line 115 of file CaptureWindow.hpp.

◆ span_ms

ts span actually covered

Definition at line 108 of file CaptureWindow.hpp.

◆ spread

max - min inside the window

Definition at line 112 of file CaptureWindow.hpp.

◆ window_ms

uint64_t fsw::calibration::CaptureResult::window_ms = kCaptureWindowMs

the window this sensor's rate called for

Definition at line 110 of file CaptureWindow.hpp.


The documentation for this struct was generated from the following file: