This commit is contained in:
gac-S_Changer
2018-12-14 15:25:12 +01:00
parent da3bf82cfe
commit 927c6acc46
7 changed files with 39 additions and 19 deletions

View File

@@ -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|||

View File

@@ -100,9 +100,6 @@
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="barcode_reader"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel1">
<Properties>
@@ -111,7 +108,6 @@
<TitledBorder title="Value"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="barcode_reader"/>
</Properties>
</Component>
</SubComponents>

View File

@@ -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 {
}// </editor-fold>//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

Binary file not shown.

View File

@@ -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("<H>")
self.microscan_cmd.write("<H>")
self.setState(State.Ready)
def disable(self):
microscan_cmd.write("<I>")
self.microscan_cmd.write("<I>")
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)

View File

@@ -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

View File

@@ -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())