示例#1
0
        public override void Arm(Axis axis, int start, int end)
        {
            if (MyToolType == ToolType.Laser)
            {
                PSO.WindowReset("X", 1, 0);
                if (axis.ControlIdent == "X")
                {
                    PSO.WindowInput("X", 1, 0);
                }
                else if (axis.ControlIdent == "Y")
                {
                    PSO.WindowInput("X", 1, 4);
                }
                else
                {
                    this.Disarm();
                    throw new NotImplementedException("No Arm implemented for Axis " + axis.ControlIdent + ". Only X and Y are valid");
                }

                PSO.WindowRange("X", 1, start, end);
                PSO.OutputWindow("X");
                PSO.WindowLoad("X", 1, 0);
                PSO.Control("X", PsoMode.Arm);
            }
        }
示例#2
0
        private void AllAxes_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (AllAxes.SelectedItem == null)
            {
                return;
            }

            Data.RightVisibility = System.Windows.Visibility.Visible;
            Axis a = HWC.GetAxis(AllAxes.SelectedItem.ToString());
            if (a != null)
            {
                Current = a;
                Data.Name = a.Name;
                Data.Min = Axis.SConvertIntToStr(a.Min);
                Data.Max = Axis.SConvertIntToStr(a.Max);
                Data.MinVelocity = Axis.SConvertIntToStr(a.MinVelocity);
                Data.MaxVelocity = Axis.SConvertIntToStr(a.MaxVelocity);

                Data.PositionSpeed = Axis.SConvertIntToStr(a.PositionSpeed);
                Data.RampRate = a.RampRate.ToString() ;

                Data.RampDistancePercent = a.RampDistancePercent.ToString();
                Data.MinAccelRampTimeMS = a.MinAccelRampTimeMS.ToString();

                Data.StaticRampDistance = Axis.SConvertIntToStr(a.StaticRampDistance);
                Data.UseStaticRampDistance = a.UseStaticRampDistance;
            }
        }
示例#3
0
 /// <summary>
 /// Methode um ein Tool "scharf" zu stellen. 
 /// Wenn sich die Achse(axis) in dem Bereich zwischen *start* und *end* bewegt, soll das Tool aktiv sein.
 /// Funktioniert nur mit einem Laser Tool
 /// </summary>
 /// <param name="axis">Achse auf die gehört werden soll</param>
 /// <param name="start">Anfang des bereichs</param>
 /// <param name="end">Ende des bereichs</param>
 public virtual void Arm(Axis axis, int start, int end)
 {
 }
示例#4
0
 protected void VelocityChange(Axis a, int vel)
 {
     this.Data.VelocityStr = Axis.SConvertIntToStr(vel, true);
 }
示例#5
0
 protected void PositionChange(Axis a, int pos)
 {
     this.Data.AbsPosStr = Axis.SConvertIntToStr(pos, true);
     this.Data.RelPosStr = Axis.SConvertIntToStr(HWC.ConvertCoordinatesAlways(MyAxis.ControlIdent, -pos)*(-1), true);
 }
示例#6
0
 protected void HasFaultChange(Axis a, bool value)
 {
     if (value)
     {
         Data.StatusStr = "Fault";
         Data.StatusColor = Brushes.Red;
         Data.StatusImg = "bullet_red";
     }
     Data.HasFault = value;
 }
示例#7
0
        public void SetAxisAndInitGUI(HardwareController hwc, Axis axis)
        {
            HWC = hwc;
            MyAxis = axis;
            Data.AxisName = MyAxis.ControlIdent;

            EnableChange(axis, axis.IsEnable);
            HasFaultChange(axis, axis.HasFault);

            this.Data.AbsPosStr = Axis.SConvertIntToStr(MyAxis.Position, true);
            this.Data.RelPosStr = Axis.SConvertIntToStr(HWC.ConvertCoordinatesAlways(MyAxis.ControlIdent, -MyAxis.Position) * (-1), true);

            //Verbinde Notifyer
            MyAxis.IsEnableChanged += EnableChange;
            MyAxis.HasFaultChange += HasFaultChange;
            MyAxis.PositionChange += PositionChange;
            MyAxis.VelocityChange += VelocityChange;

            //Load Values
            DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow");
            Speed = ds.Ints[axis.ControlIdent + "-FR-Speed", 0];
            Distance = ds.Ints[axis.ControlIdent + "-FR-Distance", 0];
            UseDistance = ds.Bools[axis.ControlIdent + "-FR-UseDis", false];
            DisplayFreeRunValues();

            FreeRunThread = new TrackedThread("Free Run Distance Thread: "+ MyAxis, this.FreeRunThreadMethod);
            FreeRunQueue = new Queue<Action>();
            FreeRunThread.Start();
        }
 /// <summary>
 /// Erstellt eine neue Achse, speichert diese in AllAxes und gibt diese zurück.
 /// </summary>
 /// <param name="controlident">ControlIdent der neuen Achse</param>
 /// <returns>Die neu erstellte Achse</returns>
 public virtual Axis NewAxis(string controlident)
 {
     controlident = controlident.ToUpper();
     if (AllAxes.Exists(x => x.ControlIdent == controlident))
     {
         throw new Exception("An axis with this controlident allready exitst!");
     }
     Axis a = new Axis(controlident);
     AllAxes.Add(a);
     return a;
 }
示例#9
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Current != null)
            {
                try
                {
                    Current.Min = Axis.SConvertDoubleString(Data.Min);
                    Current.Max = Axis.SConvertDoubleString(Data.Max);

                    Current.MinVelocity = Axis.SConvertDoubleString(Data.MinVelocity);
                    Current.MaxVelocity = Axis.SConvertDoubleString(Data.MaxVelocity);

                    Current.PositionSpeed = Axis.SConvertDoubleString(Data.PositionSpeed);
                    Current.RampRate = int.Parse(Data.RampRate);

                    Current.RampDistancePercent = int.Parse(Data.RampDistancePercent);
                    Current.MinAccelRampTimeMS = int.Parse(Data.MinAccelRampTimeMS);

                    Current.StaticRampDistance = Axis.SConvertDoubleString(Data.StaticRampDistance);
                    Current.UseStaticRampDistance = Data.UseStaticRampDistance;
                }
                catch
                {
                    MessageBox.Show("Error in input data!\nPlease check all fields...");
                    return;
                }
                Current.Save();
                Data.RightVisibility = System.Windows.Visibility.Hidden;
                Current = null;
                AllAxes.UnselectAll();
            }
        }