Ejemplo n.º 1
0
 private void SetStreamingHandler(StreamingHandler handler)
 {
     if (handler == StreamingHandler.Previous)
     {
         streamingHandler = streamingHandlers[(int)StreamingHandler.Previous];
     }
     else if (streamingHandler.Handler != handler)
     {
         if (handler == StreamingHandler.Idle)
         {
             streamingHandler = streamingHandlers[(int)StreamingHandler.Previous] = streamingHandlers[(int)StreamingHandler.Idle];
         }
         else
         {
             streamingHandlers[(int)StreamingHandler.Previous] = streamingHandler;
             streamingHandler = streamingHandlers[(int)handler];
         }
     }
 }
Ejemplo n.º 2
0
        public JobControl()
        {
            InitializeComponent();

            DataContextChanged += JobControl_DataContextChanged;

            grblState.State    = GrblStates.Unknown;
            grblState.Substate = 0;
            grblState.MPG      = false;

            job.PgmEndLine = -1;

            streamingHandlers[(int)StreamingHandler.Idle].Call  = StreamingIdle;
            streamingHandlers[(int)StreamingHandler.Idle].Count = false;

            streamingHandlers[(int)StreamingHandler.SendFile].Call  = StreamingSendFile;
            streamingHandlers[(int)StreamingHandler.SendFile].Count = true;

            streamingHandlers[(int)StreamingHandler.ToolChange].Call  = StreamingToolChange;
            streamingHandlers[(int)StreamingHandler.ToolChange].Count = false;

            streamingHandlers[(int)StreamingHandler.FeedHold].Call  = StreamingFeedHold;
            streamingHandlers[(int)StreamingHandler.FeedHold].Count = true;

            streamingHandlers[(int)StreamingHandler.AwaitAction].Call  = StreamingAwaitAction;
            streamingHandlers[(int)StreamingHandler.AwaitAction].Count = true;

            streamingHandlers[(int)StreamingHandler.AwaitIdle].Call  = StreamingAwaitIdle;
            streamingHandlers[(int)StreamingHandler.AwaitIdle].Count = false;

            streamingHandler = streamingHandlers[(int)StreamingHandler.Previous] = streamingHandlers[(int)StreamingHandler.Idle];

            for (int i = 0; i < streamingHandlers.Length; i++)
            {
                streamingHandlers[i].Handler = (StreamingHandler)i;
            }

            poller  = new PollGrbl();
            polling = new Thread(new ThreadStart(poller.Run));
            polling.Start();
            Thread.Sleep(100);
        }
Ejemplo n.º 3
0
 private void SetStreamingHandler(StreamingHandler handler)
 {
     if (handler == StreamingHandler.Previous)
     {
         streamingHandler = streamingHandlers[(int)StreamingHandler.Previous];
     }
     else if (streamingHandler.Handler != handler)
     {
         if (handler == StreamingHandler.Idle)
         {
             streamingHandler = streamingHandlers[(int)StreamingHandler.Previous] = streamingHandlers[(int)StreamingHandler.Idle];
         }
         else
         {
             streamingHandlers[(int)StreamingHandler.Previous] = streamingHandler;
             streamingHandler = streamingHandlers[(int)handler];
             if (handler == StreamingHandler.AwaitAction)
             {
                 streamingHandler.Count = true;
             }
         }
     }
 }