Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set useStageScanning_ through acquisitionMode method, improve API #263

Merged
merged 1 commit into from
Apr 16, 2024
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 @@ -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
Loading