From 3226c1aebca683292009d770eaebe4d73eb7b90d Mon Sep 17 00:00:00 2001 From: darksnake Date: Thu, 20 Oct 2016 05:04:33 +0300 Subject: [PATCH] numass cryotemp update --- numass-control/vac/build.gradle | 2 +- .../readvac/fx/VacCollectorController.java | 14 +++++++---- .../inr/numass/readvac/fx/VacuumeterView.java | 24 +++++++++---------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/numass-control/vac/build.gradle b/numass-control/vac/build.gradle index 1c9e1ab0..37fdda06 100644 --- a/numass-control/vac/build.gradle +++ b/numass-control/vac/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'application' -version = "0.4.0" +version = "0.4.1" if (!hasProperty('mainClass')) { ext.mainClass = 'inr.numass.readvac.app.ReadVac' diff --git a/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java b/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java index cce07154..6b9d54b7 100644 --- a/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java +++ b/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java @@ -53,7 +53,7 @@ import java.io.File; import java.net.URL; import java.time.Instant; import java.time.LocalDateTime; -import java.time.ZoneId; +import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; @@ -71,7 +71,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me private final String[] intervalNames = {"1 sec", "5 sec", "10 sec", "30 sec", "1 min"}; private final int[] intervals = {1000, 5000, 10000, 30000, 60000}; private final List views = new ArrayList<>(); - ConsoleFragment consoleWindow; + private ConsoleFragment consoleWindow; private Logger logger; private LoaderConnection storageConnection; private VacCollectorDevice device; @@ -156,8 +156,15 @@ public class VacCollectorController implements Initializable, DeviceListener, Me public void onMeasurementResult(Measurement measurement, DataPoint result, Instant time) { if (plottables != null) { plottables.put(result); + //workaround to fix autorange problem +// for (String n : result.names()) { +// Value val = result.getValue(n); +// if (val.doubleValue() > 0) { +// plottables.put(n, val); +// } +// } } - Platform.runLater(() -> timeLabel.setText(TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneId.systemDefault())))); + Platform.runLater(() -> timeLabel.setText(TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneOffset.UTC)))); } private void setupView() { @@ -171,7 +178,6 @@ public class VacCollectorController implements Initializable, DeviceListener, Me plottables.addPlottable(plot); }); plottables.setEachConfigValue("thickness", 3); - //TODO make history length edittable plottables.setMaxAge(java.time.Duration.ofHours(3)); plotContainer.setPlot(setupPlot(plottables)); } diff --git a/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacuumeterView.java b/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacuumeterView.java index fb4e0003..f9a3a196 100644 --- a/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacuumeterView.java +++ b/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacuumeterView.java @@ -13,14 +13,6 @@ import hep.dataforge.meta.Annotated; import hep.dataforge.meta.Meta; import hep.dataforge.names.Named; import hep.dataforge.values.Value; -import java.io.IOException; -import java.net.URL; -import java.text.DecimalFormat; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.ResourceBundle; import javafx.application.Platform; import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; @@ -31,8 +23,16 @@ import javafx.scene.control.Label; import javafx.scene.paint.Color; import org.controlsfx.control.ToggleSwitch; +import java.io.IOException; +import java.net.URL; +import java.text.DecimalFormat; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.ResourceBundle; + /** - * * @author Alexander Nozik */ public class VacuumeterView extends DeviceViewController implements MeasurementListener, Initializable, Named, Annotated { @@ -89,10 +89,10 @@ public class VacuumeterView extends DeviceViewController implements MeasurementL Platform.runLater(() -> { unitLabel.setText(getDevice().meta().getString("units", "mbar")); deviceNameLabel.setText(getDevice().getName()); - disableButton.setSelected(!getDevice().meta().getBoolean("disabled",false)); + disableButton.setSelected(!getDevice().meta().getBoolean("disabled", false)); disableButton.selectedProperty().addListener((ObservableValue observable, Boolean oldValue, Boolean newValue) -> { getDevice().getConfig().setValue("disabled", !newValue); - if(!newValue){ + if (!newValue) { valueLabel.setText("---"); } }); @@ -131,7 +131,7 @@ public class VacuumeterView extends DeviceViewController implements MeasurementL String resString = FORMAT.format(result); Platform.runLater(() -> { valueLabel.setText(resString); - setStatus("OK: " + TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneId.systemDefault()))); + setStatus("OK: " + TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneOffset.UTC))); }); }