Beispiel #1
0
        private void About_Load(object sender, System.EventArgs e)
        {
            GrblInfo.Get();
            txtGrblVersion.Content = GrblInfo.Version;
            txtGrblOptions.Content = GrblInfo.Options;
            txtGrblNewOpts.Content = GrblInfo.NewOptions;
            grpGrbl.Header         = GrblSettings.IsGrblHAL ? "grblHAL" : "grbl";

            if (GrblInfo.Identity != "")
            {
                grpGrbl.Header += ": " + GrblInfo.Identity;
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            System.Threading.Thread.Sleep(50);
            Comms.com.PurgeQueue();

            using (new UIUtils.WaitCursor())
            {
                GrblInfo.Get();
                GrblSettings.Get();
            }

            configView.Activate(true, ViewType.Startup);
        }
Beispiel #3
0
        public UserUI()
        {
            string PortParams = "";

            InitializeComponent();

            try
            {
                XmlDocument config = new XmlDocument();

                config.Load(Application.StartupPath + "\\App.config");

                foreach (XmlNode N in config.SelectNodes("Config/*"))
                {
                    switch (N.Name)
                    {
                    case "PortParams":
                        PortParams = N.InnerText;
                        break;
                    }
                }
            }
            catch
            {
                MessageBox.Show("Config file not found or invalid.", this.Text);
                System.Environment.Exit(1);
            }

#if DEBUG
            PortParams = "com29:115200,N,8,1,P";
#endif

            new SerialComms(PortParams, Comms.ResetMode.None);

            if (!Comms.com.IsOpen)
            {
                this.com = null;
                MessageBox.Show("Unable to open serial port!", this.Text);
                System.Environment.Exit(2);
            }

            GrblLanguage.language = "en_US";

            GrblInfo.Get();
            GrblSettings.Load();

            this.Text += ", Grbl version " + GrblInfo.Version;
        }
Beispiel #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            System.Threading.Thread.Sleep(50);
            Comms.com.PurgeQueue();

            using (new UIUtils.WaitCursor())
            {
                GrblInfo.Get();
                GrblSettings.Load();
            }

            halsettings.IsEnabled = grblsettings.IsEnabled = GrblInfo.IsGrblHAL && GrblInfo.Build >= 20210819;
            grblalarms.IsEnabled  = grblerrors.IsEnabled = GrblInfo.IsGrblHAL && GrblInfo.Build >= 20210823;

            configView.Activate(true, ViewType.Startup);
        }
Beispiel #5
0
        private void About_Load(object sender, System.EventArgs e)
        {
            Title = version;
            if (CNC.Core.Resources.IsLegacyController)
            {
                Title += " (legacy mode)";
            }

            GrblInfo.Get();
            txtGrblVersion.Content    = GrblInfo.Version;
            txtGrblOptions.Content    = GrblInfo.Options;
            txtGrblNewOpts.Content    = GrblInfo.NewOptions;
            txtGrblConnection.Content = AppConfig.Settings.Base.PortParams;
            grpGrbl.Header            = GrblInfo.Firmware;

            if (GrblInfo.Identity != "")
            {
                grpGrbl.Header += ": " + GrblInfo.Identity;
            }
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        private void InitSystem()
        {
            initOK = true;

            // TODO: check if grbl is in a state that allows replies
            using (new UIUtils.WaitCursor())
            {
                GCodeSender.EnablePolling(false);
                GrblInfo.Get();
                GrblSettings.Get();
                GrblParserState.Get();
                GrblWorkParameters.Get();
                GCodeSender.EnablePolling(true);
            }

            model.Message = "";

            GrblCommand.ToolChange = GrblInfo.ManualToolChange ? "M61Q{0}" : "T{0}";

            GCodeSender.Config(MainWindow.UIViewModel.Profile.Config);

            if (GrblInfo.NumAxes > 3)
            {
                limitsControl.Visibility = Visibility.Collapsed;
            }

            if (GrblInfo.LatheModeEnabled)
            {
                MainWindow.EnableView(true, ViewType.Turning);
                MainWindow.EnableView(true, ViewType.Facing);
                MainWindow.EnableView(true, ViewType.G76Threading);
            }
            else
            {
                MainWindow.ShowView(false, ViewType.Turning);
                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);
            }

            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);
            }

            MainWindow.GCodePush += GCode.File.AddBlock;
        }
Beispiel #8
0
        private void InitSystem()
        {
            initOK = true;

            // TODO: check if grbl is in a state that allows replies
            using (new UIUtils.WaitCursor())
            {
                GCodeSender.EnablePolling(false);
                GrblInfo.Get();
                GrblSettings.Get();
                GrblParserState.Get();
                GrblWorkParameters.Get();
                GCodeSender.EnablePolling(true);
            }

            model.Message = string.Empty;

            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.Facing);
                MainWindow.EnableView(true, ViewType.G76Threading);
            }
            else
            {
                MainWindow.ShowView(false, ViewType.Turning);
                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);
            }

            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);
            }
        }
        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);
            }
        }
        private void InitSystem()
        {
            initOK = true;

            // TODO: check if grbl is in a state that allows replies
            using (new UIUtils.WaitCursor())
            {
                GCodeSender.EnablePolling(false);
                GrblInfo.Get();
                GrblSettings.Get();
                GrblParserState.Get();
                GrblWorkParameters.Get();
                GCodeSender.EnablePolling(true);
            }

            workParametersControl.ToolChangeCommand = GrblInfo.ManualToolChange ? "T{0}M6" : "T{0}";

            GCodeSender.Config();

            if (GrblInfo.LatheModeEnabled)
            {
                DRO.EnableLatheMode();
                signalsControl.SetLatheMode();
                MainWindow.EnableView(true, ViewType.Turning);
                MainWindow.EnableView(true, ViewType.Facing);
                MainWindow.EnableView(true, ViewType.G76Threading);
            }
            else
            {
                DRO.SetNumAxes(GrblInfo.NumAxes);
                signalsControl.SetNumAxes(GrblInfo.NumAxes);
                MainWindow.ShowView(false, ViewType.Turning);
                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);
            }

            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);
            }

            MainWindow.GCodePush += UserUI_GCodePush;

            txtStatus.Text = "";
        }