Skip to content

Commit

Permalink
Merge pull request #108 from micro-manager/sequenceFixes
Browse files Browse the repository at this point in the history
Engine: avoid hardware errors while running sequences.
  • Loading branch information
nicost authored Jan 2, 2024
2 parents b5d2873 + 7ecb96f commit 38c1f8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.micro-manager.acqengj</groupId>
<artifactId>AcqEngJ</artifactId>
<version>0.34.0</version>
<version>0.34.1</version>
<packaging>jar</packaging>
<name>AcqEngJ</name>
<description>Java-based Acquisition engine for Micro-Manager</description>
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/org/micromanager/acqj/internal/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ public void checkForDefaultDevices(AcquisitionEvent event) {
if (event.getZPosition() != null && (zStage == null || zStage.equals(""))) {
throw new RuntimeException("Event requires a z position, but no Core-Focus device is set");
}
if (event.getXPosition() != null && (xyStage == null || xyStage.equals(""))) {
throw new RuntimeException("Event requires an x position, but no Core-XYStage device is set");
}
if (event.getXPosition() != null && (xyStage == null || xyStage.equals(""))) {
throw new RuntimeException("Event requires an x position, but no Core-XYStage device is set");
}
}

/**
Expand Down Expand Up @@ -713,6 +713,11 @@ private void prepareHardware(final AcquisitionEvent event,
hardwareSequencesInProgress.deviceNames.add(xyStage);
}
if (event.isZSequenced()) {
// at least some zStages freak out (in this case, NIDAQ board) when you
// try to load a sequence while the sequence is still running. Nothing in
// the engine stops a stage sequence if all goes well.
// Stopping a sequence if it is not running hopefully will not harm anyone.
core_.stopStageSequence(zStage);
core_.loadStageSequence(zStage, zSequence);
hardwareSequencesInProgress.deviceNames.add(zStage);
}
Expand All @@ -728,6 +733,11 @@ private void prepareHardware(final AcquisitionEvent event,
}
}
}
// preparing a sequence while one is running is deadly. There must be a
// better way than this...
while (core_.isSequenceRunning()) {
Thread.sleep(1);
}
core_.prepareSequenceAcquisition(core_.getCameraDevice());


Expand Down

0 comments on commit 38c1f8e

Please sign in to comment.