Example #1
0
        public Controller(Config config, ISystemServices ss, IRelay relay)
        {
            m_config = config;
            m_services = ss;
            m_relay = relay;
            m_isDst = config.IsDST;

            ScheduleLights();
        }
Example #2
0
        static void ControllerTest()
        {
            LightRelay LR = new LightRelay((Cpu.Pin)FEZ_Pin.Digital.IO44);

            Config config = new Config();

            TestSystemServices system = new TestSystemServices();

            system.SetLocalTime(config.StartingDateTime);

            Controller lc = new Controller(config, system, LR);
            lc.Control();
        }
Example #3
0
        public LightTimes(DateTime dt, Config config)
        {
            // Assuming SunCalculator is returning high noon for sunrise
            // and sunset in the winter
            SunCalculator sc = new SunCalculator(config.SiteCoords.Longitude,
                                    config.SiteCoords.Latitude,
                                    config.UTCOffset * 15,
                                    config.IsDstInEffect(dt));

            Sunrise = sc.CalculateSunRise(dt);
            LightsOffAM = Sunrise + config.SunriseOffset;

            Sunset = sc.CalculateSunSet(dt);
            LightsOnPM = Sunset + config.SunsetOffset;

            LightsOnAM = dt.Date + config.AMLightsOn;

            LightsOffPM = dt.Date + config.PMLightsOff;
        }
Example #4
0
        static void StartController()
        {
            FEZ_Shields.KeypadLCD.Initialize();

            LightRelay LR = new LightRelay((Cpu.Pin)FEZ_Pin.Digital.IO44);

            Config config = new Config();

            Setup_Lcd_2x16.DoSetup(config);

            DotNetSystemServices system = new DotNetSystemServices();

            system.SetLocalTime(config.StartingDateTime);

            Controller lc = new Controller(config, system, LR);

            Monitor_Lcd_2x16.DoMonitor(lc, config, system);

            lc.Control();
        }