HPInc / HP-Digital-Microfluidics

HP Digital Microfluidics Software Platform and Libraries
MIT License
2 stars 0 forks source link

Extraction points need to turn off pad before extraction #240

Closed EvanKirshenbaum closed 5 months ago

EvanKirshenbaum commented 5 months ago

From @cumbiem:

BTW, one thing I noticed which I am not entirely sure is right in the osu macro, is that when the code is paused for the user to extract a droplet form the port, the pad located under the port appears to be on. Can you confirm this? We actually need to turn off the pad under the extraction port when it is ready to extract.

The problem is that ExtractionPoint.prepare_for_remove() and .pipettor_removed() are currently defined as

    def prepare_for_remove(self) -> None:
        self.ensure_drop().wait()
        self.reserve_pads(expect_drop=True).wait()

    def pipettor_removed(self, reagent: Reagent, volume: Volume, # @UnusedVariable
                         *, last: bool) -> None: # @UnusedVariable
        pad = self.pad
        if volume > Volume.ZERO:
            pad.liquid_removed(volume)
        blob = not_None(pad.blob, desc=lambda: f"{self} has no blob after extraction")
        # If the blob is now empty, we turn off all of its pads.

        if blob.total_volume.is_zero:
            for p in blob.pads:
                assert isinstance(p, Pad)
                # TODO: Do I need to wait on this somewhere?
                p.schedule(Pad.TurnOff, post_result=False)
        if last:
            self.unreserve_pads()

What we should be doing is turning off the pad in prepare_for_remove() (and waiting, as we do with prepare_for_add()) and then turning it back on again if there's anything left in pipettor_removed(). In fact, we should probably be turning off all of the pads in the drop's blob. (Which means that Blob should probably have a way to turn all of its pads on or off.)

Migrated from internal repository. Originally created by @EvanKirshenbaum on Feb 06, 2023 at 11:46 AM PST. Closed on Feb 09, 2023 at 11:22 AM PST.
EvanKirshenbaum commented 5 months ago

This issue was referenced by the following commit before migration: