This commit is contained in:
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
@@ -42,24 +43,32 @@ public class Recovery extends Panel {
|
||||
|
||||
@Override
|
||||
protected void onTimer() {
|
||||
try{
|
||||
List segment = (List) eval("get_current_segment()", true);
|
||||
ledValidSegment.setColor((segment == null) ? Color.RED : Color.GREEN);
|
||||
textSegment.setText((segment == null) ? "": segment.get(0) + "->" + segment.get(1) + " [" + segment.get(2) + "mm]");
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex);
|
||||
Device robot = getContext().getDevicePool().getByName("robot", Device.class);
|
||||
if (!robot.getState().isNormal()){
|
||||
ledValidSegment.setColor(Color.BLACK);
|
||||
textSegment.setText("");
|
||||
}
|
||||
try{
|
||||
String point = (String) eval("robot.get_current_point()", true);
|
||||
ledKnownPosition.setColor((point == null) ? Color.RED : Color.GREEN);
|
||||
textPosition.setText((point == null) ? "": point);
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex);
|
||||
textSegment.setText("");
|
||||
ledKnownPosition.setColor(Color.BLACK);
|
||||
textPosition.setText("");
|
||||
}
|
||||
} else {
|
||||
try{
|
||||
List segment = (List) eval("get_current_segment()", true);
|
||||
ledValidSegment.setColor((segment == null) ? Color.RED : Color.GREEN);
|
||||
textSegment.setText((segment == null) ? "": segment.get(0) + "->" + segment.get(1) + " [" + segment.get(2) + "mm]");
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex);
|
||||
ledValidSegment.setColor(Color.BLACK);
|
||||
textSegment.setText("");
|
||||
}
|
||||
try{
|
||||
String point = (String) eval("robot.get_current_point()", true);
|
||||
ledKnownPosition.setColor((point == null) ? Color.RED : Color.GREEN);
|
||||
textPosition.setText((point == null) ? "": point);
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex);
|
||||
ledKnownPosition.setColor(Color.BLACK);
|
||||
textPosition.setText("");
|
||||
}
|
||||
}
|
||||
updateButton();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user