예제 #1
0
        public Term(StarDatabase database, Remote remote)
        {
            VT4100        = new Comms("VT4100", 19200, System.IO.Ports.Parity.Even, 7);
            logger        = new Logger("TERMINA", Logger.Level.INFO);
            this.database = database;
            this.remote   = remote;
            VT4100.Send(clear);
            VT4100.Send("CZGZZ DEATHCOM - LEWIS HAMILTON 2020 - https://czgzz.space");
            Thread.Sleep(1000);
            logger.log(Logger.Level.DEBUG, "Input event created");
            Thread.Sleep(100);
            VT4100.ClearBuffer();
            loadingScreen();
            database.load(this);
            var earthLoc = database.search("EARTH");

            calc = new OrbitCalculator(database.data[earthLoc], 151, -33);
        }
예제 #2
0
        public Test()
        {
            var db = new StarDatabase();


            ObjectDataRecords currentObject;

            while (true)
            {
                Console.Write("Enter command: ");
                var res = Console.ReadLine();
                switch (res)
                {
                case "loaddb":
                    db.load(null);
                    break;

                case "find":
                    Console.Write("Enter planet name: ");
                    res = Console.ReadLine();
                    var planet = db.search(res.ToUpper());
                    Console.WriteLine("Found planet at: {0}", planet);
                    break;

                case "calc":
                    Console.Write("Enter object name: ");
                    res = Console.ReadLine();
                    try
                    {
                        currentObject = db.data[db.search(res)];
                    }
                    catch (Exception)
                    {
                        currentObject = null;
                        break;
                    }
                    currentObject.Calculations = OrbitCalculator.DirectionFinder(currentObject, db.data[db.search("EARTH")], 151, -33);
                    Console.WriteLine(currentObject.ToString());
                    Console.WriteLine("AZ EL >> ", +currentObject.Calculations.Az + " " + currentObject.Calculations.El);
                    break;

                case "remote simple":
                    Remote remoteTemp = new Remote();
                    Console.WriteLine("Current read from Deathbox: ");
                    while (true)
                    {
                        string s = string.Format("CAz: {0}\n\rCEl: {1}\n\rDAz: {2}\n\rDEl: {3}\n\rSAz: {4}\n\rSEl: {5}\n\rMoving? {6}\n\rVolts: {7}\n\rLights: {8}\n\rConnect: {9}\n\r",
                                                 remoteTemp.data.rxCurrentAzEl.Az.ToString(),
                                                 remoteTemp.data.rxCurrentAzEl.El.ToString(),
                                                 remoteTemp.data.rxDesiredAzEl.Az.ToString(),
                                                 remoteTemp.data.rxDesiredAzEl.El.ToString(),
                                                 remoteTemp.data.txAzEl.Az.ToString(),
                                                 remoteTemp.data.txAzEl.El.ToString(),
                                                 remoteTemp.data.moving.ToString(),
                                                 remoteTemp.data.volts.ToString(),
                                                 remoteTemp.data.lights.ToString(),
                                                 remoteTemp.data.connect.ToString());
                        Console.WriteLine(s);
                    }
                    break;

                default:
                    Console.WriteLine("Unknown command: res");
                    break;
                }
            }
        }