Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,11 @@ public class PLogicDispim {
private double scanDistance_; // in microns; cached value from last call to prepareControllerForAcquisition()
private double actualStepSizeUm_; // cached value from last call to prepareControllerForAcquisition()
private boolean zSpeedZero_; // cached value from last call to prepareStageScanForAcquisition()
private String lastDistanceStr_; // cached value from last call to prepareControllerForAcquisition()
private String lastPosStr_; // cached value from last call to prepareControllerForAcquisition()

// PLC
private static final int triggerStepDurationTics = 10; // 2.5ms with 0.25ms tics
private static final int acquisitionFlagAddr = 1;
private static final int counterLSBAddr = 3;
private static final int counterMSBAddr = 4;
private static final int triggerStepEdgeAddr = 6;
private static final int triggerStepPulseAddr = 7;
private static final int triggerStepOutputAddr = 40; // BNC #8
private static final int triggerInAddr = 35; // BNC #3
private static final int triggerSPIMAddr = 46; // backplane signal, same as XY card's TTL output
private static final int laserTriggerAddress = 10; // this should be set to (42 || 8) = (TTL1 || manual laser on)

private final DispimAcquisitionSettings acqSettings_;
Expand All @@ -86,8 +78,6 @@ public PLogicDispim(final LightSheetManager model) {
scanDistance_ = 0;
actualStepSizeUm_ = 0;
zSpeedZero_ = true;
lastDistanceStr_ = "";
lastPosStr_ = "";

final GeometryType geometryType = model_.devices().adapter().geometry();

Expand Down Expand Up @@ -952,31 +942,6 @@ public boolean triggerControllerStartAcquisition(final AcquisitionMode acqMode,
return true;
}

public boolean triggerControllerStartAcquisitionSCAPE(final AcquisitionMode acqMode, int side) {
switch (acqMode) {
case STAGE_SCAN:
case STAGE_SCAN_INTERLEAVED:
case STAGE_SCAN_UNIDIRECTIONAL:
// for stage scan we send trigger to stage card, which sends
// hardware trigger to the micro-mirror card
scanner_.setSPIMState(ASIScanner.SPIMState.ARMED);
xyStage_.setScanState(ASIXYStage.ScanState.RUNNING);
break;
case PIEZO_SLICE_SCAN:
case SLICE_SCAN_ONLY:
case PIEZO_SCAN_ONLY:
case NO_SCAN:
// in actuality only matters which device we trigger if there are
// two micro-mirror cards, which hasn't ever been done in practice yet
scanner_.setSPIMState(ASIScanner.SPIMState.RUNNING);
break;
default:
studio_.logs().showError("Unknown acquisition mode");
return false;
}
return true;
}

// TODO: "output 5 only" needs to be added to ASIPLogic
private int getPLogicOutputFromChannel(final ChannelSpec channel, final String channelGroup) {
try {
Expand Down Expand Up @@ -1164,19 +1129,6 @@ public void stopSPIMStateMachines() {
}
}

// private void stopSPIMStateMachines(DefaultAcquisitionSettingsDISPIM acqSettings) {
// final int numViews = acqSettings_.volumeSettings().numViews();
// if (numViews == 1) {
// ASIScanner scanner = model_.devices().getDevice("IllumBeam");
// scanner.setSPIMState(ASIScanner.SPIMState.IDLE);
// }
// for (int i = 1; i <= numViews; i++) {
// ASIScanner scanner = model_.devices().getDevice("Illum" + i + "Beam");
// scanner.setSPIMState(ASIScanner.SPIMState.IDLE);
// }
// // TODO: ASI stage scanning conditionals
// }

}


Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,11 @@ public class PLogicScape {
private double scanDistance_; // in microns; cached value from last call to prepareControllerForAcquisition()
private double actualStepSizeUm_; // cached value from last call to prepareControllerForAcquisition()
private boolean zSpeedZero_; // cached value from last call to prepareStageScanForAcquisition()
private String lastDistanceStr_; // cached value from last call to prepareControllerForAcquisition()
private String lastPosStr_; // cached value from last call to prepareControllerForAcquisition()

// PLC
private static final int triggerStepDurationTics = 10; // 2.5ms with 0.25ms tics
private static final int acquisitionFlagAddr = 1;
private static final int counterLSBAddr = 3;
private static final int counterMSBAddr = 4;
private static final int triggerStepEdgeAddr = 6;
private static final int triggerStepPulseAddr = 7;
private static final int triggerStepOutputAddr = 40; // BNC #8
private static final int triggerInAddr = 35; // BNC #3
private static final int triggerSPIMAddr = 46; // backplane signal, same as XY card's TTL output
private static final int laserTriggerAddress = 10; // this should be set to (42 || 8) = (TTL1 || manual laser on)

private final ScapeAcquisitionSettings acqSettings_;
Expand All @@ -74,8 +66,6 @@ public PLogicScape(final LightSheetManager model) {
scanDistance_ = 0;
actualStepSizeUm_ = 0;
zSpeedZero_ = true;
lastDistanceStr_ = "";
lastPosStr_ = "";

// populate devices
scanner_ = devices_.device("IllumSlice");
Expand Down Expand Up @@ -627,28 +617,11 @@ private boolean cleanUpControllerAfterAcquisitionSide(
final boolean movePiezo,
final double piezoPosition) {

// TODO: skip scanner warnings?
// ASIScanner scanner = null;
// ASIPiezo piezo = null;
// switch (view) {
// case 1:
// scanner = scanner1_;
// piezo = piezo1_;
// break;
// case 2:
// scanner = scanner2_;
// piezo = piezo2_;
// default:
// break;
// }

// make sure SPIM state machine is stopped
scanner_.setSPIMState(ASIScanner.SPIMState.IDLE);

// restore sheet width and offset in case they got clobbered by the code implementing light sheet mode
// TODO: reset light sheet properties
final double saAmplitudeXDegrees = scanner_.sa().getAmplitudeX();
final double saOffsetXDegrees = scanner_.sa().getOffsetX();
// NB: no sheet width/offset to restore here — SCAPE never writes the galvo x-axis
// (see prepareControllerForAcquisitionSide), so nothing can have clobbered it.

// move piezo back to desired position
if (movePiezo) {
Expand Down Expand Up @@ -853,7 +826,7 @@ public boolean setupHardwareChannelSwitching(final ScapeAcquisitionSettings sett
return true;
}

public boolean triggerControllerStartAcquisition(final AcquisitionMode acqMode, int side) {
public boolean triggerControllerStartAcquisition(final AcquisitionMode acqMode) {
switch (acqMode) {
case STAGE_SCAN:
case STAGE_SCAN_INTERLEAVED:
Expand All @@ -865,8 +838,6 @@ public boolean triggerControllerStartAcquisition(final AcquisitionMode acqMode,
break;
case GALVO_SCAN:
case NO_SCAN:
// in actuality only matters which device we trigger if there are
// two micro-mirror cards, which hasn't ever been done in practice yet
scanner_.setSPIMState(ASIScanner.SPIMState.RUNNING);
break;
default:
Expand Down Expand Up @@ -1025,38 +996,6 @@ public double getActualStepSizeUm() {
return actualStepSizeUm_;
}

// TODO: maybe make this work with any number of PathConfig variables...?
/**
* Sets the side-specific preset from the selected group. Blocks until all involved devices are not busy.
* Put in this class for convenience though it isn't necessarily about the controller.
* @param side
*/
public void setPathPreset(int side) {
// set preset requested on Settings tab
String sideKey = "PathConfig1";
switch (side) {
case 1:
sideKey = "PathConfig1";
break;
case 2:
sideKey = "PathConfig2";
break;
default:
studio_.logs().showError("unknown side when setting up path presets");
break;
}
final String preset = "PathConfig1";///props_.getPropValueString(Devices.Keys.PLUGIN, sideKey); // TODO: get from plugin!
final String group = "PathGroup"; //props_.getPropValueString(Devices.Keys.PLUGIN, Properties.Keys.PLUGIN_PATH_GROUP); // TODO: get from plugin!
try {
if (!preset.equals("")) {
core_.setConfig(group, preset);
core_.waitForConfig(group, preset);
}
} catch (Exception e) {
studio_.logs().showError("Couldn't set the path config " + preset + " of group " + group);
}
}

public void stopSPIMStateMachines() {
scanner_.setSPIMState(ASIScanner.SPIMState.IDLE);
if (acqSettings_.stageScan().enabled()) {
Expand Down Expand Up @@ -1084,17 +1023,4 @@ public void stopSPIMStateMachines() {
}
}

// private void stopSPIMStateMachines(DefaultAcquisitionSettingsDISPIM acqSettings) {
// final int numViews = acqSettings_.volumeSettings().numViews();
// if (numViews == 1) {
// ASIScanner scanner = model_.devices().getDevice("IllumBeam");
// scanner.setSPIMState(ASIScanner.SPIMState.IDLE);
// }
// for (int i = 1; i <= numViews; i++) {
// ASIScanner scanner = model_.devices().getDevice("Illum" + i + "Beam");
// scanner.setSPIMState(ASIScanner.SPIMState.IDLE);
// }
// // TODO: ASI stage scanning conditionals
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,7 @@ public AcquisitionEvent run(AcquisitionEvent event) {
xyStage.setSpeedX(scanSpeedX_);
xyStage.setAccelerationX(scanAccelX_);
controllerInstance.prepareStageScanForAcquisition(pos.x, pos.y, acqSettings_);
controllerInstance.triggerControllerStartAcquisition(acqSettings_.acquisitionMode(),
acqSettings_.volume().firstView());
controllerInstance.triggerControllerStartAcquisition(acqSettings_.acquisitionMode());
return event;
}

Expand All @@ -500,11 +499,10 @@ public AcquisitionEvent run(AcquisitionEvent event) {
}
}

int side = 0;
// NOTE: not sure why this is being triggered twice with only 1 camera; so we need guard
// TODO: enable 2 sided acquisition
if (scanner.getSPIMState().equals(ASIScanner.SPIMState.IDLE)) {
controllerInstance.triggerControllerStartAcquisition(acqSettings_.acquisitionMode(), side);
controllerInstance.triggerControllerStartAcquisition(acqSettings_.acquisitionMode());
}
}
return event;
Expand Down
Loading