Fix panel update if invalid values

This commit is contained in:
gac-iss
2021-10-26 10:46:35 +02:00
parent e364032902
commit 98f9bfd929
3 changed files with 81 additions and 58 deletions

View File

@@ -1,5 +1,6 @@
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceBase.DeviceInvalidParameterException;
import ch.psi.pshell.device.DeviceListener;
@@ -166,6 +167,7 @@ public final class ScientaPanel extends DevicePanel {
Scienta.AcquisitionMode acquisitionMode;
Scienta.EnergyMode energyMode;
Scienta.DetectorMode detectorMode;
Integer pass;
double low;
double center;
double high;
@@ -173,8 +175,7 @@ public final class ScientaPanel extends DevicePanel {
//int frames;
double time;
double size;
int slices;
int pass;
int slices;
int iterations;
int current;
@@ -188,13 +189,35 @@ public final class ScientaPanel extends DevicePanel {
dd.spectrum = getDevice().getSpectrum().getValue();
dd.lensMode = getDevice().getLensMode();
dd.elementSet = getDevice().getElementSet();
try{
dd.lensMode = getDevice().getLensMode();
} catch (DeviceInvalidParameterException ex){
dd.lensMode = null;
}
try{
dd.elementSet = getDevice().getElementSet();
} catch (DeviceInvalidParameterException ex){
dd.elementSet = null;
} try{
dd.acquisitionMode = getDevice().getAcquisitionMode();
dd.energyMode = getDevice().getEnergyMode();
dd.detectorMode = getDevice().getDetectorMode();
dd.pass = getDevice().getPassEnergy();
} catch (DeviceInvalidParameterException ex){
dd.acquisitionMode = null;
}
try{
dd.energyMode = getDevice().getEnergyMode();
} catch (DeviceInvalidParameterException ex){
dd.energyMode = null;
}
try{
dd.detectorMode = getDevice().getDetectorMode();
} catch (DeviceInvalidParameterException ex){
dd.detectorMode = null;
}
try{
dd.pass = getDevice().getPassEnergy();
} catch (DeviceInvalidParameterException ex){
dd.pass = null;
}
dd.low = getDevice().getLowEnergy().getValue();
dd.center = getDevice().getCenterEnergy().getValue();
dd.high = getDevice().getHighEnergy().getValue();