Ejemplo n.º 1
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_WebServer != null)
                {
                    _WebServer.Dispose();
                    _WebServer = null;
                }

                if (_SpaMonitorThread != null)
                {
                    _SpaMonitorThread.Dispose();
                    _SpaMonitorThread = null;
                }
            }
        }
Ejemplo n.º 2
0
        private void run()
        {
            // Setup data logger
            try
            {
                String logPath = Path.Combine(SDROOT, TEMPERATURELOGFILE);
                if (File.Exists(logPath))
                    File.Delete(logPath);

                _DataLogger = new DataLogger(logPath);
                _DataLogger.WriteBreak();
            }
            catch (IOException ex)
            {
                Debug.Print(ex.ToString());
            }

            // Set local time
            try
            {
                //DateTime ntpTime = Utility.NTPTime("pool.ntp.org", TIMEZONEOFFSET);
                //Microsoft.SPOT.Hardware.Utility.SetLocalTime(ntpTime);

                //Debug.Print("Set netduino time to: " + ntpTime);
            }
            catch (Exception ex)
            {
                Debug.Print("Failed to grab time from NTP server!");
            }

            // Startup web server
            _WebServer = new SimpleWeb.Server();

            // More test code
            Controllers.RelayController relay = new Controllers.RelayController();
            relay.Ports.Add(new OutputPort(Pins.GPIO_PIN_D0, false));

            //
            _SpaMonitorThread = new SpaMonitor(Pins.GPIO_PIN_A0, Pins.GPIO_PIN_A1, Pins.GPIO_PIN_A2);
            _SpaMonitorThread.StartMonitorThread();

            while (_SpaMonitorThread.Running)
            {
                Debug.Print("Ambient: " + _SpaMonitorThread.AmbientTemp);
                Debug.Print("Cold: " + _SpaMonitorThread.ColdTemp);
                Debug.Print("Hot: " + _SpaMonitorThread.HotTemp);

                Thread.Sleep(1000);
            }

            relay.Deactivate();
            relay.Dispose();
        }