public Form1() { InitializeComponent(); InitTimers(); accel = new Accelerometer(serialPort1); sensor = new Lightsensor(serialPort1); linArduino = new LinearArduino(serialPort1, 9, 16, 10.5); rotArduino = new RotatieArduino(serialPort1, 8); foreach (Control item in this.Controls) { if (item is GroupBox) { item.Enabled = false; } } //currentScan = new Scan(linArduino, rotArduino, sensor, 10, 10, 6.0); }
public Scan(LinearArduino linArduino, RotatieArduino rotArduino, Lightsensor sensor, int numSamplesPerLine, int numLinesPerScan, double scanDistance) { InitTimers(); toTheLeftToTheLeft = true; ScanDone = false; homed = false; this.linArduino = linArduino; this.rotArduino = rotArduino; this.sensor = sensor; this.numSamplesPerLine = numSamplesPerLine; this.numLinesPerScan = numLinesPerScan; this.scanDistance = scanDistance; scanData = new List <int>(); sinogram = new Bitmap(numLinesPerScan, numSamplesPerLine); intergrationDelay = 1 * 1000; lightDelay = 10 * 1000; linStepDelay = 30; stepsPerRot = (32000 / (2 * numLinesPerScan)); rotTime = ((500 + 20) * stepsPerRot); stepsPerSweep = Convert.ToInt32(200 * 16 * (scanDistance / 0.8)); int[] timings = new int[7] { 0, 240980, 480940, 720884, 960832, 1200792, 1440736 }; sweepTime = timings[Convert.ToInt32(scanDistance)]; //; // 3cm = 960832; //Convert.ToInt32(stepsPerSweep * (linStepDelay + 23.14336967 + (0.006068607 * linStepDelay))); lightDelay = Convert.ToInt32(sweepTime / numSamplesPerLine); Console.WriteLine("stepsPerRot: " + stepsPerRot + " rotTime: " + rotTime + " StepsPerSweep: " + stepsPerSweep + " sweepTime: " + sweepTime); Console.WriteLine("lightDelay: " + lightDelay + " total scannertime = " + lightDelay * numSamplesPerLine); }