/[ThermoControl]/trunk/libThermoControl/Controller.cs
ViewVC logotype

Diff of /trunk/libThermoControl/Controller.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 19 by william, Wed Nov 13 02:03:05 2013 UTC revision 20 by william, Wed Nov 13 02:22:43 2013 UTC
# Line 10  namespace libThermoControl Line 10  namespace libThermoControl
10  {  {
11      public interface IController      public interface IController
12      {      {
13          int CurrentTemperature { get; }          //int CurrentTemperature { get; }
14          void ResetTemperature();          void SetDefaultTemperature();
15          void SetTemperature(int temp);          void SetTemperature(int temp);
16      }      }
17      public class Controller : IController      public class Controller : IController
18      {      {
19          public Controller()          public Controller()
20          {          {        
21              CurrentTemperature = Configuration.DEFAULT_TEMP;  
22          }          }
23          #region IController members          #region IController members
24          private int _CurrentTemperature;          //private int _CurrentTemperature;
25          public int CurrentTemperature { get { return _CurrentTemperature; } private set { _CurrentTemperature = value; } }          //public int CurrentTemperature { get { return _CurrentTemperature; } private set { _CurrentTemperature = value; } }
26    
27          public void ResetTemperature()          public void SetDefaultTemperature()
28          {          {
29              //int temp_current = CurrentTemperature;              //int temp_current = CurrentTemperature;
30              //int temp_default = Configuration.DEFAULT_TEMP;              //int temp_default = Configuration.DEFAULT_TEMP;
# Line 41  namespace libThermoControl Line 41  namespace libThermoControl
41              {              {
42                  throw new ArgumentOutOfRangeException(string.Format("Cannot set temperature to: '{0}' ... Range is: '{1}' to '{2}'",temp, Configuration.MIN_TEMP, Configuration.MAX_TEMP));                  throw new ArgumentOutOfRangeException(string.Format("Cannot set temperature to: '{0}' ... Range is: '{1}' to '{2}'",temp, Configuration.MIN_TEMP, Configuration.MAX_TEMP));
43              }              }
44              int temp_current = CurrentTemperature;              int temp_current = Configuration.CurrentTemp;
45              int temp_offset = temp - temp_current;              int temp_offset = temp - temp_current;
46              //LogDebugMessage("Controller.SetTemperature(int temp):");              //LogDebugMessage("Controller.SetTemperature(int temp):");
47              //LogDebugMessage("\tCurrent: {0}", temp_current);              //LogDebugMessage("\tCurrent: {0}", temp_current);
# Line 75  namespace libThermoControl Line 75  namespace libThermoControl
75                      Blaster.BlastCommand(Configuration.THERMISTAT_DEVICE, button);                      Blaster.BlastCommand(Configuration.THERMISTAT_DEVICE, button);
76                  }                  }
77              }              }
78              CurrentTemperature = temp;              Configuration.CurrentTemp = temp;
79          }          }
80    
81          private bool OffsetIsNegative(int temp_offset)          private bool OffsetIsNegative(int temp_offset)

Legend:
Removed from v.19  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC 1.1.22