Ejemplo n.º 1
0
      public void startTask()
      {
          killTask         = false;
          stepper.ackSteps = 0;

          stepper.targetSteps = (int)(stepper.stepSize / (decimal)Config.getConfig().tickSize);
          int stepSpeed = (int)(1000 / (stepper.targetSteps / (stepper.stepSize / stepper.stepSpeed)));

          stepper.calculatePosition(0);

          Thread.Sleep(stepper.stepDelay);

          MoveRequest r         = new MoveRequest(stepper, direction);
          int         sentSteps = 0;
          int         i         = 0;

          while (!killTask && sentSteps < stepper.targetSteps)
          {
              Thread.Sleep(stepSpeed);
              controller.sendRequest(r);
              sentSteps++;
              if ((i++) % loadFactor == 0)
              {
                  stepper.calculatePosition(sentSteps);
              }
          }
          while (!killTask && stepper.ackSteps < stepper.targetSteps)
          {
              stepper.calculatePosition(sentSteps);
          }

          stepper.calculatePosition(sentSteps);
          stepper.originalPosition = stepper.position;
      }
Ejemplo n.º 2
0
 public void sendRequest(MoveRequest r)
 {
     while (isBusy)
     {
         ;
     }
     isBusy = true;
     sendPacket(r.ToPacket());
 }
Ejemplo n.º 3
0
 public RequestGui(Request request)
 {
     InitializeComponent();
     if (request.GetType() == typeof(MoveRequest))
     {
         MoveRequest r = (MoveRequest)request;
         lblMotor.Text      = r.stepper.id.ToString() + "," + r.direction;
         this.Width         = 10 + (int)r.stepper.stepSize;
         r.RequestSent     += R_RequestSent;
         r.RequestFinished += R_RequestFinished;
     }
 }
Ejemplo n.º 4
0
        public void moveOut()
        {
            this.direction = Direction.Out;

            MoveRequest r = new MoveRequest(this, direction);

            gui.setQueued();
            this.targetSteps = 1;
            this.ackSteps    = 0;
            gui.setProcessing(true);
            controller.sendRequest(r);
            while (this.ackSteps < this.targetSteps)
            {
                ;
            }
            calculatePosition(1);
            this.originalPosition = this.position;
            gui.setProcessing(false);
        }