Startup
This commit is contained in:
@@ -138,7 +138,6 @@
|
||||
<Component class="javax.swing.JButton" name="buttonGrabBackground">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Grab Background"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonGrabBackgroundActionPerformed"/>
|
||||
|
||||
@@ -567,7 +567,6 @@ public class ScreenPanel extends Panel {
|
||||
System.out.println("Setting camera: " + cameraName + " [" + (buttonCamtool.isSelected() ? "camtool" : "direct") + "]");
|
||||
parseUserOverlays();
|
||||
errorOverlay = null;
|
||||
buttonGrabBackground.setEnabled(false);
|
||||
checkBackground.setEnabled(false);
|
||||
spinnerThreshold.setEnabled(false);
|
||||
checkThreshold.setEnabled(false);
|
||||
@@ -649,10 +648,11 @@ public class ScreenPanel extends Panel {
|
||||
}
|
||||
spinnerThreshold.setEnabled(true);
|
||||
checkThreshold.setEnabled(true);
|
||||
buttonGrabBackground.setEnabled(true);
|
||||
|
||||
((Camtool) camera).startReceiver();
|
||||
} else {
|
||||
checkBackground.setEnabled(true);
|
||||
checkBackground.setSelected(false);
|
||||
if (polling <= 0) {
|
||||
camera.setMonitored(true);
|
||||
} else {
|
||||
@@ -1391,7 +1391,7 @@ public class ScreenPanel extends Panel {
|
||||
}
|
||||
|
||||
void setLaserState(boolean value) throws Exception {
|
||||
|
||||
System.out.println( "Setting laser state: " + value);
|
||||
Epics.putq("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", value ? 0 : 1);
|
||||
Epics.putq("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1);
|
||||
Thread.sleep(3000);
|
||||
@@ -1805,7 +1805,6 @@ public class ScreenPanel extends Panel {
|
||||
});
|
||||
|
||||
buttonGrabBackground.setText("Grab Background");
|
||||
buttonGrabBackground.setEnabled(false);
|
||||
buttonGrabBackground.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonGrabBackgroundActionPerformed(evt);
|
||||
@@ -2603,27 +2602,40 @@ public class ScreenPanel extends Panel {
|
||||
|
||||
private void buttonGrabBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGrabBackgroundActionPerformed
|
||||
try {
|
||||
if ((camera != null) && (camera instanceof Camtool)) {
|
||||
if (camera != null) {
|
||||
if (SwingUtils.showOption(getTopLevel(), "Background", "Do you want to capture background now?", OptionType.YesNo) == OptionResult.Yes) {
|
||||
boolean laserOn = getLaserState();
|
||||
boolean rendering = (!camera.isClosed());
|
||||
if (rendering) {
|
||||
camera.close();
|
||||
}
|
||||
if (laserOn) {
|
||||
setLaserState(false);
|
||||
}
|
||||
try {
|
||||
System.out.println("Grabbing background for: " + cameraName);
|
||||
((Camtool) camera).grabBackground(cameraName, 5);
|
||||
} finally {
|
||||
if (laserOn) {
|
||||
setLaserState(true);
|
||||
}
|
||||
if (camera instanceof Camtool){
|
||||
boolean rendering = (!camera.isClosed());
|
||||
if (rendering) {
|
||||
comboCamerasActionPerformed(null);
|
||||
camera.close();
|
||||
}
|
||||
if (laserOn) {
|
||||
setLaserState(false);
|
||||
}
|
||||
try {
|
||||
System.out.println("Grabbing background for: " + cameraName);
|
||||
((Camtool) camera).grabBackground(cameraName, 5);
|
||||
} finally {
|
||||
if (laserOn) {
|
||||
setLaserState(true);
|
||||
}
|
||||
if (rendering) {
|
||||
comboCamerasActionPerformed(null);
|
||||
}
|
||||
updateStop();
|
||||
}
|
||||
} else {
|
||||
if (laserOn) {
|
||||
setLaserState(false);
|
||||
}
|
||||
try {
|
||||
camera.captureBackground(5, 0);
|
||||
} finally {
|
||||
if (laserOn) {
|
||||
setLaserState(true);
|
||||
}
|
||||
}
|
||||
updateStop();
|
||||
}
|
||||
SwingUtils.showMessage(getTopLevel(), "Success", "Success capturing background", 5000);
|
||||
}
|
||||
@@ -2813,21 +2825,25 @@ public class ScreenPanel extends Panel {
|
||||
}//GEN-LAST:event_spinnerThresholdonChange
|
||||
|
||||
private void checkBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBackgroundActionPerformed
|
||||
if (updatingCamtoolControls) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if ((camera instanceof Camtool) && (((Camtool) camera).isPipelineStarted())) {
|
||||
((Camtool) camera).setBackgroundSubtraction(checkBackground.isSelected());
|
||||
if (camera instanceof Camtool){
|
||||
if (updatingCamtoolControls) {
|
||||
return;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateCamtoolControls();
|
||||
//There is a bug in camtool: it will flag bg extraction as on:
|
||||
updatingCamtoolControls = true;
|
||||
checkBackground.setSelected(false);
|
||||
updatingCamtoolControls = false;
|
||||
try {
|
||||
if (((Camtool) camera).isPipelineStarted()) {
|
||||
((Camtool) camera).setBackgroundSubtraction(checkBackground.isSelected());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateCamtoolControls();
|
||||
//There is a bug in camtool: it will flag bg extraction as on:
|
||||
updatingCamtoolControls = true;
|
||||
checkBackground.setSelected(false);
|
||||
updatingCamtoolControls = false;
|
||||
|
||||
}
|
||||
} else {
|
||||
camera.setBackgroundEnabled(checkBackground.isSelected());
|
||||
}
|
||||
}//GEN-LAST:event_checkBackgroundActionPerformed
|
||||
|
||||
|
||||
Reference in New Issue
Block a user