示例#1
0
            public TimeSpan AnalyzeCommand(GrblCommand cmd, bool compute, GrblConf conf = null)
            {
                bool delete = !cmd.JustBuilt;

                if (!cmd.JustBuilt)
                {
                    cmd.BuildHelper();
                }

                UpdateModalsNB(cmd);

                mCurX.Update(cmd.X, ABS);
                mCurY.Update(cmd.Y, ABS);

                mCurF.Update(cmd.F);
                mCurS.Update(cmd.S);

                TimeSpan rv = compute ? ComputeExecutionTime(cmd, conf) : TimeSpan.Zero;

                if (delete)
                {
                    cmd.DeleteHelper();
                }

                return(rv);
            }
示例#2
0
        public List <GrblConf.GrblConfParam> GetChanges()
        {
            List <GrblConf.GrblConfParam> rv = new List <GrblConf.GrblConfParam>();
            GrblConf conf = Core.Configuration;

            foreach (GrblConf.GrblConfParam p in mLocalCopy)
            {
                if (conf.HasChanges(p))
                {
                    rv.Add(p);
                }
            }
            return(rv);
        }
        public Grblv11Emulator(SendMessage sendFunc)
        {
            SPB       = new GrblCommand.StatePositionBuilder();
            RX        = new Tools.ThreadObject(ManageRX, 0, true, "Emulator RX", null);
            TX        = new Tools.ThreadObject(ManageTX, 0, true, "Emulator TX", null);
            mSendFunc = sendFunc;

            conf = (GrblConf)Tools.Serializer.ObjFromFile(filename);
            if (conf == null)
            {
                conf = new GrblConf(new GrblCore.GrblVersionInfo(1, 1, '#'), new Dictionary <int, decimal> {
                    { 0, 10 }, { 1, 25 }, { 2, 0 }, { 3, 0 }, { 4, 0 }, { 5, 0 }, { 6, 0 }, { 10, 1 }, { 11, 0.010m }, { 12, 0.002m }, { 13, 0 }, { 20, 0 }, { 21, 0 }, { 22, 0 }, { 23, 0 }, { 24, 25.000m }, { 25, 500.000m }, { 26, 250 }, { 27, 1.000m }, { 30, 1000.0m }, { 31, 0.0m }, { 32, 0 }, { 100, 250.000m }, { 101, 250.000m }, { 102, 250.000m }, { 110, 500.000m }, { 111, 500.000m }, { 112, 500.000m }, { 120, 10.000m }, { 121, 10.000m }, { 122, 10.000m }, { 130, 200.000m }, { 131, 200.000m }, { 132, 200.000m }
                });
            }
        }
示例#4
0
 private TimeSpan ComputeExecutionTime(GrblCommand cmd, GrblConf conf)
 {
     if (G0 && cmd.IsLinearMovement)
     {
         return(TimeSpan.FromMinutes((double)GetSegmentLenght(cmd) / (double)conf.MaxRateX));                    //todo: use a better computation of xy if different speed
     }
     else if (G1G2G3 && cmd.IsMovement && mCurF.Number != 0)
     {
         return(TimeSpan.FromMinutes((double)GetSegmentLenght(cmd) / (double)Math.Min(mCurF.Number, conf.MaxRateX)));
     }
     else if (cmd.IsPause)
     {
         return(cmd.P != null?TimeSpan.FromSeconds((double)cmd.P.Number) : cmd.S != null?TimeSpan.FromSeconds((double)cmd.S.Number) : TimeSpan.Zero);
     }
     else
     {
         return(TimeSpan.Zero);
     }
 }
示例#5
0
        public bool HasChanges()
        {
            GrblConf conf = Core.Configuration;

            if (conf.Count != mLocalCopy.Count)
            {
                return(true);
            }

            foreach (GrblConf.GrblConfParam p in mLocalCopy)
            {
                if (conf.HasChanges(p))
                {
                    return(true);
                }
            }

            return(false);
        }
            public TimeSpan AnalyzeCommand(GrblCommand cmd, bool compute, GrblConf conf = null)
            {
                bool delete = !cmd.JustBuilt;

                if (!cmd.JustBuilt)
                {
                    cmd.BuildHelper();
                }

                UpdateModalsNB(cmd);
                UpdateWCO(cmd);
                UpdateXYZ(cmd);
                UpdateFS(cmd);

                TimeSpan rv = compute ? ComputeExecutionTime(cmd, conf) : TimeSpan.Zero;

                if (delete)
                {
                    cmd.DeleteHelper();
                }

                return(rv);
            }
示例#7
0
        private void Analyze()         //analyze the file and build global range and timing for each command
        {
            GrblCommand.StatePositionBuilder spb = new GrblCommand.StatePositionBuilder();

            mRange.ResetRange();
            mRange.UpdateXYRange("X0", "Y0", false);
            mEstimatedTotalTime = TimeSpan.Zero;

            foreach (GrblCommand cmd in list)
            {
                try
                {
                    GrblConf conf  = SettingsManager.Shared.GrblConf;
                    TimeSpan delay = spb.AnalyzeCommand(cmd, true, conf);

                    mRange.UpdateSRange(spb.S);
                    mRange.UpdateXYRange(spb.X, spb.Y, spb.LaserBurning);
                    mEstimatedTotalTime += delay;
                    cmd.SetOffset(mEstimatedTotalTime);
                }
                catch (Exception ex) { throw ex; }
                finally { cmd.DeleteHelper(); }
            }
        }
示例#8
0
 private bool IsSetConf(string p)
 {
     return(GrblConf.IsSetConf(p));
 }