private void CheckMeasuredDistance(int distance) { if (detectorMode == DetectorMode.Waiting) { if (distance < DetectedDistance) { detectorMode = DetectorMode.Detecting; detectionTime = DateTime.Now; lowestDistance = distance; arduinoPort.BaseStream.WriteByte(3); } } else if (detectorMode == DetectorMode.Detecting) { if (distance < lowestDistance) { lowestDistance = distance; } TimeSpan dt = DateTime.Now - detectionTime; if (dt.TotalMilliseconds > 1000) { //Console.WriteLine("{0}", lowestDistance); Action <string> AddLine = AddToListBox; listBox1.Invoke(AddLine, new object[] { lowestDistance.ToString() }); if (lowestDistance >= distanceGrantLow && lowestDistance <= distanceGrantHigh) { arduinoPort.BaseStream.WriteByte(1); soundControls.PlayGranted(); } else { arduinoPort.BaseStream.WriteByte(2); soundControls.PlayDenied(); } //Console.WriteLine("-----"); detectorMode = DetectorMode.Pause; } } else { TimeSpan dt = DateTime.Now - detectionTime; if (dt.TotalMilliseconds > 4000) { arduinoPort.BaseStream.WriteByte(0); detectorMode = DetectorMode.Waiting; } } }
public static string ToShortName(this DetectorMode detectorMode, DetectorType detectorType) { switch (detectorType) { case DetectorType.STEM3_GMode: switch (detectorMode) { case DetectorMode.Custom: return("Custom 1"); case DetectorMode.Custom2: return("Custom 2"); case DetectorMode.Custom3: return("Custom"); case DetectorMode.Custom4: return("Custom 3"); case DetectorMode.Custom5: return("Custom 4"); default: return(GetDefaultShortName(detectorMode)); } case DetectorType.CBS: switch (detectorMode) { case DetectorMode.Custom: return("Custom 1"); case DetectorMode.Custom2: return("Custom 2"); default: return(GetDefaultLongName(detectorMode)); } default: return(GetDefaultShortName(detectorMode)); } }
public virtual void SetDetectorMode(int TraceNumber, DetectorMode ModeOfDetector) { }
private static string GetDefaultLongName(DetectorMode detectorMode) { switch (detectorMode) { case DetectorMode.SecondaryElectrons: return "Secondary Electrons"; case DetectorMode.BackscatterElectrons: return "Backscatter Electrons"; case DetectorMode.Custom: return "Custom"; case DetectorMode.Custom2: return "Custom 2"; case DetectorMode.Custom3: return "Custom 3"; case DetectorMode.Custom4: return "Custom 4"; case DetectorMode.Custom5: return "Custom 5"; case DetectorMode.DownHoleVisibility: return "Down-hole visibility"; case DetectorMode.ChargeNeutralization: return "Charge Neutralization"; case DetectorMode.SecondaryIons: return "Secondary Ions"; case DetectorMode.SegmentA: return "Segment A"; case DetectorMode.SegmentB: return "Segment B"; case DetectorMode.ZContrast: return "Z Contrast"; case DetectorMode.Topography: return "Topography"; case DetectorMode.AplusB: return "A + B"; case DetectorMode.AminusB: return "A - B"; case DetectorMode.BrightField: return "Bright Field"; case DetectorMode.DarkField: return "Dark Field"; case DetectorMode.DarkField1: return "Dark Field 1"; case DetectorMode.DarkField2: return "Dark Field 2"; case DetectorMode.DarkField3: return "Dark Field 3"; case DetectorMode.DarkField4: return "Dark Field 4"; case DetectorMode.Angular: return "HAADF"; case DetectorMode.AngularPartial: return "HADF Partial"; case DetectorMode.AngularPartialComplement: return "HADF Partial Complement"; case DetectorMode.Mix: return "Mix"; case DetectorMode.BeamDeceleration: return "Deceleration Mode"; case DetectorMode.LowAngle: return "Inner"; case DetectorMode.HighAngle: return "Outer"; case DetectorMode.AnularA: return "A"; case DetectorMode.AnularB: return "B"; case DetectorMode.AnularC: return "C"; case DetectorMode.AnularD: return "D"; case DetectorMode.All: return "All"; case DetectorMode.Scintillation: return "Scintillation"; default: return "$ERROR$"; } }
private static string GetDefaultShortName(this DetectorMode detectorMode) { string shortName; switch (detectorMode) { case DetectorMode.SecondaryElectrons: shortName = "SE"; break; case DetectorMode.BackscatterElectrons: shortName = "BSE"; break; case DetectorMode.Custom: shortName = "Custom"; break; case DetectorMode.Custom2: shortName = "Custom"; break; case DetectorMode.Custom3: shortName = "Custom"; break; case DetectorMode.Custom4: shortName = "Custom"; break; case DetectorMode.Custom5: shortName = "Custom"; break; case DetectorMode.DownHoleVisibility: shortName = "DHV"; break; case DetectorMode.ChargeNeutralization: shortName = "CN"; break; case DetectorMode.SecondaryIons: shortName = "SI"; break; case DetectorMode.SegmentA: shortName = "A"; break; case DetectorMode.SegmentB: shortName = "B"; break; case DetectorMode.ZContrast: shortName = "Z Contrast"; break; case DetectorMode.Topography: shortName = "Topography"; break; case DetectorMode.AplusB: shortName = "A+B"; break; case DetectorMode.AminusB: shortName = "A-B"; break; case DetectorMode.BrightField: shortName = "Bright Field"; break; case DetectorMode.DarkField: shortName = "Dark Field"; break; case DetectorMode.DarkField1: shortName = "Dark Field 1"; break; case DetectorMode.DarkField2: shortName = "Dark Field 2"; break; case DetectorMode.DarkField3: shortName = "Dark Field 3"; break; case DetectorMode.DarkField4: shortName = "Dark Field 4"; break; case DetectorMode.Angular: shortName = "HAADF"; break; case DetectorMode.AngularPartial: shortName = "HADF-P"; break; case DetectorMode.AngularPartialComplement: shortName = "HADF-PC"; break; case DetectorMode.Mix: shortName = "Mix"; break; case DetectorMode.BeamDeceleration: shortName = "Dec. Mode"; break; case DetectorMode.LowAngle: shortName = "Inner"; break; case DetectorMode.HighAngle: shortName = "Outer"; break; case DetectorMode.AnularA: shortName = "A"; break; case DetectorMode.AnularB: shortName = "B"; break; case DetectorMode.AnularC: shortName = "C"; break; case DetectorMode.AnularD: shortName = "D"; break; case DetectorMode.All: shortName = "All"; break; case DetectorMode.Scintillation: shortName = "Scint"; break; case DetectorMode.None: shortName = "None"; break; default: shortName = "$ERROR$"; break; } return(shortName); }
private static string GetDefaultLongName(DetectorMode detectorMode) { switch (detectorMode) { case DetectorMode.SecondaryElectrons: return("Secondary Electrons"); case DetectorMode.BackscatterElectrons: return("Backscatter Electrons"); case DetectorMode.Custom: return("Custom"); case DetectorMode.Custom2: return("Custom 2"); case DetectorMode.Custom3: return("Custom 3"); case DetectorMode.Custom4: return("Custom 4"); case DetectorMode.Custom5: return("Custom 5"); case DetectorMode.DownHoleVisibility: return("Down-hole visibility"); case DetectorMode.ChargeNeutralization: return("Charge Neutralization"); case DetectorMode.SecondaryIons: return("Secondary Ions"); case DetectorMode.SegmentA: return("Segment A"); case DetectorMode.SegmentB: return("Segment B"); case DetectorMode.ZContrast: return("Z Contrast"); case DetectorMode.Topography: return("Topography"); case DetectorMode.AplusB: return("A + B"); case DetectorMode.AminusB: return("A - B"); case DetectorMode.BrightField: return("Bright Field"); case DetectorMode.DarkField: return("Dark Field"); case DetectorMode.DarkField1: return("Dark Field 1"); case DetectorMode.DarkField2: return("Dark Field 2"); case DetectorMode.DarkField3: return("Dark Field 3"); case DetectorMode.DarkField4: return("Dark Field 4"); case DetectorMode.Angular: return("HAADF"); case DetectorMode.AngularPartial: return("HADF Partial"); case DetectorMode.AngularPartialComplement: return("HADF Partial Complement"); case DetectorMode.Mix: return("Mix"); case DetectorMode.BeamDeceleration: return("Deceleration Mode"); case DetectorMode.LowAngle: return("Inner"); case DetectorMode.HighAngle: return("Outer"); case DetectorMode.AnularA: return("A"); case DetectorMode.AnularB: return("B"); case DetectorMode.AnularC: return("C"); case DetectorMode.AnularD: return("D"); case DetectorMode.All: return("All"); case DetectorMode.Scintillation: return("Scintillation"); default: return("$ERROR$"); } }