diff --git a/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8Device.java b/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8Device.java index b7af8c82..e8161910 100644 --- a/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8Device.java +++ b/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8Device.java @@ -114,7 +114,7 @@ public class PKT8Device extends PortSensor { //update parameters from meta if (meta().hasValue("pga")) { getLogger().info("Setting dynamic range to " + meta().getInt("pga")); - String response = getHandler().sendAndWait("g" + meta().getInt("pga"), 400, null).trim(); + String response = getHandler().sendAndWait("g" + meta().getInt("pga"), 400).trim(); if (response.contains("=")) { updateState(PGA, Integer.parseInt(response.substring(4))); } else { @@ -182,7 +182,7 @@ public class PKT8Device extends PortSensor { getLogger().info("Setting avaraging buffer size to " + buf); String response; try { - response = getHandler().sendAndWait("b" + buf, 400, null).trim(); + response = getHandler().sendAndWait("b" + buf, 400).trim(); } catch (Exception ex) { response = ex.getMessage(); } @@ -271,7 +271,7 @@ public class PKT8Device extends PortSensor { getLogger().info("Setting sampling rate to " + spsToStr(sps)); String response; try { - response = getHandler().sendAndWait("v" + sps, 400, null).trim(); + response = getHandler().sendAndWait("v" + sps, 400).trim(); } catch (Exception ex) { response = ex.getMessage(); } @@ -326,7 +326,6 @@ public class PKT8Device extends PortSensor { } - public class PKT8Measurement extends AbstractMeasurement implements PortHandler.PortController { final PortHandler handler; diff --git a/numass-control/magnet/src/main/java/inr/numass/control/magnet/MagnetController.java b/numass-control/magnet/src/main/java/inr/numass/control/magnet/MagnetController.java index 59d4d0e7..34d09d84 100644 --- a/numass-control/magnet/src/main/java/inr/numass/control/magnet/MagnetController.java +++ b/numass-control/magnet/src/main/java/inr/numass/control/magnet/MagnetController.java @@ -30,15 +30,13 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** - * - * * @author Polina */ public class MagnetController implements PortHandler.PortController { private static final DecimalFormat LAMBDAformat = new DecimalFormat("###.##"); public static double CURRENT_PRECISION = 0.05; -// public static double CURRENT_STEP = 0.05; + // public static double CURRENT_STEP = 0.05; public static int DEFAULT_DELAY = 1; public static int DEFAULT_MONITOR_DELAY = 2000; public static double MAX_STEP_SIZE = 0.2; @@ -64,7 +62,7 @@ public class MagnetController implements PortHandler.PortController { * constructor will be used. * * @param name - * @param port number of COM-port on your computer that you want to use + * @param port number of COM-port on your computer that you want to use * @param address number of TDK - Lambda * @param timeout waiting time for response */ @@ -122,11 +120,11 @@ public class MagnetController implements PortHandler.PortController { private String talk(String request) throws PortException { try { - return port.sendAndWait(request + "\r", timeout, null).trim(); + return port.sendAndWait(request + "\r", timeout).trim(); } catch (PortTimeoutException tex) { //Single retry on timeout LoggerFactory.getLogger(getClass()).warn("A timeout exception for request '" + request + "'. Making another atempt."); - return port.sendAndWait(request + "\r", timeout, null).trim(); + return port.sendAndWait(request + "\r", timeout).trim(); } } diff --git a/numass-control/magnet/src/main/java/inr/numass/control/magnet/Talk.java b/numass-control/magnet/src/main/java/inr/numass/control/magnet/Talk.java index 28b60c17..92104b5d 100644 --- a/numass-control/magnet/src/main/java/inr/numass/control/magnet/Talk.java +++ b/numass-control/magnet/src/main/java/inr/numass/control/magnet/Talk.java @@ -48,7 +48,7 @@ public class Talk { portName = args[0]; } PortHandler handler; - handler = PortFactory.getdPort(portName); + handler = PortFactory.getPort(portName); handler.setPhraseCondition((String str) -> str.endsWith("\r")); // MagnetController controller = new MagnetController(handler, 1); @@ -60,7 +60,7 @@ public class Talk { while (!"exit".equals(nextString)) { try { Instant start = DateTimeUtils.now(); - String answer = handler.sendAndWait(nextString + "\r", 1000, null); + String answer = handler.sendAndWait(nextString + "\r", null, 1000); //String answer = controller.request(nextString); System.out.printf("ANSWER (latency = %s): %s;%n", Duration.between(start, DateTimeUtils.now()), answer.trim()); } catch (PortException ex) { diff --git a/numass-control/magnet/src/main/java/inr/numass/control/magnet/fx/MagnetControllerApp.java b/numass-control/magnet/src/main/java/inr/numass/control/magnet/fx/MagnetControllerApp.java index 891b61f2..2ecb0a4c 100644 --- a/numass-control/magnet/src/main/java/inr/numass/control/magnet/fx/MagnetControllerApp.java +++ b/numass-control/magnet/src/main/java/inr/numass/control/magnet/fx/MagnetControllerApp.java @@ -24,16 +24,17 @@ import hep.dataforge.exceptions.ControlException; import inr.numass.control.magnet.MagnetController; import inr.numass.control.magnet.SafeMagnetController; import inr.numass.control.magnet.VirtualLambdaPort; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.stage.Stage; import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + /** * * @author Alexander Nozik @@ -71,7 +72,7 @@ public class MagnetControllerApp extends Application { if(portName.equals("virtual")){ handler = new VirtualLambdaPort("COM12", 1, 2, 3, 4); } else { - handler = PortFactory.getdPort(portName); + handler = PortFactory.getPort(portName); //TODO add meta reader here } diff --git a/numass-control/msp/src/main/java/inr/numass/control/msp/MspDevice.java b/numass-control/msp/src/main/java/inr/numass/control/msp/MspDevice.java index 932f3408..ab3ffd60 100644 --- a/numass-control/msp/src/main/java/inr/numass/control/msp/MspDevice.java +++ b/numass-control/msp/src/main/java/inr/numass/control/msp/MspDevice.java @@ -260,7 +260,8 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po String response = getHandler().sendAndWait( request, - TIMEOUT, (String str) -> str.trim().startsWith(commandName) + TIMEOUT, + (String str) -> str.trim().startsWith(commandName) ); return new MspResponse(response); } diff --git a/numass-control/vac/src/main/java/inr/numass/readvac/CM32Device.java b/numass-control/vac/src/main/java/inr/numass/readvac/CM32Device.java index fef6d626..6df83ebc 100644 --- a/numass-control/vac/src/main/java/inr/numass/readvac/CM32Device.java +++ b/numass-control/vac/src/main/java/inr/numass/readvac/CM32Device.java @@ -38,7 +38,7 @@ public class CM32Device extends PortSensor { if (portName.startsWith("com")) { newHandler = new ComPortHandler(portName, 2400, 8, 1, 0); } else { - newHandler = PortFactory.getdPort(portName); + newHandler = PortFactory.getPort(portName); } newHandler.setDelimeter("T--\r"); return newHandler; diff --git a/numass-control/vac/src/main/java/inr/numass/readvac/MeradatVacDevice.java b/numass-control/vac/src/main/java/inr/numass/readvac/MeradatVacDevice.java index a575da2b..09d536be 100644 --- a/numass-control/vac/src/main/java/inr/numass/readvac/MeradatVacDevice.java +++ b/numass-control/vac/src/main/java/inr/numass/readvac/MeradatVacDevice.java @@ -50,11 +50,10 @@ public class MeradatVacDevice extends PortSensor { return meta().getString("type", "Vit vacuumeter"); } + private class MeradatMeasurement extends SimpleMeasurement { -// private static final String VIT_QUERY = ":010300000002FA\r\n"; - - private final String query; + private final String query; // ":010300000002FA\r\n"; private final Pattern response; private final String base;