예제 #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 Add(string key, LogicAxisUnit value)
 {
     if (m_LogicAxisUnits.ContainsKey(key))
     {
         throw new Exception($"the keyname {key} is already exist");
     }
     m_LogicAxisUnits.Add(key, value);
 }