예제 #1
0
        private ResumeJobForm(int exec, int sent, int target, DetectedIssue issue, bool allowHoming, bool suggestHoming, bool allowWCO, bool suggestWCO, GPoint wcopos)
        {
            InitializeComponent();
            mAllowH             = allowHoming;
            mSuggestH           = suggestHoming;
            mSomeLine           = Math.Max(0, exec - 17) + 1;
            mExec               = exec + 1;
            mSent               = sent + 1;
            LblSomeLines.Text   = mSomeLine.ToString();
            LblSent.Text        = mSent.ToString();
            UdSpecific.Maximum  = mSent;
            UdSpecific.Value    = mSent;
            RbSomeLines.Enabled = LblSomeLines.Enabled = mSomeLine > 1;
            RbFromSent.Enabled  = true; LblSent.Enabled = sent < target;

            TxtCause.Text = issue.ToString();

            if (/*issue == GrblCore.DetectedIssue.StopMoving ||*/ issue == DetectedIssue.StopResponding || issue == DetectedIssue.UnexpectedReset || issue == DetectedIssue.ManualReset)
            {
                //all this causes indicate a situation where grbl does not execute the content of buffers (both planned and rx)
                //so restart from some line (17 lines) before the last command in planned buffer

                if (RbSomeLines.Enabled)
                {
                    RbSomeLines.Checked = true;
                }
                else
                {
                    RbFromBeginning.Checked = true;
                }
            }
            else if (issue == DetectedIssue.ManualDisconnect || issue == DetectedIssue.UnexpectedDisconnect)
            {
                //if issue is a disconnect all sent lines could be already executed
                //so restart from sent
                if (RbFromSent.Enabled)
                {
                    RbFromSent.Checked = true;
                }
                else
                {
                    RbFromSpecific.Checked = true;
                }
            }
            else if (issue == DetectedIssue.ManualAbort)
            {
                RbFromBeginning.Checked = true;
            }

            CbRedoHoming.Visible = allowHoming;
            CbRedoHoming.Checked = allowHoming && suggestHoming;
            CbRestoreWCO.Visible = allowWCO;
            CbRestoreWCO.Checked = allowWCO && suggestWCO;
            CbRestoreWCO.Text    = String.Format("{0} X{1} Y{2}", CbRestoreWCO.Text, wcopos.X, wcopos.Y);
            if (wcopos.Z != 0)
            {
                CbRestoreWCO.Text += String.Format(" Z{0}", wcopos.Z);
            }
        }
예제 #2
0
        internal static int CreateAndShowDialog(int exec, int sent, int target, DetectedIssue issue, bool allowHoming, bool suggestHoming, out bool homing, bool allowWCO, bool suggestWCO, out bool wco, GPoint wcopos)
        {
            ResumeJobForm f = new ResumeJobForm(exec, sent, target, issue, allowHoming, suggestHoming, allowWCO, suggestWCO, wcopos);

            int rv = f.ShowDialog() == DialogResult.OK ? f.Position : -1;

            homing = f.DoHoming;
            wco    = f.RestoreWCO;
            f.Dispose();

            return(rv);
        }