Esempio n. 1
0
 /// <summary>
 /// Process Grbl parameter string
 /// </summary>
 /// <param name="parameterStr"></param>
 private void ProcessParameter(string parameterStr)
 {
     parameterStr = parameterStr.Substring(1);
     string[] flds = parameterStr.Split('=');
     SetParameter(flds[0].Trim(), flds[1].Trim());
     if (GrblParameterBase.IsLastParameter(flds[0]))
     {
         GrblResponseEventArgs args = new GrblResponseEventArgs()
         {
             EventType = "ParameterUpdate"
         };
         OnResponseReceived(args);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Check any grbl state change, position, status and etc
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        private bool AnythingChanged(GrblResponseEventArgs args)
        {
            if (args.Response.StartsWith("Grbl"))
            {
                string s1 = "1";
                return(true);
            }

            bool result =
                args.MPos != oldPosition || args.Feed != oldFeedRate || args.Speed != oldSpindleRPM || args.State != oldState || args.WCO != oldWCO;

            if (args.MPos != null)
            {
                oldPosition = args.MPos;
            }
            if (args.WCO != null)
            {
                oldWCO = args.WCO;
            }
            if (args.Feed != null)
            {
                oldFeedRate = args.Feed;
            }
            if (args.Speed != null)
            {
                oldSpindleRPM = args.Feed;
            }
            if (args.State != null)
            {
                oldState = args.State;
            }
            IsConnected = true;


            return(result);
        }