Пример #1
0
        private void _appServiceConnection_RequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
        {
            if (args.Request.Message.ContainsKey("STATUS"))
            {
                var msg = args.Request.Message["STATUS"];
                Debug.WriteLine("STATUS: " + msg);
            }

            if (args.Request.Message.ContainsKey("DONE"))
            {
                var axis = Convert.ToInt32(args.Request.Message["DONE"]);
                Debug.WriteLine($"FINISHED {axis}");
                switch (axis)
                {
                case 0: XAxis.Completed(); break;

                case 1: YAxis.Completed(); break;

                case 2: CAxis.Completed(); break;

                case 3: PlaceAxis.Completed(); break;

                case 4: SolderAxis.Completed(); break;
                }
            }
        }
Пример #2
0
        public void HandleCommand(GCodeCommand cmd)
        {
            _curent = cmd;
            var movement = cmd as GCodeLine;

            if (movement != null)
            {
                _motorPower.Enable();
                XAxis.Move(movement.End.X, Convert.ToDouble(movement.Feed));
                YAxis.Move(movement.End.Y, Convert.ToDouble(movement.Feed));
                switch (_currentTool)
                {
                case Tools.CAxis: CAxis.Move(movement.End.Z, Convert.ToDouble(movement.Feed)); break;

                case Tools.PasteHead: SolderAxis.Move(movement.End.Z, Convert.ToDouble(movement.Feed)); break;

                case Tools.PlaceHead: PlaceAxis.Move(movement.End.Z, Convert.ToDouble(movement.Feed)); break;
                }
            }

            var machine = cmd as MCode;

            if (machine != null)
            {
                switch (machine.Code)
                {
                case 60: if (machine.Power == 0)
                    {
                        _topLight.Off();
                    }
                    else
                    {
                        _topLight.On();
                    } break;

                case 61: if (machine.Power == 0)
                    {
                        _bottomLight.Off();
                    }
                    else
                    {
                        _bottomLight.On();
                    } break;

                case 62: if (machine.Power == 0)
                    {
                        _vacuum.Off();
                    }
                    else
                    {
                        _vacuum.On();
                    } break;
                }
            }
        }