Exemple #1
0
 public override string ToString()
 {
     return(string.Format("Flags:{0}, HCursor:{1}, Point:{2}", flags, hCursor, ptScreenPos.ToString()));
 }
Exemple #2
0
        public static async Task <bool> SetPT100(MODE mode, POINT point)
        {
            var result1  = false;
            var result2  = false;
            var strData1 = "";
            var strData2 = "";

            var mess = "";
            var max  = 0.0;
            var min  = 0.0;

            var cmd1 = "";
            var cmd2 = "";

            State.VmTestStatus.TestLog += $" {mode.ToString()} {point.ToString()}調整";

            //ローカル関数の定義■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
            string GetData(string command)
            {
                General.ClearCommlog();
                Target.SendData(command);

                while (true)//取り込んだ通信データが規定行数(サンプリング数)になるまで待つ
                {
                    if (Flags.ClickStopButton)
                    {
                        return(null);
                    }
                    if (General.CountNewline() == 2)
                    {
                        break;
                    }
                }
                Target.Escape();
                Sleep(1000);
                var log        = State.VmComm.RX;
                int FoundIndex = log.IndexOf(command + ",");
                int 改行位置       = log.IndexOf("\r\n", FoundIndex);
                var 取り出し1行     = log.Substring(FoundIndex, 改行位置 - FoundIndex);
                var dataList   = 取り出し1行.Split(',');

                return(dataList[2].Substring(1));//一文字目がスペースなので削除
            };
            //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

            try
            {
                await Task.Delay(500);

                if (!await CheckComm())
                {
                    return(false);
                }

                switch (point)
                {
                case POINT.FIRST:
                    max  = State.TestSpec.PV第一Max;
                    min  = State.TestSpec.PV第一Min;
                    mess = "ダイヤル抵抗器を108.96オームに設定してください";
                    cmd1 = mode == MODE.PV12 ? "PV11" : "PV31";
                    cmd2 = mode == MODE.PV12 ? "PV21" : "PV41";
                    General.PlaySound(General.sound108_96);
                    break;

                case POINT.SECOND:
                    max  = State.TestSpec.PV第二Max;
                    min  = State.TestSpec.PV第二Min;
                    mess = "ダイヤル抵抗器を149.83オームに設定してください";
                    cmd1 = mode == MODE.PV12 ? "PV12" : "PV32";
                    cmd2 = mode == MODE.PV12 ? "PV22" : "PV42";
                    General.PlaySound(General.sound149_83);
                    break;

                case POINT.THIRD:
                    max  = State.TestSpec.PV第三Max;
                    min  = State.TestSpec.PV第三Min;
                    mess = "ダイヤル抵抗器を183.19オームに設定してください";
                    cmd1 = mode == MODE.PV12 ? "PV13" : "PV33";
                    cmd2 = mode == MODE.PV12 ? "PV23" : "PV43";
                    General.PlaySound(General.sound183_19);
                    break;
                }

                var dialog = new DialogPic(mess, DialogPic.NAME.その他, soundSw: false);
                dialog.ShowDialog();
                await Task.Delay(4000);

                await Task.Run(() =>
                {
                    strData1 = GetData(cmd1);
                    strData2 = GetData(cmd2);
                });

                if (strData1 == null || strData2 == null)
                {
                    return(false);
                }

                //第一調整点の調整値が適正な範囲内にあるかチェック
                int Data1 = Convert.ToInt32(strData1, 16);
                int Data2 = Convert.ToInt32(strData2, 16);

                result1 = min < Data1 && Data1 < max;
                result2 = min < Data2 && Data2 < max;

                return(result1 && result2);
            }
            catch
            {
                return(false);
            }
            finally
            {
                State.VmTestStatus.TestLog += result1 && result2? "---PASS\r\n" :"---FAIL\r\n";
                General.PowerSupply(false);

                if (mode == MODE.PV12)
                {
                    switch (point)
                    {
                    case POINT.FIRST:
                        VmTestResults.PV1_1    = strData1 + "h";
                        VmTestResults.PV2_1    = strData2 + "h";
                        VmTestResults.ColPV1_1 = result1 ? OffBrush : NgBrush;
                        VmTestResults.ColPV2_1 = result2 ? OffBrush : NgBrush;
                        break;

                    case POINT.SECOND:
                        VmTestResults.PV1_2    = strData1 + "h";
                        VmTestResults.PV2_2    = strData2 + "h";
                        VmTestResults.ColPV1_2 = result1 ? OffBrush : NgBrush;
                        VmTestResults.ColPV2_2 = result2 ? OffBrush : NgBrush;
                        break;

                    case POINT.THIRD:
                        VmTestResults.PV1_3    = strData1 + "h";
                        VmTestResults.PV2_3    = strData2 + "h";
                        VmTestResults.ColPV1_3 = result1 ? OffBrush : NgBrush;
                        VmTestResults.ColPV2_3 = result2 ? OffBrush : NgBrush;
                        break;
                    }
                }
                else
                {
                    switch (point)
                    {
                    case POINT.FIRST:
                        VmTestResults.PV3_1    = strData1 + "h";
                        VmTestResults.PV4_1    = strData2 + "h";
                        VmTestResults.ColPV3_1 = result1 ? OffBrush : NgBrush;
                        VmTestResults.ColPV4_1 = result2 ? OffBrush : NgBrush;
                        break;

                    case POINT.SECOND:
                        VmTestResults.PV3_2    = strData1 + "h";
                        VmTestResults.PV4_2    = strData2 + "h";
                        VmTestResults.ColPV3_2 = result1 ? OffBrush : NgBrush;
                        VmTestResults.ColPV4_2 = result2 ? OffBrush : NgBrush;
                        break;

                    case POINT.THIRD:
                        VmTestResults.PV3_3    = strData1 + "h";
                        VmTestResults.PV4_3    = strData2 + "h";
                        VmTestResults.ColPV3_3 = result1 ? OffBrush : NgBrush;
                        VmTestResults.ColPV4_3 = result2 ? OffBrush : NgBrush;
                        break;
                    }
                }
            }
        }