MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / triggerOrigin

Method triggerOrigin

app/src/DSP.h:729–738  ·  view source on GitHub ↗

* @brief Computes the sweep origin, interpolating the exact level crossing on an edge. */

Source from the content-addressed store, hash-verified

727 * @brief Computes the sweep origin, interpolating the exact level crossing on an edge.
728 */
729 [[nodiscard]] double triggerOrigin(double now, double value) const
730 {
731 if (!edgeDetected(value))
732 return now;
733
734 const double denom = value - prevValue;
735 double frac = (std::abs(denom) > 1e-12) ? (level - prevValue) / denom : 0.0;
736 frac = std::clamp(frac, 0.0, 1.0);
737 return prevTime + frac * (now - prevTime);
738 }
739
740 /**
741 * @brief Publishes the filled sweep to `front` and ends the acquisition. `lastSweepSec` is

Callers

nothing calls this directly

Calls 2

absFunction · 0.85
clampFunction · 0.50

Tested by

no test coverage detected