Ejemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (m_conected)
            {
                m_tic.reset_command_timeout();
                m_tic.get_variables();
                m_tic.get_status_variables();
                labelPosition.Text = m_tic.vars.current_position.ToString();


                string status = "";

                foreach (var prop in m_tic.status_vars.GetType().GetProperties())
                {
                    status = status + string.Format("{0}={1}\n\r", prop.Name, prop.GetValue(m_tic.status_vars, null));
                }

                string vars = "";


                foreach (var prop in m_tic.vars.GetType().GetProperties())
                {
                    vars = vars + string.Format("{0}={1}\n\r", prop.Name, prop.GetValue(m_tic.vars, null));
                }

                labelStatus.Text = status;
                labelVars.Text   = vars;
                if (m_moving && m_tic.in_position())
                {
                    m_moving                 = false;
                    buttonGoto.Text          = "GOTO";
                    buttonHome.Enabled       = !m_moving;
                    checkBoxJogLeft.Enabled  = !m_moving;
                    checkBoxJogRigth.Enabled = !m_moving;
                }
                if (m_homing && m_tic.in_home())
                {
                    m_homing                 = false;
                    buttonHome.Text          = "HOME";
                    buttonGoto.Enabled       = !m_homing;
                    checkBoxJogLeft.Enabled  = !m_homing;
                    checkBoxJogRigth.Enabled = !m_homing;
                }

                if (m_decelerating && m_tic.vars.current_velocity == 0)
                {
                    m_decelerating     = false;
                    buttonGoto.Enabled = true;
                    buttonHome.Enabled = true;
                }
            }
        }