This commit is contained in:
sfop
2017-05-09 11:32:08 +02:00
parent 412c99fe64
commit 06f3fdeca3
12 changed files with 589 additions and 287 deletions

View File

@@ -12,19 +12,14 @@ import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.Plugin;
import ch.psi.utils.Convert;
import ch.psi.utils.State;
import java.awt.BorderLayout;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
*
@@ -144,11 +139,12 @@ public class WireScan extends Panel {
boolean validWireScan = isValidScanner();
buttonMoveStart.setEnabled((state==State.Ready) && validWireScan && homed);
buttonPark.setEnabled((state==State.Ready) && validWireScan && homed);
buttonParkAll.setEnabled(state==State.Ready);
buttonScan.setEnabled((state==State.Ready) && validWireScan && homed);
buttonAbort.setEnabled(state==State.Busy);
comboScanType.setEnabled(validWireScan);
for (JComboBox cb : bpmCombos){
cb.setEnabled(validWireScan);
cb.setEnabled(validWireScan && !isBackground());
}
for (JComboBox cb : blmCombos){
cb.setEnabled(validWireScan);
@@ -156,15 +152,12 @@ public class WireScan extends Panel {
buttonMotorPanel.setEnabled(validWireScan);
buttonScannerPanel.setEnabled(validWireScan);
buttonHoming.setEnabled(validWireScan);
spinnerVel.setEnabled(validWireScan);
spinnerCycles.setEnabled(validWireScan);
int type = comboScanType.getSelectedIndex();
boolean isX = (type==0) || (type==2) || (type>=4);
boolean isY = (type==1) || (type==3) || (type>=4);
spinnerStartX.setEnabled(validWireScan && isX);
spinnerEndX.setEnabled(validWireScan && isX);
spinnerStartY.setEnabled(validWireScan && isY);
spinnerEndY.setEnabled(validWireScan && isY);
spinnerVel.setEnabled(validWireScan && !isBackground());
spinnerCycles.setEnabled(validWireScan && !isBackground());
spinnerStartX.setEnabled(validWireScan && isX());
spinnerEndX.setEnabled(spinnerStartX.isEnabled());
spinnerStartY.setEnabled(validWireScan && isY());
spinnerEndY.setEnabled(spinnerStartY.isEnabled());
}
@Override
@@ -210,16 +203,57 @@ public class WireScan extends Panel {
}
int getWireSet(){
int i = comboScanType.getSelectedIndex();
switch (i){
case 2:
case 3:
case 5:
switch (comboScanType.getSelectedIndex()){
case 0: case 1: case 4:
return 1;
case 2: case 3: case 5:
return 2;
}
return 1;
}
return 0;
}
boolean isSet(){
switch (comboScanType.getSelectedIndex()){
case 4: case 5:
return true;
}
return false;
}
boolean isSet1(){
switch (comboScanType.getSelectedIndex()){
case 0: case 1: case 4:
return true;
}
return false;
}
boolean isX(){
switch (comboScanType.getSelectedIndex()){
case 0: case 2: case 4: case 5:
return true;
}
return false;
}
boolean isY(){
switch (comboScanType.getSelectedIndex()){
case 1: case 3: case 4: case 5:
return true;
}
return false;
}
boolean isBackground(){
switch (comboScanType.getSelectedIndex()){
case 6: case 7:
return true;
}
return false;
}
void updatePosition(Double value){
if (value!=null && !Double.isNaN((Double)value)){
try {
@@ -290,6 +324,7 @@ public class WireScan extends Panel {
jLabel19 = new javax.swing.JLabel();
spinnerBackground = new javax.swing.JSpinner();
jLabel20 = new javax.swing.JLabel();
buttonParkAll = new javax.swing.JButton();
comboWireScanner.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -439,104 +474,114 @@ public class WireScan extends Panel {
jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel20.setText("Wire Scanner:");
buttonParkAll.setText("ParkAll");
buttonParkAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonParkAllActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonPark)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonScan)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11)
.addComponent(jLabel13)
.addComponent(jLabel14)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(buttonScan)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosX, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosY, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel11)
.addComponent(jLabel13)
.addComponent(jLabel14)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosX, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosY, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonHoming, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonScannerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMotorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonHoming, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonScannerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMotorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(labelStartY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboWireScanner, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboScanType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStartY)
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9))
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerStartX)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel7))
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel19)
.addComponent(labelEndY))))
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerEndX, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerEndY, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerBackground, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerCycles, javax.swing.GroupLayout.Alignment.TRAILING))))))
.addComponent(jLabel8))
.addGap(0, 0, 0)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(labelStartY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboWireScanner, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboScanType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStartY)
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9))
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerStartX)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel7))
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel19)
.addComponent(labelEndY))))
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerEndX, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerEndY, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerBackground, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerCycles, javax.swing.GroupLayout.Alignment.TRAILING)))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(154, 154, 154))
.addGroup(layout.createSequentialGroup()
.addComponent(buttonPark)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(buttonParkAll)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(buttonMoveStart)
.addGap(0, 0, 0)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
.addGap(11, 11, 11))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel13, jLabel14, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, labelEndY, labelStartY});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonScan});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonParkAll, buttonScan});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMotorPanel, buttonScannerPanel});
@@ -634,10 +679,13 @@ public class WireScan extends Panel {
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAbort)
.addComponent(buttonScan)
.addComponent(buttonPark)
.addComponent(buttonMoveStart)
.addComponent(buttonPark)))
.addComponent(buttonParkAll))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAbort)
.addComponent(buttonScan)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -714,13 +762,13 @@ public class WireScan extends Panel {
private void comboScanTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboScanTypeActionPerformed
try {
int type = comboScanType.getSelectedIndex();
boolean isSet = (type>=4);
boolean isSet1 = (type==0) || (type==1) || (type==4);
spinnerStartX.setValue(Epics.get(currentScannner + (isSet1 ? ":W1X" : ":W2X") + "_START_SP", Double.class));
spinnerEndX.setValue(Epics.get(currentScannner + (isSet1 ? ":W1X" : ":W2X") + "_END_SP", Double.class));
spinnerStartY.setValue(Epics.get(currentScannner + (isSet1 ? ":W1Y" : ":W2Y") + "_START_SP", Double.class));
spinnerEndY.setValue(Epics.get(currentScannner + (isSet1 ? ":W1Y" : ":W2Y") + "_END_SP", Double.class));
if (!isBackground()){
boolean set1 = isSet1();
spinnerStartX.setValue(Epics.get(currentScannner + (set1 ? ":W1X" : ":W2X") + "_START_SP", Double.class));
spinnerEndX.setValue(Epics.get(currentScannner + (set1 ? ":W1X" : ":W2X") + "_END_SP", Double.class));
spinnerStartY.setValue(Epics.get(currentScannner + (set1 ? ":W1Y" : ":W2Y") + "_START_SP", Double.class));
spinnerEndY.setValue(Epics.get(currentScannner + (set1 ? ":W1Y" : ":W2Y") + "_END_SP", Double.class));
}
} catch (Exception ex) {
showException(ex);
}
@@ -733,54 +781,76 @@ public class WireScan extends Panel {
}//GEN-LAST:event_comboScanTypeActionPerformed
private void buttonScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanActionPerformed
ArrayList parameters = new ArrayList();
parameters.add(currentScannner);
parameters.add(comboScanType.getSelectedItem().toString());
ArrayList range = new ArrayList();
range.add(spinnerStartX.getValue());
range.add(spinnerEndX.getValue());
range.add(spinnerStartY.getValue());
range.add(spinnerEndY.getValue());
parameters.add(range);
parameters.add(spinnerCycles.getValue());
parameters.add(spinnerVel.getValue());
ArrayList bpms = new ArrayList();
for (JComboBox cb : bpmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
bpms.add(cb.getSelectedItem().toString());
}
}
parameters.add(bpms);
ArrayList blms = new ArrayList();
for (JComboBox cb : blmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
blms.add(cb.getSelectedItem().toString());
}
}
parameters.add(blms);
parameters.add(spinnerBackground.getValue());
parameters.add(plot);
try {
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
//SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput());
/*
JPanel pn = new JPanel(new BorderLayout());
((BorderLayout) pn.getLayout()).setHgap(5);
pn.add(new JLabel("Generated data file:"), BorderLayout.NORTH);
JTextField tf = new JTextField(getContext().getDataManager().getLastOutput());
tf.setPreferredSize(new Dimension(600, tf.getPreferredSize().height));
tf.setEditable(false);
pn.add(tf, BorderLayout.SOUTH);
JOptionPane.showOptionDialog(WireScan.this, pn, "Success", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
*/
ArrayList parameters = new ArrayList();
System.out.println("Background: " + isBackground());
if (isBackground()){
parameters.add(currentScannner);
parameters.add(comboScanType.getSelectedItem().toString());
ArrayList blms = new ArrayList();
for (JComboBox cb : blmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
blms.add(cb.getSelectedItem().toString());
}
}
return ret;
});
parameters.add(blms);
parameters.add(spinnerBackground.getValue());
parameters.add(plot);
runAsync("Diagnostics/WireScanBackground", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
}
return ret;
});
} else {
parameters.add(currentScannner);
parameters.add(comboScanType.getSelectedItem().toString());
ArrayList range = new ArrayList();
range.add(spinnerStartX.getValue());
range.add(spinnerEndX.getValue());
range.add(spinnerStartY.getValue());
range.add(spinnerEndY.getValue());
parameters.add(range);
parameters.add(spinnerCycles.getValue());
parameters.add(spinnerVel.getValue());
ArrayList bpms = new ArrayList();
for (JComboBox cb : bpmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
bpms.add(cb.getSelectedItem().toString());
}
}
parameters.add(bpms);
ArrayList blms = new ArrayList();
for (JComboBox cb : blmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
blms.add(cb.getSelectedItem().toString());
}
}
parameters.add(blms);
parameters.add(spinnerBackground.getValue());
parameters.add(plot);
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
//SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput());
/*
JPanel pn = new JPanel(new BorderLayout());
((BorderLayout) pn.getLayout()).setHgap(5);
pn.add(new JLabel("Generated data file:"), BorderLayout.NORTH);
JTextField tf = new JTextField(getContext().getDataManager().getLastOutput());
tf.setPreferredSize(new Dimension(600, tf.getPreferredSize().height));
tf.setEditable(false);
pn.add(tf, BorderLayout.SOUTH);
JOptionPane.showOptionDialog(WireScan.this, pn, "Success", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
*/
}
return ret;
});
}
} catch (Exception ex) {
showException(ex);
}
@@ -795,15 +865,14 @@ public class WireScan extends Panel {
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonMoveStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveStartActionPerformed
try {
try {
int type = comboScanType.getSelectedIndex();
boolean isSet1 = (type==0) || (type==1) || (type==4);
boolean isX = (type==0) || (type==2) || (type>=4);
if (isSet1){
Epics.putq(currentScannner + ":WIRE_SP", isX ? 1 : 2);
if (isBackground()){
Epics.putq(currentScannner + ":WIRE_SP", (type==7) ? 5 : 0);
} else if (isSet1()){
Epics.putq(currentScannner + ":WIRE_SP", isX() ? 1 : 2);
} else {
Epics.putq(currentScannner + ":WIRE_SP", isX ? 3 : 4);
Epics.putq(currentScannner + ":WIRE_SP", isX() ? 3 : 4);
}
Epics.putq(currentScannner + ":INIT.PROC", 1);
} catch (Exception ex) {
@@ -848,12 +917,30 @@ public class WireScan extends Panel {
}
}//GEN-LAST:event_buttonHomingActionPerformed
private void buttonParkAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonParkAllActionPerformed
try {
runAsync("Diagnostics/ParkAllWireScanners").handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
SwingUtils.showMessage(getTopLevel(), "Success", "Finished parking wire scanners");
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonParkAllActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonHoming;
private javax.swing.JButton buttonMotorPanel;
private javax.swing.JButton buttonMoveStart;
private javax.swing.JButton buttonPark;
private javax.swing.JButton buttonParkAll;
private javax.swing.JButton buttonScan;
private javax.swing.JButton buttonScannerPanel;
private javax.swing.JComboBox comboBlm1;