81 |
81 |
82 |
82 |
83 #define MBSE_SS(x) (x)?(x):"(null)" |
83 #define MBSE_SS(x) (x)?(x):"(null)" |
84 |
84 |
85 |
85 |
|
86 /* |
|
87 * Sensor strcuture |
|
88 */ |
|
89 typedef struct _sensor_var { |
|
90 char uuid[37]; /* sensor uuid */ |
|
91 int state; /* sensor state */ |
|
92 int value; /* sensor value */ |
|
93 } sensor_var; |
|
94 |
|
95 |
|
96 |
|
97 /* |
|
98 * Switch structure |
|
99 */ |
|
100 typedef struct _switch_var { |
|
101 char uuid[37]; /* switch uuid */ |
|
102 int value; /* switch value (0..100) */ |
|
103 int delay; /* switch delay */ |
|
104 } switch_var; |
|
105 |
|
106 |
86 |
107 |
87 /* |
108 /* |
88 * Brewing units. The sensors of the units are connected via the 1-wire bus. |
109 * Brewing units. The sensors of the units are connected via the 1-wire bus. |
89 * The heaters, pumps (or mixer) are connected on the Pi GPIO. The hardware |
110 * The heaters, pumps (or mixer) are connected on the Pi GPIO. The hardware |
90 * is configured in the devices lists. |
111 * is configured in the devices lists. |
92 typedef struct _units_list { |
113 typedef struct _units_list { |
93 struct _units_list *next; |
114 struct _units_list *next; |
94 int version; /* Record version */ |
115 int version; /* Record version */ |
95 char *uuid; /* uuid code */ |
116 char *uuid; /* uuid code */ |
96 char *name; /* Unit name */ |
117 char *name; /* Unit name */ |
97 char *hlt_sensor_address; /* HLT sensor address */ |
118 sensor_var *hlt_sensor; /* HLT sensor */ |
98 int hlt_sensor_state; /* HLT sensor state */ |
119 switch_var *hlt_heater; /* HLT heater */ |
99 int hlt_sensor_value; /* HLT sensor value */ |
|
100 char *hlt_heater_address; /* HLT heater address */ |
|
101 int hlt_heater_state; /* HLT heater state 0..100 */ |
|
102 int hlt_heater_delay; /* HLT heater delay / 15 sec */ |
|
103 int hlt_heater_mltfirst; /* HLT heater MLT high priority */ |
120 int hlt_heater_mltfirst; /* HLT heater MLT high priority */ |
104 char *mlt_sensor_address; /* MLT sensor address */ |
121 sensor_var *mlt_sensor; /* MLT sensor */ |
105 int mlt_sensor_state; /* MLT sensor state */ |
122 switch_var *mlt_heater; /* MLT heater */ |
106 int mlt_sensor_value; /* MLT sensor value */ |
123 switch_var *mlt_pump; /* MLT pump */ |
107 char *mlt_heater_address; /* MLT heater address */ |
124 int pump_cycle; /* 5..15 minutes */ |
108 int mlt_heater_state; /* MLT heater state 0..100 */ |
125 int pump_rest; /* 1..5 minutes */ |
109 int mlt_heater_delay; /* MLT heater delay / 15 sec */ |
126 int pump_premash; /* 0/1 */ |
110 char *mlt_pump_address; /* MLT pump address */ |
127 int pump_onmash; /* 0/1 */ |
111 int mlt_pump_state; /* MLT pump state 0..100 */ |
128 int pump_mashout; /* 0/1 */ |
112 int mlt_pump_delay; /* MLT_pump_delay */ |
129 int pump_onboil; /* 0/1 pump during boiling */ |
|
130 int pump_stop; /* 80..105 C */ |
|
131 int skip_add; /* 0/1 skip Add phase */ |
|
132 int skip_remove; /* 0/1 skip Remove phase */ |
|
133 int skip_iodine; /* 0/1 skip Iodine test */ |
|
134 int iodine_time; /* 0..90 minutes */ |
|
135 int whirlpool; /* off/cold/hot */ |
113 pid_var *PID_hlt; /* HLT PID */ |
136 pid_var *PID_hlt; /* HLT PID */ |
114 pid_var *PID_mlt; /* MLT PID */ |
137 pid_var *PID_mlt; /* MLT PID */ |
115 } units_list; |
138 } units_list; |
116 |
139 |
117 |
140 |
157 #define DEVDIR_OUT_BIN 2 /* Binary output */ |
180 #define DEVDIR_OUT_BIN 2 /* Binary output */ |
158 #define DEVDIR_IN_ANALOG 3 /* Temperature input etc. */ |
181 #define DEVDIR_IN_ANALOG 3 /* Temperature input etc. */ |
159 #define DEVDIR_OUT_ANALOG 4 /* Analog steering */ |
182 #define DEVDIR_OUT_ANALOG 4 /* Analog steering */ |
160 #define DEVDIR_OUT_PWM 5 /* PWM outout */ |
183 #define DEVDIR_OUT_PWM 5 /* PWM outout */ |
161 #define DEVDIR_INTERN 6 /* Internal function */ |
184 #define DEVDIR_INTERN 6 /* Internal function */ |
|
185 |
|
186 |
|
187 |
|
188 /* |
|
189 * Recipes. |
|
190 */ |
|
191 typedef struct _mash_step { |
|
192 char name[21]; /* Step name */ |
|
193 int min; /* Minimum temperature */ |
|
194 int max; /* Maximum temperature */ |
|
195 int canskip; /* 0/1 can we skip this step */ |
|
196 int setpoint; /* Temperature setpoint */ |
|
197 int skip; /* Skip this step */ |
|
198 int duration; /* Step duration */ |
|
199 } mash_step; |
|
200 |
|
201 // mash-in 20 80 noskip |
|
202 // fitasi 25 55 canskip |
|
203 // glucanasi 35 50 canskip |
|
204 // proteasi 45 60 canskip |
|
205 // B-amilasi 50 70 canskip |
|
206 // A-amilasi 1 60 76 canskip |
|
207 // A-amilasi 2 60 76 noskip |
|
208 // mash-out 75 80 noskip |
|
209 |
|
210 typedef struct _hop_addition { |
|
211 char name[21]; /* Hop name */ |
|
212 int boil_duration; /* -1=fwh, 0..boiltime */ |
|
213 } hop_addition; |
|
214 |
|
215 typedef struct _a_recipe { |
|
216 char uuid[37]; /* Recipe uuid */ |
|
217 char code[21]; /* Recipe code */ |
|
218 char name[21]; /* Recipe name */ |
|
219 mash_step mash[8]; /* 8 mash steps */ |
|
220 hop_addition hops[10]; /* 10 hop additions */ |
|
221 int boiltime; /* 1..240 minutes */ |
|
222 time_t started; /* Start time */ |
|
223 time_t endtime; /* Ending time */ |
|
224 } a_recipe; |
|
225 |
|
226 |
162 |
227 |
163 |
228 |
164 #ifdef USE_SIMULATOR |
229 #ifdef USE_SIMULATOR |
165 |
230 |
166 /* |
231 /* |
196 |
261 |
197 typedef struct _sys_config { |
262 typedef struct _sys_config { |
198 char *name; /* Configuration name */ |
263 char *name; /* Configuration name */ |
199 int my_port; /* my client/server port */ |
264 int my_port; /* my client/server port */ |
200 unsigned char tempFormat; /* Temperature format, C or F */ |
265 unsigned char tempFormat; /* Temperature format, C or F */ |
201 char *temp_address; /* Environment temperature */ |
266 sensor_var *roomtemp; /* Environment temperature */ |
202 int temp_state; /* 0=ok, 1=missing, 2=error */ |
|
203 int temp_value; /* Air temperature in C * 1000 */ |
|
204 char *hum_address; /* Environment huminity */ |
|
205 int hum_state; /* 0=ok, 1=missing, 2=error */ |
|
206 int hum_value; /* Huminity in % * 1000 */ |
|
207 int lcd_cols; /* LCD display columns */ |
267 int lcd_cols; /* LCD display columns */ |
208 int lcd_rows; /* LCD display rows */ |
268 int lcd_rows; /* LCD display rows */ |
209 int lcd_address; /* LCD display i2c address */ |
269 int lcd_address; /* LCD display i2c address */ |
210 units_list *units; /* Brewing units */ |
270 units_list *units; /* Brewing units */ |
211 devices_list *devices; /* Sensors and switches */ |
271 devices_list *devices; /* Sensors and switches */ |