Пример #1
0
        protected override int ResetLoop()
        {
            //load cfg
            CfgSettings = Machine.Ins.Settings;

            //clear vio
            VioTransInp.SetVio(this, false);
            VioBarcodeFinish.SetVio(this, false);
            VioTransFinish.SetVio(this, false);
            VioMeasureFinish.SetVio(this, false);

            //load axis pos
            Platform.AssertPosTeached("Wait", this);
            Platform.AssertPosTeached("GtWork1", this);
            Platform.AssertPosTeached("GtWork2", this);
            Platform.AssertPosTeached($"Barcode{Project.TypeId}", this);

            PosGtWork1 = Platform["GtWork1"] as PosXYZ;
            PosGtWork2 = Platform["GtWork2"] as PosXYZ;


            if (!DoGTCylinder.SetDo(this, false, ignoreOrWaringOrError: true))
            {
                ThrowException($"GT Cylinder Reset Fail!");
            }

            //connect gt controller and barcode controller
            try
            {
                if (BarcodeController.IsOpen)
                {
                    BarcodeController.Close();
                }

                BarcodeController.Open(BarcodeCOM);
            }
            catch (Exception e)
            {
                ThrowException($"Barcode Open Fail:{e.Message}");
            }

            //home platform
            Platform.EnterAuto(this).Servo();
            Platform.EnterAuto(this).Home(new[] { 1, 1, 0 }, -1);
            Platform.EnterAuto(this).MoveAbs("Wait", checkLimit: false);

            //move gt cylinder push pos
            if (!DoGTCylinder.SetDo(this, true, ignoreOrWaringOrError: true))
            {
                //show alarm
                ThrowException($"GT Cylinder Set Fail!");
            }

            return(0);
        }