Example #1
0
 /// <summary>
 /// 初始化引脚,量程,上下限
 /// </summary>
 /// <param name="pinNumber">测量引脚</param>
 /// <param name="range"></param>
 /// <param name="lowerLimit"></param>
 /// <param name="upperLimit"></param>
 public MeasureParameter(int pinNumber, CurrentRange range, decimal lowerLimit, decimal upperLimit)
 {
     PinNumber    = pinNumber;
     CurrentRange = range;
     LowerLimit   = lowerLimit;
     UpperLimit   = upperLimit;
 }
Example #2
0
        /// <summary>
        /// Sets the current range.
        /// </summary>
        /// <param name="currentRange">The current range.</param>
        /// <exception cref="System.NullReferenceException">Not connected to a device</exception>
        /// <exception cref="System.Exception">Device must be in idle mode for manual control</exception>
        public async Task SetCurrentRangeAsync(CurrentRange currentRange)
        {
            if (_comm == null)
            {
                throw new NullReferenceException("Not connected to a device");
            }
            if (await _comm.GetStateAsync() != CommManager.DeviceState.Idle)
            {
                throw new Exception("Device must be in idle mode for manual control");
            }

            await RunAsync(async() =>
            {
                //Need to check again as the task can be scheduled to run at a later point after which this could have changed
                if (_comm == null)
                {
                    throw new NullReferenceException("Not connected to a device");
                }
                if (await _comm.GetStateAsync() != CommManager.DeviceState.Idle)
                {
                    throw new Exception("Device must be in idle mode for manual control");
                }
                await _comm.SetCurrentRangeAsync(currentRange);
            });
        }
        public virtual Dictionary <string, string> GetStatDictionary()
        {
            var result = new Dictionary <string, string>();

            result.Add("Range", CurrentRange.ToString());

            return(result);
        }
Example #4
0
    public void DrawPath()
    {
        Cell destination = null;

        if (CurrentRange.Contains(MouseToCell()))
        {
            if (arrow != null)
            {
                ClearDrawnPath();
            }
            arrow = new List <Cell>();

            destination = MouseToCell();
        }
        else
        {
            return;
        }

        CurrentPath = QPath.FindPath(Fighter, Map.UnitTile(Fighter), destination, Cell.EstimateDistance);

        if (CurrentPath.Length == 1)
        {
            return;
        }

        foreach (Cell c in CurrentPath)
        {
            GameObject a = null;

            if (!ObjectPool.ContainsKey("arrow") || ObjectPool.GetFirstInactiveObject("arrow") == null)
            {
                a = Instantiate(arrowPrefab, new Vector3(c.position.x, c.position.y), Quaternion.identity);
            }
            else
            {
                a = ObjectPool.GetFirstInactiveObject("arrow");
            }

            ArrowDisplay display = a.GetComponent <ArrowDisplay>();

            arrow.Add(display);
            display.layer = arrowLayer;
            Map.Add(display, arrowLayer, true);

            a.GetComponent <SpriteRenderer>().enabled = false;

            a.transform.position = new Vector3(c.position.x, c.position.y);
            a.SetActive(true);

            display.AssignSprite();
            a.GetComponent <SpriteRenderer>().enabled = true;

            ObjectPool.AddToPool("arrow", a);
        }
    }
Example #5
0
        /// <summary>
        /// Sets the current range.
        /// </summary>
        /// <param name="currentRange">The current range.</param>
        /// <exception cref="System.NullReferenceException">Not connected to a device</exception>
        /// <exception cref="System.Exception">Device must be in idle mode for manual control</exception>
        public void SetCurrentRange(CurrentRange currentRange)
        {
            if (_comm == null)
            {
                throw new NullReferenceException("Not connected to a device");
            }
            if (_comm.State != CommManager.DeviceState.Idle)
            {
                throw new Exception("Device must be in idle mode for manual control");
            }

            Run(() => { _comm.CurrentRange = currentRange; });
        }
Example #6
0
        private void ConfigureFastAmperometryMethod()
        {
            CurrentRange range = hw.SupportedRanges.First(x => x.ToString() == Settings.FACurrentRange);

            fastAmpo.Ranging           = new AutoRanging(range, range, range); //ranges are -1=100 pA, 0=1nA, 1=10nA, 2=100nA, 3=1uA ... 7=10mA
            fastAmpo.EquilibrationTime = Settings.EquilibrationTime;
            fastAmpo.EqPotentialFA     = Settings.EquilibrationPotential;
            fastAmpo.Potential         = Settings.Potential;
            fastAmpo.IntervalTime      = Settings.IntervalTime;
            fastAmpo.RunTime           = Settings.RunTime;

            // No Aux Input for Fast Amperometry
            //// Configure Aux/ BiPot Settings
            //Settings.BiPotSettings.ConfigureMethod(fastAmpo, hw);
        }
Example #7
0
        public void SetCurrRange(byte node, CurrentRange range)
        {
            if (_sp == null || !_sp.IsOpen)
            {
                return;
            }

            _lastCurrentRange = range;

            if (range == CurrentRange.Current_100mA)
            {
                WriteRead("#" + node.ToString("X2") + " " + "SET:RNG 0");
            }
            else if (range == CurrentRange.Current_50uA)
            {
                WriteRead("#" + node.ToString("X2") + " " + "SET:RNG 1");
            }
            else
            {
                Trace("State: " + " ArgumentException :" + "50uA vagy 100mA lehet. " + "Current Range");
            }
        }
Example #8
0
    void OnLeftClick()
    {
        if (ActionMenu.Selection == ActionMenu.SelectionState.closed)
        {
            if (Fighter == null)
            {
                Cell cell = MouseToCell();

                Selected  = cell;
                startCell = Selected;

                if (cell != null && cell.unitInTile != null && cell.unitInTile.Unit.alignment == Unit.Alignment.Player && !cell.unitInTile.TurnOver)
                {
                    Fighter = Map.GetCellData(Selected.position).unitInTile;

                    //ClearHighlightedArea();
                    DoHighlights(Fighter, CurrentRange.ToArray(), true, 0.01f);
                }
            }
            else if (Fighter != null && CurrentRange.Contains(MouseToCell()))
            {
                pathApplied  = true;
                Selected     = MouseToCell();
                MovementUsed = Map.AggregateCost(QPath.FindPath(Fighter, startCell, Selected, Cell.EstimateDistance), Fighter.Unit);
            }
        }
        else if (ActionMenu.Selection == ActionMenu.SelectionState.target)
        {
            if (ActionMenu.CanSelect)
            {
                SelectTarget();
            }
            else
            {
                ActionMenu.CanSelect = true;
            }
        }
    }
Example #9
0
 /// <summary>
 /// 直流电流测量,初始化引脚和量程
 /// </summary>
 /// <param name="pinNumber">引脚号</param>
 /// <param name="range">量程</param>
 public MeasureParameter(int pinNumber, CurrentRange range)
 {
     PinNumber    = pinNumber;
     CurrentRange = range;
 }
Example #10
0
    void OnRightClick()
    {
        if (Fighter == null)
        {
            return;
        }

        ClearHighlightedArea();
        Crosshair.transform.position = (Vector2)CellUnderMouse.position;

        if (!pathApplied)
        {
            if (MovementRemaining < Fighter.Unit.stats.movement)
            {
                EndFighterTurn();
            }

            Fighter f = CellUnderMouse.unitInTile;
            if (f != null)
            {
                DoHighlights(f, Map.GetMoveArea(f, true), true, 0.01f);
            }
            else
            {
                ClearHighlightedArea();
            }

            Selected = null;
            Fighter  = null;
            ClearDrawnPath();
            //ClearHighlightedArea();
        }
        else if (pathApplied)
        {
            if (!TradeMenu.IsOpen)
            {
                ActionMenu.Close();
                Crosshair.SetActive(true);
                pathApplied = false;
            }

            ClearDrawnPath();
            ClearHighlightedArea();

            Selected.unitInTile  = null;
            startCell.unitInTile = Fighter;

            if (!ActionMenu.ActionDone)
            {
                Selected = startCell;

                Fighter.transform.position = (Vector2)startCell.position;
            }
            else
            {
                startCell.unitInTile = null;
                startCell            = Map.UnitTile(Fighter);
                startCell.unitInTile = Fighter;
            }

            if (!ActionMenu.IsOpen)
            {
                CurrentRange = GetRange(Fighter);
            }

            if (!TradeMenu.IsOpen)
            {
                DrawPath();
            }
            DoHighlights(Fighter, CurrentRange.ToArray());
        }

        if (ActionMenu.Selection == ActionMenu.SelectionState.target)
        {
            ActionMenu.Selection = ActionMenu.SelectionState.option;
        }
    }
 /// <summary>
 /// Sets the current range.
 /// </summary>
 /// <param name="currentRange">The current range.</param>
 public async Task SetCurrentRange(CurrentRange currentRange)
 {
     await _psCommSimple.SetCurrentRangeAsync(currentRange);
 }