This commit is contained in:
2018-04-23 09:17:09 +02:00
parent 9d0b2d41fa
commit ce84673d52

View File

@@ -5,8 +5,11 @@
package ch.psi.mxsc;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceListener;
import ch.psi.pshell.imaging.Source;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
@@ -30,6 +33,24 @@ public class MainPanel extends Panel {
Controller.getInstance().onInitialize(runCount);
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
basePlatePanel.getDevice().setSelectable(false);
((Device) getDevice("dewar_level")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateLevel(value);
}
});
updateLevel(((Device) getDevice("dewar_level")).take());
}
void updateLevel(Object value){
if ((value == null) || !(value instanceof Number)){
progressLN2.setIndeterminate(true);
} else {
progressLN2.setIndeterminate(false);
double val = ((Number)value).doubleValue() * 10.0;
val = Math.min(Math.max((int)(val *10), 0), 1000);
progressLN2.setValue(Math.min(Math.max((int)val, 0), 1000));
}
}