|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Per-sensor ring of recent samples, and the capture decision over it. More...
#include <CaptureWindow.hpp>
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_ |
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.
| CaptureResult fsw::calibration::CaptureWindow::capture | ( | uint16_t | uid, |
| uint64_t | now_rx_ns ) const |
What this sensor reads now, or why that cannot be answered.
Definition at line 45 of file CaptureWindow.cpp.
References fsw::calibration::kCaptureWindowMs, fsw::calibration::kMaxCaptureWindowMs, fsw::calibration::kMaxSampleAgeMs, fsw::calibration::kMinCaptureSamples, fsw::calibration::kReasonNoSamples, fsw::calibration::kReasonOk, fsw::calibration::kReasonStale, fsw::calibration::kReasonTooFew, fsw::calibration::kSettleZ, fsw::calibration::kStaleSamplePeriods, r, ring, rings_, fsw::calibration::AdcSample::rx_ns, and fsw::calibration::AdcSample::ts_ns.
Referenced by anonymous_namespace{test_capture_window.cpp}::clear_on_reconnect(), anonymous_namespace{test_capture_window.cpp}::empty_and_too_few(), anonymous_namespace{test_capture_window.cpp}::fast_sensor_bounds_unchanged(), anonymous_namespace{test_capture_window.cpp}::low_rate_step_after_settle(), main(), anonymous_namespace{test_capture_window.cpp}::settle_detection(), anonymous_namespace{test_capture_window.cpp}::slow_load_cell_captures(), anonymous_namespace{test_capture_window.cpp}::stale_sensor_rejected(), and anonymous_namespace{test_capture_window.cpp}::window_bound_high_rate().
| 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().
| void fsw::calibration::CaptureWindow::clear | ( | uint16_t | uid | ) |
Definition at line 141 of file CaptureWindow.cpp.
References rings_.
| void fsw::calibration::CaptureWindow::push | ( | uint16_t | uid, |
| int32_t | adc, | ||
| uint64_t | ts_ns, | ||
| uint64_t | rx_ns ) |
Record one sample.
Evicts by span and by count.
Definition at line 29 of file CaptureWindow.cpp.
References adc(), fsw::calibration::kRingMax, fsw::calibration::kRingSpanMs, ring, and rings_.
Referenced by anonymous_namespace{test_capture_window.cpp}::feed(), anonymous_namespace{test_capture_window.cpp}::low_rate_step_after_settle(), main(), and anonymous_namespace{test_capture_window.cpp}::uids_reports_live_sensors().
| 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().
| 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.
Referenced by anonymous_namespace{test_capture_window.cpp}::clear_on_reconnect(), main(), and anonymous_namespace{test_capture_window.cpp}::uids_reports_live_sensors().
|
private |