diff --git a/pom.xml b/pom.xml
index 7ff7574..b53ea46 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.micro-manager.acqengj
AcqEngJ
- 0.34.0
+ 0.34.1
jar
AcqEngJ
Java-based Acquisition engine for Micro-Manager
diff --git a/src/main/java/org/micromanager/acqj/internal/Engine.java b/src/main/java/org/micromanager/acqj/internal/Engine.java
index d041023..aa13a50 100644
--- a/src/main/java/org/micromanager/acqj/internal/Engine.java
+++ b/src/main/java/org/micromanager/acqj/internal/Engine.java
@@ -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");
+ }
}
/**
@@ -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);
}
@@ -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());