Skip to content

Commit

Permalink
set useStageScanning_ through acquisitionMode method, improve API
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon committed Apr 16, 2024
1 parent e518f2e commit cedf1dc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ interface Builder<T extends AcquisitionSettings.Builder<T>> extends AcquisitionS
*/
T useHardwareTimePoints(final boolean state);

/**
* Sets the acquisition to use stage scanning.
*
* @param state true to use stage scanning.
*/
T useStageScanning(final boolean state);

/**
* Sets the acquisition to use advanced timing settings.
*
Expand Down Expand Up @@ -131,6 +124,11 @@ interface Builder<T extends AcquisitionSettings.Builder<T>> extends AcquisitionS
*/
T channels(final ChannelSpec[] channels);

/**
* Sets the live scan period.
*
* @param liveScanPeriod the channel array
*/
T liveScanPeriod(final double liveScanPeriod);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,21 @@ public Builder(final DefaultAcquisitionSettingsSCAPE acqSettings) {
}

/**
* Sets the acquisition mode.
* Set the mode for the acquisition.
* <p>
* If the mode is a stage scanning mode,
* set internal stage scanning flag.
*
* @param acqMode the acquisition mode
*/
@Override
public Builder acquisitionMode(final AcquisitionMode acqMode) {
acquisitionMode_ = acqMode;
if (acqMode == AcquisitionMode.STAGE_SCAN
|| acqMode == AcquisitionMode.STAGE_SCAN_INTERLEAVED
|| acqMode == AcquisitionMode.STAGE_SCAN_UNIDIRECTIONAL) {
useStageScanning_ = true;
}
return this;
}

Expand Down Expand Up @@ -163,17 +171,6 @@ public Builder useHardwareTimePoints(final boolean state) {
return this;
}

/**
* Sets the acquisition to use stage scanning.
*
* @param state true to use stage scanning.
*/
@Override
public Builder useStageScanning(final boolean state) {
useStageScanning_ = state;
return this;
}

/**
* Sets the acquisition to use advanced timing settings.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ private void createEventHandlers() {
pnlChannelTable_.setItemsEnabled(state);
});

// select the acquisition mode
cmbAcquisitionModes_.registerListener(e -> {
final int index = cmbAcquisitionModes_.getSelectedIndex();
model_.acquisitions().settingsBuilder().acquisitionMode(AcquisitionMode.getByIndex(index));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ boolean setup() {

@Override
boolean run() {
// TODO: make this happen for all acq types
final boolean isPolling = frame_.getNavigationPanel().isPolling();
if (isPolling) {
studio_.logs().logMessage("stopped position polling");
frame_.getNavigationPanel().stopPolling();
studio_.logs().logMessage("stopped position polling");
}

asb_.sheetCalibrationBuilder(1).useAutoSheetWidth(true);
Expand All @@ -82,7 +81,6 @@ boolean run() {

// initialize stage scanning so we can restore state
Point2D.Double xyPosUm = new Point2D.Double();
double xSupPosUm = 0.0;
double origXSpeed = 1.0; // don't want 0 in case something goes wrong
double origXAccel = 1.0; // don't want 0 in case something goes wrong

Expand All @@ -101,17 +99,16 @@ boolean run() {
return false;
}

// second part: initialize stage scanning so we can restore state
// second part: initialize stage scanning, so we can restore state later
xyPosUm = xyStage.getXYPosition();
origXSpeed = xyStage.getSpeedX();
origXAccel = xyStage.getAccelerationX();

// TODO: add more checks from orignal plugin here...
// TODO: add more checks from original plugin here...
// if (origXSpeed < 0.2 && resetXaxisSpeed_) { etc...
}
}


PLogicSCAPE controller = null;

// Assume demo mode if default camera is DemoCamera
Expand Down

0 comments on commit cedf1dc

Please sign in to comment.