public boolean calibrateFrontCamera() { boolean res = false; if (connection.isConnected()) { if ((getStatus() & Status.CALIBRATION_ARM_D_DOWN.getValue()) > 0) { boolean r1 = setMode(Mode.CALIBRATE_DIAMETER.getValue()); boolean r2 = false; // sleep 0.5 sec try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } if ((getStatus() & Status.EXPOSITION_SENSOR_TRIGGERED.getValue()) == 0) { r2 = true; // if the sensor was not triggered, then it's OK } res = r1 && r2; } } return res; }
public boolean calibrationStartWait() { if (connection.isConnected()) { for (int i = 0; i < PlcConstants.LONG_ITERATIONS; i++) { try { Thread.sleep(PlcConstants.LONG_SLEEP_TIME); } catch (InterruptedException e) { e.printStackTrace(); } boolean topCalibArmDown = (getStatus() & Status.CALIBRATION_ARM_L_DOWN.getValue()) > 0; boolean frontCalibArmDown = (getStatus() & Status.CALIBRATION_ARM_D_DOWN.getValue()) > 0; if (topCalibArmDown && frontCalibArmDown) { return true; } } } return false; }