Fix and test STAR setup discard of mounted tips#1161
Conversation
| has_tips = any(tip_presences) | ||
| if has_tips: | ||
| await self._initialize_pip_without_tip_discard() | ||
| elif not initialized: |
There was a problem hiding this comment.
should this initialize call not be gated by if initialized?
There was a problem hiding this comment.
The intention was to keep somewhat consistent with the old behavior.
The old behavior, if I'm understanding correctly, is:
If not initialized or there's any tip left on the channels, do initialize_pip(). initialize_pip() then does the C0DI with tm1&. That works fine when there are no tips, but crashes, at least in my case, with tips.
So I split the two conditions. If there are tips present, call the new _initialize_pip_without_tip_discard() which sends C0DI but with tm0& instead. This does the initialization but the tips stay afterward. If there are no tips, just do the old initialize_pip().
But since _initialize_pip_without_tip_discard() doesn't discard tips, we need to actually discard the tips to complete the initialization as Method Editor does. This is checked and done below. And the check won't run if it went the initialize_pip() route at the start since there were no tips to begin with.
Summary
Fixes STAR backend setup behavior when tips are already mounted on single channels. #1159
Previously,
STARBackend.setup()calledinitialize_pip()when tip presence was detected. That made theC0DIinitialization command run with active channels (tm1...), so firmware could try to discard mounted tips as part ofDI.This PR changes the mounted-tip setup path to:
tm0...) soC0DIdoes not discard tips.C0TRtip-discard path.The normal
initialize_pip()behavior is unchanged.Motivation
On a STAR with 4 channels spaced at 18 mm, setup-time discard through
C0DIcaused the tips to hit the waste slope and continue downward, bending tips. A Hamilton Method Editor trace showed that Hamilton initializes with inactive channels and then performs the actual discard withC0TR.Tests
Added STAR backend tests for:
initialize_pip()activeDIcommand behavior,DIcommand behavior,TRdiscard command using the detected tip-presence pattern.Ran:
Result: