STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
fsw::calibration::CaptureWindow Class Reference

Per-sensor ring of recent samples, and the capture decision over it. More...

#include <CaptureWindow.hpp>

Collaboration diagram for fsw::calibration::CaptureWindow:
[legend]

Public Member Functions

void push (uint16_t uid, int32_t adc, uint64_t ts_ns, uint64_t rx_ns)
 Record one sample.
CaptureResult capture (uint16_t uid, uint64_t now_rx_ns) const
 What this sensor reads now, or why that cannot be answered.
void clear ()
 Forget everything.
void clear (uint16_t uid)
std::vector< uint16_t > uids () const
 Every uid with at least one sample.
size_t size (uint16_t uid) const
 Samples currently held for a uid (diagnostics and tests).

Private Attributes

std::unordered_map< uint16_t, std::deque< AdcSample > > rings_

Detailed Description

Per-sensor ring of recent samples, and the capture decision over it.

Keyed by the calibration uid (board_id * 100 + connector). Nothing here reads a clock: push is told when the sample was taken and when it arrived, capture is told what time it is now.

Definition at line 126 of file CaptureWindow.hpp.

Member Function Documentation

◆ capture()

◆ clear() [1/2]

void fsw::calibration::CaptureWindow::clear ( )

Forget everything.

Used on an Elodin reconnect, where the samples either side of the gap are not a continuous record and must never be averaged together.

Definition at line 137 of file CaptureWindow.cpp.

References rings_.

Referenced by anonymous_namespace{test_capture_window.cpp}::clear_on_reconnect(), main(), and anonymous_namespace{test_capture_window.cpp}::uids_reports_live_sensors().

◆ clear() [2/2]

void fsw::calibration::CaptureWindow::clear ( uint16_t uid)

Definition at line 141 of file CaptureWindow.cpp.

References rings_.

◆ push()

void fsw::calibration::CaptureWindow::push ( uint16_t uid,
int32_t adc,
uint64_t ts_ns,
uint64_t rx_ns )

◆ size()

size_t fsw::calibration::CaptureWindow::size ( uint16_t uid) const

Samples currently held for a uid (diagnostics and tests).

Definition at line 156 of file CaptureWindow.cpp.

References rings_.

Referenced by anonymous_namespace{test_capture_window.cpp}::ring_bounds().

◆ uids()

std::vector< uint16_t > fsw::calibration::CaptureWindow::uids ( ) const

Every uid with at least one sample.

Zero-All iterates this rather than a last-value map, so a sensor that has gone quiet is skipped instead of being zeroed from a stale reading.

Definition at line 145 of file CaptureWindow.cpp.

References ring, and rings_.

Referenced by anonymous_namespace{test_capture_window.cpp}::clear_on_reconnect(), main(), and anonymous_namespace{test_capture_window.cpp}::uids_reports_live_sensors().

Member Data Documentation

◆ rings_

std::unordered_map<uint16_t, std::deque<AdcSample> > fsw::calibration::CaptureWindow::rings_
private

Definition at line 148 of file CaptureWindow.hpp.

Referenced by capture(), clear(), clear(), push(), size(), and uids().


The documentation for this class was generated from the following files: