Exemplo n.º 1
0
        public static void Main()
        {
            //THIS SECTION CREATES / INITIALIZES THE SERIAL LOGGER
            Debug.Print("Flight computer started successfully. Beginning INIT.");

            var logger = new Logger();

            Debug.Print("Starting logger...");
            logger.Start();


            Rebug.Print("Starting stopwatch");
            Clock.Instance.Start();

            Rebug.Print("Recording time-sync packet");
            var timeSync = new TimeSync(delay: 10000);

            timeSync.Run();

            //Initializes the RICH on pin D7
            Rebug.Print("Initializing RICH detector");
            var rich = new Rich();

            //THIS SECTION CREATES/INITIALIZES THE SERIAL BNO 100HZ UPDATER
            Rebug.Print("Initializing BNO Sensor ");
            var bnoloop = new SerialBnoUpdater(delay: 1000);

            //THIS SECTION CREATES/INITIALIZES THE GEIGER COUNTER UPDATER
            Rebug.Print("Initializing geiger counter collection data");
            var geigerloop = new GeigerUpdater(delay: 10, size: 2048);

            //THIS SECTION CREATES/INITIALIZES THE GEIGER COUNTER UPDATER
            var accel_dump_size = 18432;

            Rebug.Print("Initializing fast accel dump collector with a size of " + accel_dump_size + "bytes.");
            var acceldumploop = new AccelUpdater(accel_dump_size);

            //Thread.Sleep(5000);
            Rebug.Print("Flight computer INIT Complete. Continuing with boot.");

            //THIS SECTION INITIALIZES AND STARTS THE MEMORY MONITOR
            Rebug.Print("Starting memory monitor...");
            MemoryMonitor.Instance.Start(ref logger);

            //THIS STARTS THE Accel dump update
            Rebug.Print("Starting accel dumper...");
            acceldumploop.Start();

            //THIS STARTS THE BNO SENSOR UPDATE
            Rebug.Print("Starting bno sensor updates...");
            bnoloop.Start();

            //THIS STARTS THE Geiger UPDATE.
            Rebug.Print("Starting geiger counter data collection...");
            geigerloop.Start();

            //Starts the RICH detector
            Rebug.Print("Starting RICH detector");
            rich.TurnOn();

            Rebug.Print("Flight computer boot successful.");
        }
        public static void Main()
        {
            var bus = new I2CBus();

            var lcdProvider = new MCP23008LcdTransferProvider(bus);
            var lcd         = new Lcd(lcdProvider);

            lcd.Begin(16, 2);
            lcd.Backlight = true;
            lcd.Write("Payload McPayload Face v1.0");
            for (int i = 0; i < 12; i++)
            {
                lcd.ScrollDisplayLeft();
                Thread.Sleep(200);
            }
            Thread.Sleep(1000);
            lcd.Clear();
            LCDFinish(lcd, "ACC DemoSat 2016");

            //THIS SECTION CREATES / INITIALIZES THE SERIAL LOGGER
            Debug.Print("Flight computer started successfully. Beginning INIT.");

            //Lcd = new LiquidCrystalI2C(0x01, 16, 2);
            //Lcd.write("Testing!");
            lcd.Write("Starting logger.");
            var logger = new Logger();

            Debug.Print("Starting logger.");
            logger.Start();
            LCDFinish(lcd, "Done.");


            lcd.Write("Starting clock...");
            Rebug.Print("Starting clock.");
            Clock.Instance.Start();
            LCDFinish(lcd, "Done.");

            //THIS SECTION CREATES/INITIALIZES THE PRESSURE SENSOR
            //lcd.Write("Init BMP sensor.");
            //Rebug.Print("Initializing BMP Sensor ");
            //var bmploop = new PressureTempAltitudeUpdater(bus, delay: 1000);
            //LCDFinish(lcd);

            //THIS SECTION CREATES/INITIALIZES THE SERIAL BNO 100HZ UPDATER
            lcd.Write("Init BNO sensor...");
            Rebug.Print("Initializing BNO Sensor ");
            var bno     = new SerialBno(SerialPorts.COM1, 5000, 5000, SerialBno.Bno055OpMode.OperationModeNdof);
            var bnoloop = new SerialBnoUpdater(bno, delay: 1000);

            LCDFinish(lcd, "Done.");

            ////Starts up the expensive mag
            lcd.Write("Init exp. mag...");
            Rebug.Print("Initializing expensive magnetometer on com3");
            var expensiveMagLoop = new ExpensiveMagUpdater(delay: 1000);

            LCDFinish(lcd, "Done.");

            lcd.Write("Init calib disp.");
            Rebug.Print("Initializing BNO calibration display loop");
            var printBnoCalib = new BNOCalibUpdate(bno, lcd, delay: 1000);

            LCDFinish(lcd, "Done.");

            //////THIS SECTION CREATES/INITIALIZES THE MAGNETOMETER UPDATER
            var mag_dump_size = 18432;

            lcd.Write("Init fast mag...");
            Rebug.Print("Initializing fast mag dump collector with a size of " + mag_dump_size + "bytes.");
            var customMagLoop = new CustomMagUpdater(mag_dump_size, AnalogChannels.ANALOG_PIN_A0);

            LCDFinish(lcd, "Done.");

            //Thread.Sleep(5000);
            lcd.Write("Init complete...");
            Rebug.Print("Flight computer INIT Complete. Continuing with boot.");
            LCDFinish(lcd, "Continuing boot.");

            //THIS SECTION INITIALIZES AND STARTS THE MEMORY MONITOR
            lcd.Write("Start memory monitor...");
            Rebug.Print("Starting memory monitor...");
            MemoryMonitor.Instance.Start(ref logger);
            LCDFinish(lcd, "Done.");

            ////THIS STARTS THE Mag dump update
            lcd.Write("Start f.mag loop...");
            Rebug.Print("Starting fast mag dump...");
            customMagLoop.Start();
            LCDFinish(lcd, "Done.");

            ////THIS STARTS THE BNO SENSOR UPDATE
            lcd.Write("Start bno loop...");
            Rebug.Print("Starting bno sensor updates...");
            bnoloop.Start();
            LCDFinish(lcd, "Done.");

            //THIS STARTS THE BNO SENSOR UPDATE
            //lcd.Write("Start bmp loop");
            //Rebug.Print("Starting bmp sensor updates...");
            //bmploop.Start();
            //LCDFinish(lcd);

            //THIS STARTS THE EXPENSIVE MAG UPDATE
            lcd.Write("Start e.mag loop...");
            Rebug.Print("Starting expensive mag updates...");
            expensiveMagLoop.Start();
            LCDFinish(lcd, "Done.");

            lcd.Write("Boot successful!");
            LCDFinish(lcd, "Entering run state.");

            Rebug.Print("Flight computer boot successful.");
            printBnoCalib.Start();
        }
        public static void Main()
        {
            I2CBus bus = new I2CBus();

            //THIS SECTION CREATES / INITIALIZES THE SERIAL LOGGER
            Debug.Print("Flight computer started successfully. Beginning INIT.");

            var logger = new Logger();

            Debug.Print("Starting logger.");
            logger.Start();

            Rebug.Print("Starting clock.");
            Clock.Instance.Start();

            //var tracker = new LightTracker(PWMChannels.PWM_PIN_D5, PWMChannels.PWM_PIN_D10,
            //                            Cpu.AnalogChannel.ANALOG_2, Cpu.AnalogChannel.ANALOG_0,
            //                            Cpu.AnalogChannel.ANALOG_3, Cpu.AnalogChannel.ANALOG_1);

            var tracker = new LightTracker(PWMChannels.PWM_PIN_D5, Cpu.AnalogChannel.ANALOG_0,
                                           Cpu.AnalogChannel.ANALOG_1);

            tracker.Start();


            //THIS SECTION CREATES/INITIALIZES THE PRESSURE SENSOR
            //lcd.Write("Init BMP sensor.");
            Rebug.Print("Initializing BMP Sensor ");
            var bmploop = new PressureTempAltitudeUpdater(bus, delay: 1000);

            //LCDFinish(lcd);

            //THIS SECTION CREATES/INITIALIZES THE SERIAL BNO 100HZ UPDATER

            Rebug.Print("Initializing BNO Sensor ");
            var bno     = new SerialBno(SerialPorts.COM1, 5000, 5000, SerialBno.Bno055OpMode.OperationModeNdof);
            var bnoloop = new SerialBnoUpdater(bno, delay: 1000);


            Rebug.Print("Initializing BNO calibration display loop");
            var printBnoCalib = new BNOCalibUpdate(bno, delay: 1000);

            //LCDFinish(lcd, "Done.");



            //Thread.Sleep(5000);
            //lcd.Write("Init complete...");
            Rebug.Print("Flight computer INIT Complete. Continuing with boot.");
            //LCDFinish(lcd, "Continuing boot.");

            //THIS SECTION INITIALIZES AND STARTS THE MEMORY MONITOR
            //lcd.Write("Start memory monitor...");
            Rebug.Print("Starting memory monitor...");
            MemoryMonitor.Instance.Start(ref logger);
            //LCDFinish(lcd, "Done.");


            //LCDFinish(lcd, "Done.");

            ////THIS STARTS THE BNO SENSOR UPDATE
            //lcd.Write("Start bno loop...");
            Rebug.Print("Starting bno sensor updates...");
            bnoloop.Start();
            //LCDFinish(lcd, "Done.");

            //THIS STARTS THE BNO SENSOR UPDATE
            //lcd.Write("Start bmp loop");
            //TODO BNP180 discontinued... Update at later time
            Rebug.Print("Starting bmp sensor updates...");
            bmploop.Start();
            //LCDFinish(lcd);

            //lcd.Write("Boot successful!");
            //LCDFinish(lcd,"Entering run state.");

            Rebug.Print("Flight computer boot successful.");
            printBnoCalib.Start();
        }