Пример #1
0
        void statusBar1_StartStopClick(object sender, EventArgs e)
        {
            if (task.bRunning)
            {
                statusBar1.pause  = false;
                statusBar1.status = RUN_STATE.STOPPING;
                task.Stop();
                try
                {
                    rxDisplay1.LogComplete();
                }
                catch
                {
                }
            }
            else
            {
                RsInfo rs = Program.lst_rsinfo[Program.mainwnd.selectedRs];
                RxInfo rx = Program.lst_rxinfo[Program.mainwnd.selectedRx];
                statusBar1.total  = syscfg.iMeasTimes;
                statusBar1.count  = 1;
                statusBar1.status = RUN_STATE.INITIALIZING;

                task.Start();
                rxDisplay1.ClearAll();
                rxDisplay2.ClearAll();
                rxDisplay3.ClearAll();
                rxDisplay4.ClearAll();
            }
        }
Пример #2
0
        public void pc_cmd(string cmd)
        {
            SysConfig syscfg = Program.sysinfo;

            if (cmd == "S")
            {
                task.Stop();//STOP; need reply //todo
                return;
            }
            if (cmd == "H")
            {
//                DeviceMgr.Reset();//reset
                return;
            }
            Match m;

            m = reg_mode.Match(cmd);
            if (m.Success)
            {
                oper_mode = m.Groups[1].Value;
                return;
            }
            m = reg_statistic.Match(cmd);
            if (m.Success)
            {
                syscfg.iFilter = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_filter.Match(cmd);
            if (m.Success)
            {
                if (m.Groups[1].Value == "2")
                {
                    syscfg.sFilterType = "filtertype3";
                }
                else if (m.Groups[1].Value == "1")
                {
                    syscfg.sFilterType = "filtertype2";
                }
                else
                {
                    syscfg.sFilterType = "filtertype1";
                }
                return;
            }
            m = reg_ix.Match(cmd);
            if (m.Success)
            {/*
              * //todo
              * if (currRx.iIx == 0) //1mA
              * if (currRx.iIx == 1) //10mA
              * if (currRx.iIx == 2) //0.1A
              * if (currRx.iIx == 3) //0.3A
              * if (currRx.iIx == 4) //1A
              * if (currRx.iIx == 5) //5A
              */
                double myIx = double.Parse(m.Groups[1].Value) / 1000;
                if (myIx >= 3)
                {
                    Program.lst_rxinfo[0].iIx = 5;
                }
                else if (myIx >= 0.65)
                {
                    Program.lst_rxinfo[0].iIx = 4;
                }
                else if (myIx >= 0.2)
                {
                    Program.lst_rxinfo[0].iIx = 3;
                }
                else if (myIx >= 0.05)
                {
                    Program.lst_rxinfo[0].iIx = 2;
                }
                else if (myIx >= 0.005)
                {
                    Program.lst_rxinfo[0].iIx = 1;
                }
                else if (myIx >= 0.0005)
                {
                    Program.lst_rxinfo[0].iIx = 0;
                }
                else
                {
                    Program.lst_rxinfo[0].iIx = -1;
                }
                return;
            }
            m = reg_delay.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasDelay = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_meastimes.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasTimes = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_sampletimes.Match(cmd);
            if (m.Success)
            {
                syscfg.iSampleTimes = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_measure.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasTimes = Convert.ToInt32(m.Groups[1].Value);
                Program.mainwnd.Invoke(new Action <object, EventArgs>(this.statusBar1_StartStopClick), new object[] { 0, 0 });
                //task.Start();
                return;
            }
            m = reg_rsa.Match(cmd);
            if (m.Success) //A mode
            {
                Program.lst_rsinfo[0].dValue   = Convert.ToDouble(m.Groups[1].Value);
                Program.lst_rxinfo[0].cStdChan = 'A';
                DeviceMgr.ReportHeader(syscfg.iMeasTimes);
                for (int i = 0; i < syscfg.iMeasTimes; i++)
                {
                    DeviceMgr.ReportData(i + 1, 10.01234566);
                    Thread.Sleep(1000);
                }
                return;
            }
            m = reg_rsb.Match(cmd);
            if (m.Success) //B mode
            {
                Program.lst_rsinfo[0].dValue   = Convert.ToDouble(m.Groups[1].Value);
                Program.lst_rxinfo[0].cStdChan = 'B';
                return;
            }
        }