Exemplo n.º 1
0
        public void RunHome(object HubNum)
        {
            MainModule.FormMain.bHomeReady = false;
            TableManage.TableDriver("运动平台").Home(TableAxisName.Z);
            Thread.Sleep(200);
            while (true)
            {
                if (DateSave.Instance().Production.EStop == true)
                {
                    threadList[0].Abort();
                }
                if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Z))
                {
                    Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "[运动平台],Z轴回原完成");
                    break;
                }
            }
            if (DateSave.Instance().Production.WeldOther == 1)
            {
                TableManage.TableDriver("运动平台").Home(TableAxisName.X);
                TableManage.TableDriver("运动平台").Home(TableAxisName.Y);
                Thread.Sleep(200);
                //  TableManage.TableDriver("运动平台").Home(TableAxisName.Z);
                while (true)
                {
                    if (DateSave.Instance().Production.EStop == true)
                    {
                        threadList[0].Abort();
                    }
                    if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.X) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Y) /*&& TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Z)*/)
                    {
                        Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "[运动平台],XY轴回原完成");
                        break;
                    }
                }
                MainModule.FormMain.bHomeReady = true;
                threadList[0].Abort();
            }
            else
            {
                TableManage.TableDriver("运动平台").Home(TableAxisName.X);
                TableManage.TableDriver("运动平台").Home(TableAxisName.Y);

                TableManage.TableDriver("运动平台").Home(TableAxisName.U);
                while (true)
                {
                    if (DateSave.Instance().Production.EStop == true)
                    {
                        threadList[0].Abort();
                    }
                    if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.X) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Y) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.U))
                    {
                        Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "[运动平台],XY轴回原完成");
                        break;
                    }
                }
                MainModule.FormMain.bHomeReady = true;
                threadList[0].Abort();
            }
        }
Exemplo n.º 2
0
 public static Weld_Log Instance()
 {
     if (jasperLog == null)
     {
         jasperLog = new Weld_Log();
     }
     return(jasperLog);
 }
Exemplo n.º 3
0
        private void Home()
        {
            if (MainModule.FormMain.bAuto)
            {
                Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "请先停止设运行");
                MessageBox.Show("请先停止设运行");
                richTextBox1.AppendText("请先停止自动运行");
                return;
            }
            MainModule.FormMain.bHomeReady = false;
            if (threadList[0] == null)
            {
                //   threadList[0].Abort();
                ParameterizedThreadStart paramLoopFunc1 = new ParameterizedThreadStart(RunHome);
                threadList[0] = new Thread(paramLoopFunc1);
                threadList[0].IsBackground = true;
                threadList[0].Start(0);
            }
            else if (threadList[0] != null && threadList[0].IsAlive == false)
            {
                threadList[0].Abort();
                ParameterizedThreadStart paramLoopFunc1 = new ParameterizedThreadStart(RunHome);
                threadList[0] = new Thread(paramLoopFunc1);
                threadList[0].IsBackground = true;
                threadList[0].Start(0);
            }

            if (DateSave.Instance().Production.EStop == true)
            {
                DateSave.Instance().Production.EStop = false;
            }


            //else
            //{

            //    DateSave.Instance().Production.EStop = false;
            //}
            // DateSave.Instance().Production.EStop = true;
        }
Exemplo n.º 4
0
        Thread ThreadHome        = null; //测试线程
        private void btnHome_Click(object sender, EventArgs e)
        {
            if (MainModule.FormMain.bAuto)
            {
                Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "请先停止运行");
                MessageBox.Show("请先停止设运行");
                richTextBox1.AppendText("请先停止运行");
                return;
            }
            MainModule.FormMain.bHomeReady = false;
            if (threadList[0] == null)
            {
                //   threadList[0].Abort();

                ParameterizedThreadStart paramLoopFunc1 = new ParameterizedThreadStart(RunHome);
                threadList[0] = new Thread(paramLoopFunc1);
                threadList[0].IsBackground = true;
                threadList[0].Start(0);
            }
            else if (threadList[0] != null && threadList[0].IsAlive == false)
            {
                threadList[0].Abort();
                ParameterizedThreadStart paramLoopFunc1 = new ParameterizedThreadStart(RunHome);
                threadList[0] = new Thread(paramLoopFunc1);
                threadList[0].IsBackground = true;
                threadList[0].Start(0);
            }
            //     Homing = new Thread(RunHome);



            //if (HomeDoneXY == false || HomeDoneZ == false)
            //{
            //    StartHome = true;
            //}

            //if (Homing != null && Homing.IsAlive == true)
            //{
            //    return;

            //}
            //else
            //{

            //    Homing.IsBackground = true;
            //    MainModule.FormMain.bHomeReady = false;
            //    Homing.Start();
            //}

            //Task tskExecute = new Task(() =>
            //{
            //    RunHome();
            //    while (true)
            //    {
            //        if (MainModule.FormMain.bHomeReady == true)
            //        {
            //            break;
            //        }
            //    }
            //    return;
            //});
            //tskExecute.Start();
        }