This commit is contained in:
@@ -4,10 +4,12 @@ import ch.psi.pshell.core.DevicePoolListener;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.device.GenericDevice;
|
||||
import ch.psi.pshell.swing.DevicePanel;
|
||||
import ch.psi.pshell.swing.Led;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Color;
|
||||
import java.awt.Window;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -16,7 +18,8 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
|
||||
GenericDevice robot;
|
||||
GenericDevice hexiposi;
|
||||
GenericDevice microscan;
|
||||
GenericDevice barcode_reader;
|
||||
GenericDevice barcode_reader_puck;
|
||||
GenericDevice wago;
|
||||
GenericDevice laser;
|
||||
GenericDevice puck_detection;
|
||||
@@ -32,7 +35,7 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
GenericDevice[] getDevices(){
|
||||
return new GenericDevice[]{robot, hexiposi, microscan, wago, laser, puck_detection, sm};
|
||||
return new GenericDevice[]{robot, hexiposi, barcode_reader, barcode_reader_puck, wago, laser, puck_detection, sm};
|
||||
}
|
||||
|
||||
final DeviceAdapter deviceListener = new DeviceAdapter() {
|
||||
@@ -64,7 +67,8 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
}
|
||||
robot = Controller.getInstance().getDevice("robot");
|
||||
hexiposi = Controller.getInstance().getDevice("hexiposi");
|
||||
microscan = Controller.getInstance().getDevice("microscan");
|
||||
barcode_reader = Controller.getInstance().getDevice("barcode_reader");
|
||||
barcode_reader_puck = Controller.getInstance().getDevice("barcode_reader_puck");
|
||||
wago = Controller.getInstance().getDevice("wago");
|
||||
laser = Controller.getInstance().getDevice("ue");
|
||||
puck_detection = Controller.getInstance().getDevice("puck_detection");
|
||||
@@ -81,7 +85,10 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
void update(){
|
||||
setLedState(ledBarcodeReader, microscan);
|
||||
setLedState(ledBarcodeReader, barcode_reader);
|
||||
if ((barcode_reader_puck!=null) && (ledBarcodeReader.getColor()==Color.green)){
|
||||
setLedState(ledBarcodeReader, barcode_reader_puck);
|
||||
}
|
||||
setLedState(ledCamera, img);
|
||||
setLedState(ledGripperImage, gripper_cam);
|
||||
setLedState(ledHexiposi, hexiposi);
|
||||
@@ -103,9 +110,11 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
case Initializing:
|
||||
case Paused:
|
||||
case Busy:
|
||||
case Disabled:
|
||||
led.setColor(Color.orange);
|
||||
break;
|
||||
case Disabled:
|
||||
led.setColor(dev.getName().startsWith("barcode_reader") ? Color.green : Color.orange);
|
||||
break;
|
||||
case Invalid:
|
||||
case Closing:
|
||||
case Fault:
|
||||
@@ -118,15 +127,16 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void showDevicePanel(String device){
|
||||
|
||||
DevicePanel showDevicePanel(String device){
|
||||
if (isActive()){
|
||||
try{
|
||||
Controller.getInstance().getMainFrame().showDevicePanel(device);
|
||||
return Controller.getInstance().getMainFrame().showDevicePanel(device);
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void showRenderer(String device){
|
||||
@@ -425,7 +435,14 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
}//GEN-LAST:event_labelWagoMouseClicked
|
||||
|
||||
private void labelReaderMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelReaderMouseClicked
|
||||
showDevicePanel("barcode_reader");
|
||||
DevicePanel dp1 = showDevicePanel("barcode_reader");
|
||||
if (Controller.getInstance().getDevicePool().getByName("barcode_reader_puck")!=null){
|
||||
DevicePanel dp2 = showDevicePanel("barcode_reader_puck");
|
||||
if ((dp1!=null)&& (dp2!=null)){
|
||||
Window parent = ((Window )dp2.getTopLevelAncestor());
|
||||
parent.setLocation(parent.getX()+80, parent.getY()+40);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_labelReaderMouseClicked
|
||||
|
||||
private void ledPuckDetectionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ledPuckDetectionMouseClicked
|
||||
|
||||
Reference in New Issue
Block a user