pub struct Trigger {
pub name: String,
pub target: TraceRef,
pub enabled: bool,
pub level: f64,
pub slope: TriggerSlope,
pub single_shot: bool,
pub trigger_position: f64,
pub look: TraceLook,
pub holdoff_secs: f64,
/* private fields */
}Expand description
A trigger configuration for oscilloscope-style capture.
Triggers detect when a signal crosses a specified level in a given direction (rising, falling, or any). They can operate in single-shot mode (capture once then stop) or auto mode (continuously re-arm after each trigger).
Fields§
§name: StringUser-facing name for this trigger
target: TraceRefThe trace to monitor for trigger crossings
enabled: boolWhether this trigger is enabled
level: f64The threshold level to detect crossings at
slope: TriggerSlopeWhich edge direction(s) to trigger on
single_shot: boolIf true, trigger once and stop; if false, continuously re-arm
trigger_position: f64Position in buffer where trigger should appear (0.0 = left edge, 1.0 = right edge)
look: TraceLookVisual appearance for the trigger level line
holdoff_secs: f64Holdoff time in seconds. After a trigger fires, the next trigger
will not fire until at least this much time has passed. Default: 0.0.
Implementations§
Source§impl Trigger
impl Trigger
Sourcepub fn reset_runtime_state(&mut self)
pub fn reset_runtime_state(&mut self)
Full reset including the start flag.
Sourcepub fn get_info(&self, axis: &AxisSettings) -> String
pub fn get_info(&self, axis: &AxisSettings) -> String
Short, user-facing description used in UI and legend labels. Example: “trace1: rising @ 1.23 V, pos 0.50, single”
Sourcepub fn get_info_without_slope(&self, axis: &AxisSettings) -> String
pub fn get_info_without_slope(&self, axis: &AxisSettings) -> String
Like get_info but without the slope word, so the caller can
render an icon in its place.
Example: “trace1: @ 1.23 V • Single”
Sourcepub fn slope_icon(&self) -> EdgeIcon
pub fn slope_icon(&self) -> EdgeIcon
Returns the edge icon corresponding to the trigger slope.
Sourcepub fn last_trigger_time(&self) -> Option<f64>
pub fn last_trigger_time(&self) -> Option<f64>
Last trigger timestamp (seconds) if a crossing was detected since reset.
Sourcepub fn is_triggered(&self) -> bool
pub fn is_triggered(&self) -> bool
Returns true if a trigger has fired and is enabled.
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns true if the trigger is armed and actively looking for crossings.
Sourcepub fn is_trigger_pending(&self) -> bool
pub fn is_trigger_pending(&self) -> bool
Returns true if a trigger crossing was detected but we’re waiting for more samples.
Sourcepub fn check_trigger(&mut self, data: &mut LivePlotData<'_>) -> bool
pub fn check_trigger(&mut self, data: &mut LivePlotData<'_>) -> bool
Check the target trace for a trigger crossing and optionally pause after a configurable
number of subsequent samples. trigger_position is in [0,1]:
- 0.0 => pause immediately when the trigger occurs
- 1.0 => pause after
data.max_pointsnew samples on the target trace Values in between scale linearly.
Returns true if there’s an active trigger pending or just fired.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Trigger
impl RefUnwindSafe for Trigger
impl Send for Trigger
impl Sync for Trigger
impl Unpin for Trigger
impl UnsafeUnpin for Trigger
impl UnwindSafe for Trigger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().