59 /* |
59 /* |
60 * Fermenter units. These units are connected via the 1-wire bus. |
60 * Fermenter units. These units are connected via the 1-wire bus. |
61 * Each unit can have: |
61 * Each unit can have: |
62 * a DS18B20 sensor to measure the air temperature inside the unit. |
62 * a DS18B20 sensor to measure the air temperature inside the unit. |
63 * a DS18B20 sensor to measure the beer temperature. |
63 * a DS18B20 sensor to measure the beer temperature. |
64 * a DS2408 for 8 bits I/O to read status, turn heater/cooler on/off etc. |
64 * a DS2413 to turn the cooler and heater on or off. |
|
65 * a DS2413 to switch the fan and sense the door. |
65 */ |
66 */ |
66 typedef struct _units_list { |
67 typedef struct _units_list { |
67 struct _units_list *next; |
68 struct _units_list *next; |
68 char *uid; /* uid code */ |
69 char *uuid; /* uid code */ |
69 char *name; /* friendly name */ |
70 char *name; /* friendly name */ |
70 float volume; /* Volume of this unit */ |
71 float volume; /* Volume of this unit */ |
71 char *air_address; /* DS18B20 address */ |
72 char *air_address; /* DS18B20 address */ |
72 float air_temp; /* Air temperature */ |
73 float air_temp; /* Air temperature */ |
73 char *beer_address; /* DS18B20 address */ |
74 char *beer_address; /* DS18B20 address */ |
74 float beer_temp; /* Beer temperature */ |
75 float beer_temp; /* Beer temperature */ |
75 char *io_address; /* DS2408 address */ |
76 char *io1_address; /* DS2413 address */ |
76 unsigned char io_read; /* I/O ports read state */ |
77 char *io2_address; /* DS2413 address */ |
77 int heater_available; /* Heater available */ |
78 int heater_available; /* Heater available */ |
78 int heater_state; /* Heater status */ |
79 int heater_state; /* Heater status */ |
79 int cooler_available; /* Cooler available */ |
80 int cooler_available; /* Cooler available */ |
80 int cooler_state; /* Cooler status */ |
81 int cooler_state; /* Cooler status */ |
81 int fan_available; /* Fan available */ |
82 int fan_available; /* Fan available */ |
82 int fan_state; /* Fan status */ |
83 int fan_state; /* Fan status */ |
83 int light_available; /* Door sensor and int. light */ |
84 int door_state; /* Door and light status */ |
84 int light_state; /* Door and light status */ |
|
85 int mode; /* Unit mode */ |
85 int mode; /* Unit mode */ |
|
86 float beer_set; /* Beer temperature setting */ |
|
87 float fridge_set; /* Fridge temperature setting */ |
|
88 float temp_set_min; /* Minimum temperature */ |
|
89 float temp_set_max; /* Maximum temperature */ |
|
90 float idle_rangeL; /* Idle temperature low */ |
|
91 float idle_rangeH; /* Idle range high */ |
86 char *profile; /* Active profile */ |
92 char *profile; /* Active profile */ |
87 time_t prof_started; /* Profile start time */ |
93 time_t prof_started; /* Profile start time */ |
88 } units_list; |
94 } units_list; |
89 |
95 |
90 #define UNITMODE_NA 0 /* Unit is missing */ |
96 #define UNITMODE_OFF 0 /* Unit turned off */ |
91 #define UNITMODE_OFF 1 /* Unit turned off */ |
97 #define UNITMODE_NONE 1 /* Unit on but does nothing */ |
92 #define UNITMODE_NONE 2 /* Unit on but does nothing */ |
98 #define UNITMODE_FRIDGE 2 /* Unit acts as a fridge */ |
93 #define UNITMODE_FRIDGE 3 /* Unit acts as a fridge */ |
99 #define UNITMODE_BEER 3 /* Unit acts as beer cooler */ |
94 #define UNITMODE_BEER 4 /* Unit acts as beer cooler */ |
100 #define UNITMODE_PROFILE 4 /* Unit runs in profile mode */ |
95 #define UNITMODE_PROFILE 5 /* Unit runs in profile mode */ |
|
96 |
101 |
97 #define UNITIO_HEATER 0x01 /* Heater bit */ |
102 #define UNITIO_HEATER 0x01 /* Heater bit */ |
98 #define UNITIO_COOLER 0x02 /* Cooler bit */ |
103 #define UNITIO_COOLER 0x02 /* Cooler bit */ |
99 #define UNITIO_FAN 0x04 /* Fan bit */ |
104 #define UNITIO_FAN 0x04 /* Fan bit */ |
100 #define UNITIO_LIGHT 0x08 /* Light bit */ |
105 #define UNITIO_LIGHT 0x08 /* Light bit */ |