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

Class SweepEngine

app/src/DSP.h:507–756  ·  view source on GitHub ↗

* @brief Oscilloscope-style sweep/trigger engine with a front/back ring per curve. */

Source from the content-addressed store, hash-verified

505 * @brief Oscilloscope-style sweep/trigger engine with a front/back ring per curve.
506 */
507struct SweepEngine {
508 static constexpr int kAuto = 0;
509 static constexpr int kNormal = 1;
510 static constexpr int kSingle = 2;
511 static constexpr int kRising = 0;
512 static constexpr int kFalling = 1;
513
514 // Windows wider than this draw the live partial trace instead of freezing
515 static constexpr double kLiveWindowSec = 0.1;
516
517 std::vector<TimeRing> front;
518 std::vector<TimeRing> back;
519
520 double windowSec;
521 double timebaseSec;
522 double level;
523 double holdoffSec;
524 int edge;
525 int mode;
526 int triggerCurve;
527 bool enabled;
528
529 double t0;
530 double prevValue;
531 double prevTime;
532 double lastTriggerSec;
533 double lastSweepSec;
534 bool prevValid;
535 bool sweeping;
536 bool armed;
537 bool hasFront;
538
539 /**
540 * @brief Constructs an idle, disabled sweep engine with no curves.
541 */
542 SweepEngine()
543 : windowSec(1.0)
544 , timebaseSec(0.0)
545 , level(0.0)
546 , holdoffSec(0.0)
547 , edge(kRising)
548 , mode(kAuto)
549 , triggerCurve(0)
550 , enabled(false)
551 , t0(0.0)
552 , prevValue(0.0)
553 , prevTime(0.0)
554 , lastTriggerSec(-1.0)
555 , lastSweepSec(0.0)
556 , prevValid(false)
557 , sweeping(false)
558 , armed(true)
559 , hasFront(false)
560 {}
561
562 /**
563 * @brief Allocates `curveCount` front/back rings, each constructed individually: FixedQueue
564 * copies share their backing array, so a copy-fill would alias every curve.

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected