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
impl AxisWait
Sourcepub fn poll<A: AxisHandle + ?Sized>(
axis: &A,
state: &StateMachine,
) -> WaitStatus
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:
!is_busy && is_error→WaitStatus::Errorwith the drive’serror_message(). Checked first because the busy bit typically clears before the error bit on a faulted move.!is_busy→WaitStatus::Done.state.timed_out()→WaitStatus::Timeout.- 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.
Sourcepub fn resolve<A: AxisHandle + ?Sized>(
axis: &A,
state: &StateMachine,
follow_up: &mut Option<i32>,
default_next: i32,
error_next: i32,
label: &str,
) -> Option<i32>
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§
impl Freeze for AxisWait
impl RefUnwindSafe for AxisWait
impl Send for AxisWait
impl Sync for AxisWait
impl Unpin for AxisWait
impl UnsafeUnpin for AxisWait
impl UnwindSafe for AxisWait
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
Mutably borrows from an owned value. Read more