public TestOptionsClass EditToData() { TestOptionsClass to = new TestOptionsClass(); to.manualTreshold = ckFixTreshold.Checked; double mt = StaticFunctionsClass.ToDoubleDef(txtManualTreshold.Text, -1); if (mt <= 0) { ckFixTreshold.Checked = false; txtManualTreshold.Text = "1.0"; to.treshold = 1.0; } else { txtManualTreshold.Text = mt.ToString(); to.treshold = mt; } to.minBoardNr = (int)nmMinBoard.Value; to.maxBoardNr = (int)nmMaxBoard.Value; to.signalA = ckSignalA.Checked; to.signalB = ckSignalB.Checked; return(to); }
private bool doTest(int board, GT668Class.GtiSignal signal, GT900USBClass GT668, TestOptionsClass testOpt) { double posv = 0.0; double negv = 0.0; Console.WriteLine(""); GT668.ClearError(); nf.AddToINFO($@"", InfoLine); nf.AddToINFO($@"Testing board {board} for signal {signal}", InfoLine); GT668.Select(board); GT668.MeasureAmplitude(signal, ref posv, ref negv, 1000.0); if (posv - negv >= 0.5) { double thr_val = (posv + negv) / 2.0; nf.AddToINFO($@"Signal found on board {board} for signal {EnumHelper.GetDescription(signal)} setting threshold {Math.Round(thr_val,3)} V", InfoLine); GT668.SetReferenceClock(GT668Class.GtiRefClkSrc.GT_REF_INTERNAL, false, false); GT668.SetBlockArm(GT668Class.GtiBlkArmSrc.GT_BA_IMM, GT668Class.GtiPolarity.GT_POL_POS, false); GT668.SetArmAuxOut(GT668Class.GtiArmAuxOut.GT_AUX_OUT_OFF); GT668.SetMemoryWrapMode(true); GT668.SetT0Mode(false, true); GT668.SetInputImpendance(signal, GT668Class.GtiImpedance.GT_IMP_LO); GT668.SetInputCoupling(signal, GT668Class.GtiCoupling.GT_CPL_DC); if (testOpt.manualTreshold) { GT668.SetInputThreshold(signal, GT668Class.GtiThrMode.GT_THR_VOLTS, testOpt.treshold); } else { GT668.SetInputThreshold(signal, GT668Class.GtiThrMode.GT_THR_VOLTS, thr_val); } GT668.SetInputPrescale(signal, GT668Class.GtiPrescale.GT_DIV_16); GT668.SetMeasSkip(0, 624U); switch (signal) { case GT668Class.GtiSignal.GT_SIG_A: GT668.SetMeasInput(0, GT668Class.GtiInputSel.GT_CHA_POS); break; case GT668Class.GtiSignal.GT_SIG_B: GT668.SetMeasInput(0, GT668Class.GtiInputSel.GT_CHB_POS); break; } GT668.SetMeasEnable(0, true); GT668.SetMeasEnable(1, false); GT668.StartMeasurements(); Thread.Sleep(100); uint num2 = 0; ref uint local2 = ref num2; double num3 = 0.0; ref double local3 = ref num3;