From e15480559204a0b062ca2da0e7d71b3af9a065bd Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 17 Apr 2024 17:02:24 -0700 Subject: [PATCH] break out of loop in stopSPIMStateMachines --- .../lightsheetmanager/model/PLogicSCAPE.java | 10 +++++++--- .../model/acquisitions/AcquisitionEngineSCAPE.java | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java b/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java index a262242..3dea83c 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java @@ -1125,12 +1125,16 @@ public void stopSPIMStateMachines() { // once all images come in there is still a time when stage is moving back to its start/center position final int timeoutStageScanCleanupMs = 5000; final long deadline = System.currentTimeMillis() + timeoutStageScanCleanupMs; - while (xyStage_.getScanState() == ASIXYStage.ScanState.IDLE) { - if (System.currentTimeMillis() > deadline) { + boolean done = false; + while (!done) { + done = xyStage_.getScanState() == ASIXYStage.ScanState.IDLE; + if (!done && System.currentTimeMillis() > deadline) { xyStage_.setScanState(ASIXYStage.ScanState.IDLE); // force-set to idle studio_.logs().logError("Force-set XY stage scan to IDLE state with stage speed " + xyStage_.getSpeedX() + "."); - } else { + done = true; + } + if (!done) { try { Thread.sleep(25); // still waiting... } catch (InterruptedException e) { diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java index 9db742e..d73d5b8 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java @@ -118,7 +118,6 @@ boolean run() { } catch (Exception e) { studio_.logs().logError(e); } -// boolean demoMode = acqSettings_.demoMode(); if (!demoMode) {