improved timing acq

This commit is contained in:
Martino Ferrari committed 2026-10-02 14:03:57 +02:00
1 parent 2218aed839
commit 44fc4cdf36
6 files changed
+142 -13

No files matched your search

+14 -2
View File
@@ -64,8 +64,6 @@ class Acquisition {
std::uint64_t tick_ = 0; ///< base ticks consumed since the epoch
std::uint64_t last_tick_ = ~std::uint64_t{0};
double last_stamp_ = 0.0; ///< last relative time written (monotonic guard)
double last_recv_ = 0.0;
bool have_recv_ = false;
/// Last accepted stream-time stamp: a "time signal" whose values do not advance
/// across packets (a producer that restarts them per packet, or a mislabelled
/// signal) would freeze the whole time base -- the trigger's hold-off clock
@@ -76,6 +74,20 @@ class Acquisition {
/// small seconds (the time ring stores f32, which cannot hold Unix epochs).
double arrival_epoch_ = 0.0;
bool have_arrival_epoch_ = false;
/// Smoothed interval between two frames' arrivals, and the previous arrival: the
/// spine of the arrival-anchored clock (see `build_stamps`).
double arrival_interval_ = 0.0;
double arrival_prev_ = 0.0;
bool have_arrival_interval_ = false;
/// The stream's time source, chosen once and sticky: 0 undecided, 1 the declared
/// time signal, 2 arrival. Re-evaluated only on a CONFIG. A per-frame choice
/// interleaved two timelines in one ring -- some frames stamped from a declared
/// signal carrying volt-like values, others from the arrival clock -- which is a
/// time base no reader can make sense of (see `build_stamps`).
int time_source_ = 0;
/// Set when the source changed under the recorded history: the rings have to be
/// emptied before more samples go in.
bool history_reset_pending_ = false;
std::vector<double> stamps_;
/// The decimation filter's state: a running sum per channel (and one for the shared
/// clock) over the group of base samples that becomes one stored sample. A boxcar