Exemple #1
0
 public CalibrationWizard(int bal = 1)
 {
     InitializeComponent();
     instance = this;
     balancer = bal;
 }
Exemple #2
0
        public void GotDataFromCTC(object sender, string data)
        {
            int i;

            if (calibrationFormShown)
            {
                if (data.Contains("<BAL1>") || data.Contains("<BAL2>"))
                {
                    if (CalibrationWizard.GetInstance() != null)
                    {
                        this.Invoke(new MethodInvoker(delegate()
                        {
                            CalibrationWizard.GetInstance().processMessage(data);
                        }));
                    }
                }
            }

            if ((i = data.IndexOf("<BAL1> Weight: ")) != -1)
            {
                this.Invoke(new MethodInvoker(delegate()
                {
                    lblBalancer1Weight.Text = data.Substring(i + 15);
                }));
            }
            else if ((i = data.IndexOf("<BAL2> Weight: ")) != -1)
            {
                this.Invoke(new MethodInvoker(delegate()
                {
                    lblBalancer2Weight.Text = data.Substring(i + 15);
                }));
            }
            else if ((i = data.IndexOf("QEI1: ")) != -1)
            {
                this.Invoke(new MethodInvoker(delegate()
                {
                    lblEncoder1Position.Text = data.Substring(i + 6, 6);
                    if ((i = data.IndexOf("QEI2: ")) != -1)
                    {
                        lblEncoder2Position.Text = data.Substring(i + 6, 6);
                    }
                }));
            }
            else if ((i = data.IndexOf("ADC0: ")) != -1)
            {
                this.Invoke(new MethodInvoker(delegate()
                {
                    lblADC0Value.Text = data.Substring(i + 6, 4);
                    if ((i = data.IndexOf("ADC1: ")) != -1)
                    {
                        lblADC1Value.Text = data.Substring(i + 6, 4);
                    }
                    if ((i = data.IndexOf("ADC2: ")) != -1)
                    {
                        lblADC2Value.Text = data.Substring(i + 6, 4);
                    }
                }));
            }
            else
            {
                if ((i = data.IndexOf("<Sens8,Sens9> are active!")) != -1)
                {
                    mbClient.SendMessage(Instructions.MB_LOCK_EL_SENS + "1");
                }
                else if ((i = data.IndexOf("<Sens8,Sens9> not active!")) != -1)
                {
                    mbClient.SendMessage(Instructions.MB_LOCK_EL_SENS + "0");
                }
                msg("RX: <" + (sender as Client).cip + "> " + data);
            }
        }