STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
sequencer::anonymous_namespace{ScriptRunner.cpp} Namespace Reference

Classes

struct  Interp
 Everything one run needs, so the recursive walk can be free functions over one struct. More...

Enumerations

enum class  Flow { Continue , Terminated }
 How a statement ended. More...

Variables

constexpr uint64_t kMaxIterations = 1000000
 Total loop iterations across the whole script.
constexpr double kStartLeadInSeconds = 0.100
 Shortest delay actually honoured.
constexpr double kMinDelaySeconds = 0.010

Enumeration Type Documentation

◆ Flow

enum class sequencer::anonymous_namespace{ScriptRunner.cpp}::Flow
strong

How a statement ended.

Enumerator
Continue 
Terminated 

transition_to ran, or something failed.

Unwind everything; the thread is done.

Definition at line 53 of file ScriptRunner.cpp.

Variable Documentation

◆ kMaxIterations

uint64_t sequencer::anonymous_namespace{ScriptRunner.cpp}::kMaxIterations = 1000000
constexpr

Total loop iterations across the whole script.

The wall deadline is the real bound; this catches a tight loop that would otherwise spend the whole budget spinning.

Definition at line 23 of file ScriptRunner.cpp.

Referenced by sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::exec().

◆ kMinDelaySeconds

double sequencer::anonymous_namespace{ScriptRunner.cpp}::kMinDelaySeconds = 0.010
constexpr

◆ kStartLeadInSeconds

double sequencer::anonymous_namespace{ScriptRunner.cpp}::kStartLeadInSeconds = 0.100
constexpr

Shortest delay actually honoured.

A script cannot express delay(0) — the parser refuses it — but an expression can still evaluate to something tiny, and a sub-millisecond wait in a loop is a spin with extra steps. How long the script waits before its first statement, so the state's own actuator column has landed on the boards first.

Both go out as UDP to the same board, but the boards poll one datagram per loop() and hotfire_config.h sets LOOP_DELAY_MS = 10 — so the column's three retransmits alone take ~30 ms to drain, and the script's first command queues behind them. Without this the valve a script opens on its first line could be commanded up to ~40 ms late, or land while the column's own CLOSE for that valve was still being consumed, which read on the stand as "the valve did not open for as long as I asked for".

Spent on the SCRIPT'S thread, deliberately, not in doTransitionTo: that runs on the command worker, and sleeping there would delay every queued command behind it — an abort included, against a budget test_abort_ordering pins at 200 ms. Here it costs the worker nothing, and stop() still preempts it in well under a millisecond because sleep() waits on the condition variable with the stop flag as its predicate.

Comes out of the script's own timeout budget rather than extending it, the same way the rest of the transition's overhead does — script_timeout_ms stays the wall-clock ceiling on the state.

Definition at line 48 of file ScriptRunner.cpp.