Source:
private void handleStatusString(final String string) { if (this.capabilities == null) { return; } ControlState before = getControlState(); String beforeState = controllerStatus == null ? "" : controllerStatus.getState(); controllerStatus = GrblUtils.getStatusFromStatusString( controllerStatus, string, capabilities, getReportingUnits()); if (before != getControlState()) { this.dispatchStateChange(getControlState()); } if (StringUtils.equals(beforeState, "Jog") && controllerStatus.getState().equals("Idle")) { this.comm.cancelSend(); } if (isCanceling) { if (attemptsRemaining > 0 && lastLocation != null) { attemptsRemaining--; if (this.controllerStatus.getState().equals("Idle")) { isCanceling = false; } else if ((this.controllerStatus.getState().equals("Hold") || this.controllerStatus.getState().equals("Queue")) && lastLocation.equals(this.controllerStatus.getMachineCoord())) { try { this.issueSoftReset(); } catch(Exception e) { this.errorMessageForConsole(e.getMessage() + "\n"); } isCanceling = false; } if (isCanceling && attemptsRemaining == 0) { this.errorMessageForConsole(Localization.getString("grbl.exception.cancelReset") + "\n"); } } lastLocation = new Position(this.controllerStatus.getMachineCoord()); } if (this.controllerStatus != null && this.getUnitsCode() != null && this.controllerStatus.getMachineCoord() != null) { Units u = this.getUnitsCode().toUpperCase().equals("G21") ? Units.MM : Units.INCH; double zLocationMM = this.controllerStatus.getMachineCoord().z; if (u == Units.INCH) zLocationMM *= 26.4; if (zLocationMM > this.maxZLocationMM) { maxZLocationMM = zLocationMM; } dispatchStatusString(controllerStatus); } }

Target:
private void handleStatusString(final String string) { if (this.capabilities == null) { return; } ControlState before = getControlState(); String beforeState = controllerStatus == null ? "" : controllerStatus.getState(); controllerStatus = GrblUtils.getStatusFromStatusString( controllerStatus, string, capabilities, getReportingUnits()); if (before != getControlState()) { this.dispatchStateChange(getControlState()); } if (StringUtils.equals(beforeState, "Jog") && controllerStatus.getState().equals("Idle")) { this.comm.cancelSend(); } if (isCanceling) { if (attemptsRemaining > 0 && lastLocation != null) { attemptsRemaining--; if (this.controllerStatus.getState().equals("Idle")) { isCanceling = false; } else if ((this.controllerStatus.getState().equals("Hold") || this.controllerStatus.getState().equals("Queue")) && lastLocation.equals(this.controllerStatus.getMachineCoord())) { try { this.issueSoftReset(); } catch(Exception e) { this.errorMessageForConsole(e.getMessage() + "\n"); } isCanceling = false; } if (isCanceling && attemptsRemaining == 0) { this.errorMessageForConsole(Localization.getString("grbl.exception.cancelReset") + "\n"); } } lastLocation = new Position(this.controllerStatus.getMachineCoord()); } if (this.controllerStatus != null && this.getUnitsCode() != null && this.controllerStatus.getMachineCoord() != null) { Units u = this.getUnitsCode().toUpperCase().equals("G21") ? Units.MM : Units.INCH; double zLocationMM = this.controllerStatus.getMachineCoord().z; if (u == Units.INCH) zLocationMM *= 26.4; if (zLocationMM > this.maxZLocationMM) { maxZLocationMM = zLocationMM; } } dispatchStatusString(controllerStatus); }