示例#1
0
        public LogicAxisUnitManager()
        {
            foreach (var mem in ConfigManager.Instance.HardWareConfigrationMuster.LogicAxisUnitConfigs)
            {
                if (!mem.Enable)
                {
                    continue;
                }

                if (m_LogicAxisUnits.ContainsKey(mem.DeviceName))
                {
                    //show error info in this place
                    continue;
                }
                LogicAxisUnit logicAxisUnit = new LogicAxisUnit(mem.DeviceName, mem.Guid);

                foreach (var logicAxisConfig in mem.LogicAxisConfigs)
                {
                    foreach (var axis in AxisManager.Instance.AxisDeviceS)
                    {
                        if (logicAxisConfig.BindDeviceGuid == axis.Value.Guid)
                        {
                            LogicAxis logicAxis = new LogicAxis(logicAxisConfig.DeviceName, logicAxisConfig.Guid, (StepMotor)axis.Value, logicAxisConfig.IsHome, logicAxisConfig.HomeIndex);
                            logicAxisUnit.AddLogicAxis(logicAxis.DeviceName, logicAxis);
                            break;
                        }
                    }
                }
                if (logicAxisUnit.AxisDeviceS.Count > 0)
                {
                    m_LogicAxisUnits.Add(logicAxisUnit.DeviceName, logicAxisUnit);
                }
            }
        }
示例#2
0
 public void AddLogicAxis(string key, LogicAxis value)
 {
     if (logicAxisS.ContainsKey(key))
     {
         throw new Exception($"the keyname {key} is already exist");
     }
     logicAxisS.Add(key, value);
 }