private void MoveToPoint(CatScreenTab.ProbeLocation location, bool bMoveUp = true) { PrinterObject selectedPrinter = spooler_connection.SelectedPrinter; if (selectedPrinter == null || !selectedPrinter.Connected) { return; } var compensationPreprocessor = new BedCompensationPreprocessor(); compensationPreprocessor.UpdateConfigurations(GetCalibrationSettingsFromOptions(selectedPrinter.Info), selectedPrinter.MyPrinterProfile.PrinterSizeConstants); Vector vector; switch (location) { case CatScreenTab.ProbeLocation.Center: vector = compensationPreprocessor.Center; break; case CatScreenTab.ProbeLocation.FrontLeft: vector = compensationPreprocessor.FrontLeft; break; case CatScreenTab.ProbeLocation.FrontRight: vector = compensationPreprocessor.FrontRight; break; case CatScreenTab.ProbeLocation.BackLeft: vector = compensationPreprocessor.BackLeft; break; case CatScreenTab.ProbeLocation.BackRight: vector = compensationPreprocessor.BackRight; break; default: return; } vector.z = 0.1f + compensationPreprocessor.GetHeightAdjustmentRequired(vector.x, vector.y) + compensationPreprocessor.entire_z_height_offset; m_lastProbeLocation = location; var stringList = new List <string> { "M1012", "G90" }; if (bMoveUp) { stringList.Add("G0 Z2"); } stringList.Add(PrinterCompatibleString.Format("G0 X{0} Y{1} F3000", vector.x, vector.y)); stringList.Add(PrinterCompatibleString.Format("G0 Z{0} F100", (object)vector.z)); stringList.Add("M1011"); selectedPrinter.SendCommandAutoLock(false, true, new AsyncCallback(AutoLockCallBack), selectedPrinter, stringList.ToArray()); }
private void OnOffsetChanged(CatScreenTab.ProbeLocation location) { m_bhasUnsavedChanges = true; if (location != m_lastProbeLocation) { return; } MoveToPoint(location, false); }
public void AutoLockCallBack(IAsyncCallResult ar) { var lockErrorMessage = PrinterObject.GetLockErrorMessage(ar); if (string.IsNullOrEmpty(lockErrorMessage)) { return; } m_lastProbeLocation = CatScreenTab.ProbeLocation.Unknown; messagebox.AddMessageToQueue(lockErrorMessage, PopupMessageBox.MessageBoxButtons.OK); }
public override void OnOpen() { m_bhasUnsavedChanges = false; m_lastProbeLocation = CatScreenTab.ProbeLocation.Unknown; }
public override void OnUpdate() { base.OnUpdate(); PrinterObject selectedPrinter = spooler_connection.SelectedPrinter; if (previously_selected_printer != selectedPrinter) { OnPrinterSwitch(selectedPrinter); previously_selected_printer = selectedPrinter; } if (selectedPrinter != null) { MainFrame.Visible = true; if (!selectedPrinter.isBusy && selectedPrinter.Info.Status != PrinterStatus.Firmware_IsWaitingToPause && (selectedPrinter.Info.Status != PrinterStatus.Firmware_PrintingPaused && selectedPrinter.Info.Status != PrinterStatus.Firmware_PrintingPausedProcessing)) { var flag = true; if (selectedPrinter.Info.supportedFeatures.UsesSupportedFeatures) { var featureSlot = selectedPrinter.MyPrinterProfile.SupportedFeaturesConstants.GetFeatureSlot("Multi Point Automatic Bed Calibration"); if (featureSlot >= 0) { flag = (uint)selectedPrinter.Info.supportedFeatures.GetStatus(featureSlot) > 0U; } } if (flag) { if (PrinterBusyFrame.Visible && !m_bhasUnsavedChanges) { GetUpdatedPrinterStats(); } PrinterBusyFrame.Visible = false; Please_Connect_Text.Visible = false; Calibration_Not_Supported.Visible = false; MainFrame.Enabled = true; MainFrame.Visible = true; } else { Calibration_Not_Supported.Visible = true; PrinterBusyFrame.Visible = false; Please_Connect_Text.Visible = false; MainFrame.Enabled = false; MainFrame.Visible = false; } } else { if (selectedPrinter.Info.current_job != null && CatScreenTab.ProbeLocation.Unknown != m_lastProbeLocation) { m_lastProbeLocation = CatScreenTab.ProbeLocation.Unknown; } if (pleasewaittext != null) { pleasewaittext.Text = selectedPrinter.Info.Status != PrinterStatus.Firmware_Calibrating ? "Please wait.\nThe printer is busy perfoming the requested actions." : "Please wait.\nThe printer is calibrating."; } PrinterBusyFrame.Visible = true; Please_Connect_Text.Visible = false; MainFrame.Enabled = false; MainFrame.Visible = false; } } else { MainFrame.Visible = false; PrinterBusyFrame.Visible = false; Please_Connect_Text.Visible = true; } }