pylabrobot.centrifuge.highres.microspin_backend.MicroSpinBackend.reset#

async MicroSpinBackend.reset(*, abort_timeout: float | None = None, settle_timeout: float | None = None, swallow_abort_errors: bool = True, wait_for_settle: bool = True) Dict[str, str] | None#

Bring the device back to a clean, ready-to-command state.

Issues the canonical recovery sequence:

  1. abort() – request a decel + stop.

  2. clear_button_abort() – release the latched abort state so that subsequent motion commands (home, open, spin, …) are accepted again.

  3. wait_for_spindle_stopped() – a single status call that the firmware will not answer until the rotor is genuinely stopped.

Steps 1 and 2 both return OK! immediately on the wire – they are just acknowledgements of the request, not confirmation that motion has ceased. Step 3 is the real “we are stopped” gate, because the firmware queues a status request behind any active motion and only answers once that motion completes.

Parameters:
  • abort_timeout (float | None) – Override the timeout for the abort step. Pass a generous value if you’ve configured a very tight backend timeout. Defaults to abort()’s own default.

  • settle_timeout (float | None) – Override the timeout for the final status poll that waits for the spindle to actually spin down. Defaults to wait_for_spindle_stopped()’s own default (max(self.timeout, 300s)).

  • swallow_abort_errors (bool) – If True (the default), errors raised by the abort step are logged and ignored so that clear_button_abort() is still attempted. This is usually what you want for a recovery routine – e.g. abort can legitimately fail with “nothing to abort” depending on firmware state. Set this to False if you want any abort failure to propagate.

  • wait_for_settle (bool) – If True (the default), block on step 3 and return the final status dict. If False, skip step 3 and return None immediately after clear_button_abort() – useful when you only want to clear the firmware’s abort latch and don’t care whether the rotor has stopped yet.

Returns:

The parsed status report from step 3 (a {field: value} dict), or None if wait_for_settle=False.

Raises:
  • MicroSpinError – If clear_button_abort() fails, or if the final status poll returns ERROR!. Either case indicates the device is in a state that the normal recovery sequence can’t get out of – a power-cycle is usually required at that point.

  • asyncio.TimeoutError – If the rotor doesn’t stop within settle_timeout (i.e. the spindle is genuinely stuck).

Return type:

Dict[str, str] | None

Note

reset does NOT verify that the resulting state is homed. Follow up with is_homed() (and re-home() if needed) before issuing the next motion command. The MicroSpin firmware also keeps a persistent error stack which is unaffected by reset; use request_errors() to inspect it.