Skip to main content

AxisWait

Struct AxisWait 

Source
pub struct AxisWait;
Expand description

Wait-for-axis-done function block. Stateless — all state lives in the drive and the caller’s StateMachine.

Implementations§

Source§

impl AxisWait

Source

pub fn poll<A: AxisHandle + ?Sized>( axis: &A, state: &StateMachine, ) -> WaitStatus

Poll the axis exactly once. Call this from inside your wait state.

Decision order:

  1. !is_busy && is_errorWaitStatus::Error with the drive’s error_message(). Checked first because the busy bit typically clears before the error bit on a faulted move.
  2. !is_busyWaitStatus::Done.
  3. state.timed_out()WaitStatus::Timeout.
  4. Otherwise → WaitStatus::Pending.

error_message defaults to "" if the handle hasn’t overridden it (see the AxisHandle trait); regenerated Axis* handles override it to return the drive’s actual message.

Source

pub fn resolve<A: AxisHandle + ?Sized>( axis: &A, state: &StateMachine, follow_up: &mut Option<i32>, default_next: i32, error_next: i32, label: &str, ) -> Option<i32>

Convenience wrapper for the common pattern: on Done, jump to the follow-up state (or default_next if no follow-up was set); on Error or Timeout, log and jump to error_next. Returns the new state index, or None if the caller should stay put (the Pending case).

§Example
Some(MyState::WaitMoveDone) => {
    if let Some(next) = AxisWait::resolve(
        axis_z,
        &self.state,
        &mut self.follow_up_state,
        MyState::Idle as i32,
        MyState::Reset as i32,
        "Z axis",
    ) {
        self.state.index = next;
    }
}

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V