Closedown

This commit is contained in:
sfop
2017-04-27 12:53:54 +02:00
parent e30add5aa0
commit cf505cdb61
6 changed files with 45 additions and 40 deletions

View File

@@ -16,10 +16,8 @@ import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.Plugin;
import ch.psi.utils.Convert;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
@@ -30,7 +28,6 @@ import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
/**
@@ -67,7 +64,7 @@ public class WireScan extends Panel {
DefaultComboBoxModel model = new DefaultComboBoxModel();
eval("run('Devices/Elements')", true);
model.addElement("");
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scans()", true);
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scanners()", true);
for (String scan: ret){
model.addElement(scan);
}
@@ -191,8 +188,9 @@ public class WireScan extends Panel {
if ("WireScan".equals(getContext().getExecutionPars().getName())) {
double position = (Double) record.getValues()[0];
for (int i=0; i< series.length; i++){
if (record.getValues()[4 + i] != null){
series[i].appendData(position,(Double) record.getValues()[5 + i]);
Double val = (Double) record.getValues()[5 + i];
if (val != null){
series[i].appendData(position, val);
}
}
}
@@ -228,6 +226,7 @@ public class WireScan extends Panel {
if (parked && moved){
System.out.println("Parking scanner");
Epics.putq(currentScannner + ":GARAGE_SEL.PROC", 1);
Epics.putq(currentScannner + ":INIT.PROC", 1);
}
} catch (Exception ex){
ex.printStackTrace();
@@ -383,7 +382,7 @@ public class WireScan extends Panel {
plot.setTitle("");
buttonPark.setText("Park");
buttonPark.setText("Garage");
buttonPark.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonParkActionPerformed(evt);
@@ -499,16 +498,13 @@ public class WireScan extends Panel {
.addComponent(panelStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 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(spinnerStartY)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStartY)
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerCycles)))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerCycles))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
@@ -640,7 +636,7 @@ public class WireScan extends Panel {
cb.setSelectedItem("");
}
} else {
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scans_bpms('" + currentScannner + "')", true);
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scanners_bpms('" + currentScannner + "')", true);
comboBpm1.setSelectedItem((ret==null) ? "" : ret.get(0));
comboBpm2.setSelectedItem((ret==null) ? "" : ret.get(1));
int selection = Epics.get(currentScannner + ":WIRE_SP", Integer.class);
@@ -716,6 +712,7 @@ public class WireScan extends Panel {
bpms.add(cb.getSelectedItem().toString());
}
}
parameters.add(bpms);
getContext().addScanListener(scanListener);
try {
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
@@ -750,6 +747,15 @@ public class WireScan extends Panel {
private void buttonMoveStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveStartActionPerformed
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);
} else {
Epics.putq(currentScannner + ":WIRE_SP", isX ? 3 : 4);
}
Epics.putq(currentScannner + ":INIT.PROC", 1);
} catch (Exception ex) {
showException(ex);
@@ -759,6 +765,7 @@ public class WireScan extends Panel {
private void buttonParkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonParkActionPerformed
try {
Epics.putq(currentScannner + ":GARAGE_SEL.PROC", 1);
Epics.putq(currentScannner + ":INIT.PROC", 1);
} catch (Exception ex) {
showException(ex);
}