bool InitSystem() { initOK = true; int timeout = 5; using (new UIUtils.WaitCursor()) { GCodeSender.EnablePolling(false); while (!GrblInfo.Get()) { if (--timeout == 0) { model.Message = (string)FindResource("MsgNoResponse"); return(false); } Thread.Sleep(500); } GrblAlarms.Get(); GrblErrors.Get(); GrblSettings.Load(); if (GrblInfo.IsGrblHAL) { GrblParserState.Get(); GrblWorkParameters.Get(); } else { GrblParserState.Get(true); } GCodeSender.EnablePolling(true); } GrblCommand.ToolChange = GrblInfo.ManualToolChange ? "M61Q{0}" : "T{0}"; showProgramLimits(); if (!AppConfig.Settings.GCodeViewer.IsEnabled) { tabGCode.Items.Remove(tab3D); } if (GrblInfo.NumAxes > 3) { limitsControl.Visibility = Visibility.Collapsed; } if (GrblInfo.LatheModeEnabled) { MainWindow.EnableView(true, ViewType.Turning); // MainWindow.EnableView(true, ViewType.Parting); // MainWindow.EnableView(true, ViewType.Facing); MainWindow.EnableView(true, ViewType.G76Threading); } else { MainWindow.ShowView(false, ViewType.Turning); MainWindow.ShowView(false, ViewType.Parting); MainWindow.ShowView(false, ViewType.Facing); MainWindow.ShowView(false, ViewType.G76Threading); } if (GrblInfo.HasSDCard) { MainWindow.EnableView(true, ViewType.SDCard); } else { MainWindow.ShowView(false, ViewType.SDCard); } if (GrblInfo.HasPIDLog) { MainWindow.EnableView(true, ViewType.PIDTuner); } else { MainWindow.ShowView(false, ViewType.PIDTuner); } if (GrblInfo.NumTools > 0) { MainWindow.EnableView(true, ViewType.Tools); } else { MainWindow.ShowView(false, ViewType.Tools); } if (GrblInfo.HasProbe && GrblSettings.ReportProbeCoordinates) { MainWindow.EnableView(true, ViewType.Probing); } MainWindow.EnableView(true, ViewType.Offsets); MainWindow.EnableView(true, ViewType.GRBLConfig); if (!string.IsNullOrEmpty(GrblInfo.TrinamicDrivers)) { MainWindow.EnableView(true, ViewType.TrinamicTuner); } else { MainWindow.ShowView(false, ViewType.TrinamicTuner); } return(true); }
private void InitSystem() { initOK = true; int timeout = 5; using (new UIUtils.WaitCursor()) { GCodeSender.EnablePolling(false); while (!GrblInfo.Get()) { if (--timeout == 0) { model.Message = "Controller is not responding!"; initOK = false; } Thread.Sleep(500); } GrblAlarms.Get(); GrblErrors.Get(); GrblSettings.Get(); GrblParserState.Get(); GrblWorkParameters.Get(); GCodeSender.EnablePolling(true); } GrblCommand.ToolChange = GrblInfo.ManualToolChange ? "M61Q{0}" : "T{0}"; if (keyboard == null) { keyboard = new KeypressHandler(model); GCodeSender.Configure(keyboard); gcodeRenderer.Configure(); } showProgramLimits(); if (!AppConfig.Settings.GCodeViewer.IsEnabled) { tabGCode.Items.Remove(tab3D); } if (GrblInfo.NumAxes > 3) { limitsControl.Visibility = Visibility.Collapsed; } if (GrblInfo.LatheModeEnabled) { MainWindow.EnableView(true, ViewType.Turning); // MainWindow.EnableView(true, ViewType.Parting); // MainWindow.EnableView(true, ViewType.Facing); MainWindow.EnableView(true, ViewType.G76Threading); } else { MainWindow.ShowView(false, ViewType.Turning); MainWindow.ShowView(false, ViewType.Parting); MainWindow.ShowView(false, ViewType.Facing); MainWindow.ShowView(false, ViewType.G76Threading); } if (GrblInfo.HasSDCard) { MainWindow.EnableView(true, ViewType.SDCard); } else { MainWindow.ShowView(false, ViewType.SDCard); } if (GrblInfo.HasPIDLog) { MainWindow.EnableView(true, ViewType.PIDTuner); } else { MainWindow.ShowView(false, ViewType.PIDTuner); } if (GrblInfo.NumTools > 0) { MainWindow.EnableView(true, ViewType.Tools); } else { MainWindow.ShowView(false, ViewType.Tools); } if (GrblInfo.HasProbe && GrblSettings.ReportProbeCoordinates) { MainWindow.EnableView(true, ViewType.Probing); } MainWindow.EnableView(true, ViewType.Offsets); MainWindow.EnableView(true, ViewType.GRBLConfig); if (!string.IsNullOrEmpty(GrblInfo.TrinamicDrivers)) { MainWindow.EnableView(true, ViewType.TrinamicTuner); } else { MainWindow.ShowView(false, ViewType.TrinamicTuner); } }