Skip to main content

Threshold

Struct Threshold 

Source
pub struct Threshold {
    pub level: u16,
    pub hold_ms: u16,
    pub variation_only: bool,
}
Expand description

Parameters of Reporting::ThresholdBased.

The node keeps a slow running average of the channel’s amplitude profile over up to 32 sampled subcarriers, and scores every measurement by how far its profile’s shape departs from that average, on a 0..=65535 scale. Both profiles are normalised by their own totals first, so the receiver’s per-frame gain changes score nothing; 65535 is a profile with no overlap at all. A measurement scoring at least level is reported and opens a hold_ms window in which every measurement is reported, so a movement is captured whole rather than as its loudest frames.

Calibrate level on your own link. Raw 8-bit estimates carry per-frame quantisation noise, so a still room does not score zero. Measured on two ESP32-C5s at HE20 (245 subcarriers, 100 frames/s, an empty room), single-frame scores had a median of ~2700 and a 99th percentile of ~4300. Run the node with variation_only first, read the scores it reports while nothing moves, and set level comfortably above their high percentile; the level that separates motion from stillness has not been measured here and depends on the room.

Fields§

§level: u16

Score at or above which a measurement is reported.

§hold_ms: u16

How long to keep reporting after a measurement crosses level, in milliseconds.

§variation_only: bool

Report only the score, as a CsiPayload::Variation, instead of the full measurement. The lightest report a node can send.

Implementations§

Source§

impl Threshold

Source

pub const fn new(level: u16, hold_ms: u16) -> Self

Report full measurements scoring at least level, holding for hold_ms.

Examples found in repository?
examples/sniffer.rs (line 61)
61const EXAMPLE_THRESHOLD: Threshold = Threshold::new(6000, 500);
Source

pub const fn variation_only(self) -> Self

Report only the score, not the measurement.

Trait Implementations§

Source§

impl Clone for Threshold

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Threshold

Source§

impl Debug for Threshold

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Threshold

Source§

impl PartialEq for Threshold

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Threshold

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.