Puck detetion mode - during loading only

This commit is contained in:
gac-S_Changer
2025-08-08 13:17:25 +02:00
parent 249e9e3855
commit 9b4179478b
2 changed files with 44 additions and 15 deletions
+26 -9
View File
@@ -62,7 +62,7 @@ public class Controller {
static /*Panel*/ MainPanel mainFrame;
Device barcode_reader;
Device barcode_reader_puck;
Device puck_detection;
PuckDetection puck_detection;
JDialog dialogAskPuckDatamatrix;
String currentMountedSample;
PuckLoadingDialog dialogPuckLoading;
@@ -140,7 +140,7 @@ public class Controller {
puckState = new PuckState[NUMBER_OF_PUCKS];
for (int i = 0; i < NUMBER_OF_PUCKS; i++) {
puckState[i] = new PuckState(i + 1);
}
}
}
private Controller(Panel mainFrame) {
@@ -149,8 +149,7 @@ public class Controller {
clearPuckStates();
basePlate.addListener(basePlateListener);
roomTemperatureBasePlate = new RoomTemperatureBasePlate();
roomTemperatureBasePlate = new RoomTemperatureBasePlate();
}
final DeviceListener basePlateListener = new DeviceListener() {
@@ -242,12 +241,11 @@ public class Controller {
@Override
public void onDeviceRemoved(GenericDevice dev) {
}
});
});
updateDevices();
updatePuckTypes();
clearSamplesTable();
refreshSamplesTable();
refreshSamplesTable();
}
public Sample getMountedSample() throws Exception{
@@ -354,12 +352,13 @@ public class Controller {
} else {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, "No barcode_reader_puck detected.");
}
puck_detection = (Device) getDevice("puck_detection");
puck_detection = (PuckDetection) getDevice("puck_detection");
if (puck_detection != null) {
puck_detection.addListener(puckDetectionListener);
} else {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, "No puck_detection detected.");
}
checkEnablePuckDetection();
}
PuckState[] puckState;
@@ -960,6 +959,18 @@ public class Controller {
}
}
public void checkEnablePuckDetection(){
try{
if ("loading".equals(Context.getSetting("puck_detection"))){
boolean loading = (dialogPuckLoading != null) && (dialogPuckLoading.isShowing());
puck_detection.setEnabled(loading);
}
} catch (Exception ex) {
Logger.getLogger(Controller.class.getName()).log(Level.WARNING, null, ex);
}
}
void showDialogPuckLoading(boolean load) {
if ((dialogPuckLoading != null) && (dialogPuckLoading.isVisible())) {
@@ -968,6 +979,7 @@ public class Controller {
dialogPuckLoading = new PuckLoadingDialog(mainFrame.getTopLevel(), load, false);
dialogPuckLoading.setLocationRelativeTo(mainFrame);
dialogPuckLoading.setVisible(true);
checkEnablePuckDetection();
dialogPuckLoading.addWindowListener(new WindowAdapter() {
@Override
@@ -976,8 +988,13 @@ public class Controller {
setPuckLoading(null);
} catch (Exception ex) {
Logger.getLogger(Controller.class.getName()).log(Level.WARNING, null, ex);
}
}
}
@Override
public void windowClosed(WindowEvent e) {
checkEnablePuckDetection();
}
});
}