diff --git a/config/devices.properties b/config/devices.properties index 7f3bcad..03445da 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -3,8 +3,10 @@ #monitoring_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8e9cc87b.psi.ch/axis-cgi/mjpg/video.cgi?camera=2 reopen||-200| #top_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8e9cc87b.psi.ch/axis-cgi/mjpg/video.cgi?camera=3 true||-200| #cam=ch.psi.pshell.epics.AreaDetector|MX-SAMCAM||| -microscan=ch.psi.pshell.serial.TcpDevice|MicroHAWK38C528:2001||| -microscan_cmd=ch.psi.pshell.serial.TcpDevice|MicroHAWK38C528:2003||| +mscan_pin=ch.psi.pshell.serial.TcpDevice|mscan-tell6s-pin:2001||| +mscan_pin_cmd=ch.psi.pshell.serial.TcpDevice|mscan-tell6s-pin:2003||| +mscan_puck=ch.psi.pshell.serial.TcpDevice|mscan-tell6s-puck:2001||| +mscan_puck_cmd=ch.psi.pshell.serial.TcpDevice|mscan-tell6s-puck:2003||| $ue=LaserUE|COM4|||false puck_detection=ch.psi.mxsc.PuckDetection|tell6s-raspberrypi:5556||| wago=ch.psi.pshell.modbus.ModbusTCP|tell6s-wago:502||| diff --git a/plugins/BarcodeReaderPanel.form b/plugins/BarcodeReaderPanel.form index 3e615f6..1d2c4af 100644 --- a/plugins/BarcodeReaderPanel.form +++ b/plugins/BarcodeReaderPanel.form @@ -100,9 +100,6 @@ - - - @@ -111,7 +108,6 @@ - diff --git a/plugins/BarcodeReaderPanel.java b/plugins/BarcodeReaderPanel.java index cb269c2..d6dabed 100644 --- a/plugins/BarcodeReaderPanel.java +++ b/plugins/BarcodeReaderPanel.java @@ -1,4 +1,5 @@ import ch.psi.pshell.core.Context; +import ch.psi.pshell.device.Device; import ch.psi.pshell.swing.DevicePanel; import ch.psi.utils.swing.SwingUtils; import java.util.concurrent.CompletableFuture; @@ -17,11 +18,21 @@ public class BarcodeReaderPanel extends DevicePanel { CompletableFuture future; + + @Override + public void setDevice(Device device){ + super.setDevice(device); + if (device != null){ + deviceStatePanel1.setDevice(device); + deviceValuePanel1.setDevice(device); + } + } + @Override public void onTimer(){ if ((getDevice()!=null) && enabled){ if ((future==null) || (future.isDone())){ - future = Context.getInstance().evalLineBackgroundAsync("barcode_reader.get()"); + future = Context.getInstance().evalLineBackgroundAsync(getDevice().getName() + ".get()"); } } } @@ -109,10 +120,7 @@ public class BarcodeReaderPanel extends DevicePanel { .addContainerGap()) ); - deviceStatePanel1.setDeviceName("barcode_reader"); - deviceValuePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Value")); - deviceValuePanel1.setDeviceName("barcode_reader"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -135,18 +143,18 @@ public class BarcodeReaderPanel extends DevicePanel { }// //GEN-END:initComponents private void buttonEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEnableActionPerformed - execute("barcode_reader.enable()", false); + execute(getDevice().getName() + ".enable()", false); enabled = true; }//GEN-LAST:event_buttonEnableActionPerformed private void buttonDisableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDisableActionPerformed enabled = false; - execute("barcode_reader.disable()", false); + execute(getDevice().getName() + ".disable()", false); }//GEN-LAST:event_buttonDisableActionPerformed private void buttonReadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReadActionPerformed enabled = false; - execute("barcode_reader.read(5.0) ", true); + execute(getDevice().getName() + ".read(5.0) ", true); }//GEN-LAST:event_buttonReadActionPerformed diff --git a/plugins/MXSC-1.10.0.jar b/plugins/MXSC-1.10.0.jar index dd0ba72..1f92a4d 100644 Binary files a/plugins/MXSC-1.10.0.jar and b/plugins/MXSC-1.10.0.jar differ diff --git a/script/devices/BarcodeReader.py b/script/devices/BarcodeReader.py index 70c5160..48b84ca 100644 --- a/script/devices/BarcodeReader.py +++ b/script/devices/BarcodeReader.py @@ -2,6 +2,12 @@ class BarcodeReader(DeviceBase): + def __init__(self, name, microscan, microscan_cmd): + DeviceBase.__init__(self, name) + self.microscan = microscan + self.microscan_cmd = microscan_cmd + + def doInitialize(self): self.disable() self.readout = None @@ -9,19 +15,19 @@ class BarcodeReader(DeviceBase): self.task_callable=None def enable(self): - microscan_cmd.write("") + self.microscan_cmd.write("") self.setState(State.Ready) def disable(self): - microscan_cmd.write("") + self.microscan_cmd.write("") self.setState(State.Disabled) def get(self,timeout=1.0): self.state.assertReady() try: self.setState(State.Busy) - microscan.flush() - ret = microscan.waitString(int(timeout * 1000)) + self.microscan.flush() + ret = self.microscan.waitString(int(timeout * 1000)) if ret is not None: ret = ret.strip() self.setCache(ret, None) @@ -72,5 +78,6 @@ class BarcodeReader(DeviceBase): return self.readout -add_device(BarcodeReader("barcode_reader"), force = True) +add_device(BarcodeReader("barcode_reader", mscan_pin, mscan_pin_cmd), force = True) +add_device(BarcodeReader("barcode_reader_puck", mscan_puck, mscan_puck_cmd), force = True) \ No newline at end of file diff --git a/script/devices/Hexiposi.py b/script/devices/Hexiposi.py index 52c86c4..10ea4ab 100644 --- a/script/devices/Hexiposi.py +++ b/script/devices/Hexiposi.py @@ -146,7 +146,7 @@ class Hexiposi(DiscretePositionerBase): #http://myriotell:8003/hexiposi/get -dev = Hexiposi("hexiposi", "myriotell") +dev = Hexiposi("hexiposi", "myriotell6s") add_device(dev, True) hexiposi.polling=1000 diff --git a/script/local.py b/script/local.py index 50fe79c..c0327bf 100644 --- a/script/local.py +++ b/script/local.py @@ -55,6 +55,13 @@ def set_barcode_reader_scan_pucks(value): def reset_mounted_sample_position(): set_setting("mounted_sample_position", None) + +def get_puck_barcode_reader(): + if is_barcode_reader_scan_pucks(): + return barcode_reader + else: + return barcode_reader_puck + #In order to apply current config set_imaging_enabled(is_imaging_enabled()) set_puck_types(get_puck_types())