79 #define MENU_MODE_BEER 213 |
79 #define MENU_MODE_BEER 213 |
80 #define MENU_BEER_TEMP 2131 |
80 #define MENU_BEER_TEMP 2131 |
81 #define MENU_MODE_FRIDGE 214 |
81 #define MENU_MODE_FRIDGE 214 |
82 #define MENU_FRIDGE_TEMP 2141 |
82 #define MENU_FRIDGE_TEMP 2141 |
83 #define MENU_MODE_PROFILE 215 |
83 #define MENU_MODE_PROFILE 215 |
84 #define MENU_PROFILE_SELECT 2151 |
|
85 #define MENU_PROFILE_START 2152 |
84 #define MENU_PROFILE_START 2152 |
86 #define MENU_PROFILE_PAUSE 2153 |
85 #define MENU_PROFILE_PAUSE 2153 |
87 #define MENU_PROFILE_ABORT 2154 |
86 #define MENU_PROFILE_ABORT 2154 |
88 #define MENU_PROFILE_RESUME 2155 |
87 #define MENU_PROFILE_RESUME 2155 |
89 #define MENU_PROFILE_GOOFF 2156 |
88 #define MENU_PROFILE_GOOFF 2156 |
118 |
117 |
119 #define MBSE_SS(x) (x)?(x):"(null)" |
118 #define MBSE_SS(x) (x)?(x):"(null)" |
120 |
119 |
121 |
120 |
122 /* |
121 /* |
|
122 * Fermenting steps |
|
123 */ |
|
124 typedef struct _prof_step { |
|
125 struct _prof_step *next; |
|
126 char *name; /* Description of this step */ |
|
127 int steptime; /* Step time to target in hours */ |
|
128 int resttime; /* Rest time on target in hours */ |
|
129 float target_lo; /* Low Target temperature */ |
|
130 float target_hi; /* High target temperature */ |
|
131 int fridge_mode; /* Fridge or beer mode */ |
|
132 } prof_step; |
|
133 |
|
134 |
|
135 |
|
136 /* |
123 * Fermenter units. These units are connected via the 1-wire bus. |
137 * Fermenter units. These units are connected via the 1-wire bus. |
124 * Each unit can have: |
138 * Each unit can have: |
125 * a DS18B20 sensor to measure the air temperature inside the unit. |
139 * a DS18B20 sensor to measure the air temperature inside the unit. |
126 * a DS18B20 sensor(s) to measure the beer temperature. |
140 * a DS18B20 sensor(s) to measure the beer temperature. |
127 * a DS2408 to turn the cooler, heater and fans on or off. Sense door and PSU state. |
141 * a DS2408 to turn the cooler, heater and fans on or off. Sense door and PSU state. |
128 */ |
142 */ |
129 typedef struct _units_list { |
143 typedef struct _units_list { |
130 struct _units_list *next; |
144 struct _units_list *next; |
131 int version; /* Record version */ |
|
132 char *uuid; /* uid code */ |
145 char *uuid; /* uid code */ |
133 char *product_uuid; /* Beer product uuid */ |
146 char *product_uuid; /* Beer product uuid */ |
134 char *product_code; /* Beer product code */ |
147 char *product_code; /* Beer product code */ |
135 char *product_name; /* Beer product name */ |
148 char *product_name; /* Beer product name */ |
136 char *alias; /* alias name 'unit1' */ |
149 char *alias; /* alias name 'unit1' */ |
180 int mode; /* Unit mode */ |
193 int mode; /* Unit mode */ |
181 float beer_set; /* Beer temperature setting */ |
194 float beer_set; /* Beer temperature setting */ |
182 float fridge_set; /* Fridge temperature setting */ |
195 float fridge_set; /* Fridge temperature setting */ |
183 float temp_set_min; /* Minimum temperature */ |
196 float temp_set_min; /* Minimum temperature */ |
184 float temp_set_max; /* Maximum temperature */ |
197 float temp_set_max; /* Maximum temperature */ |
185 char *profile; /* Active profile uuid */ |
198 char *profile_uuid; /* Profile uuid or NULL */ |
|
199 char *profile_name; /* Profile name */ |
|
200 float profile_inittemp_lo; /* Profile initial temp low */ |
|
201 float profile_inittemp_hi; /* Profile initial temp high */ |
|
202 int profile_fridge_mode; /* Profile initial fridge mode */ |
|
203 int profile_duration; /* Profile duration in hours */ |
|
204 int profile_totalsteps; /* Profile number of steps */ |
|
205 prof_step *profile_steps; /* Profile steps */ |
186 time_t prof_started; /* Profile start time */ |
206 time_t prof_started; /* Profile start time */ |
187 int prof_state; /* Profile OFF|PAUSE|RUN|DONE */ |
207 int prof_state; /* Profile OFF|PAUSE|RUN|DONE */ |
188 float prof_target_lo; /* Profile current target low */ |
208 float prof_target_lo; /* Profile current target low */ |
189 float prof_target_hi; /* Profile current target high */ |
209 float prof_target_hi; /* Profile current target high */ |
190 time_t prof_paused; /* Profile total pause time */ |
210 time_t prof_paused; /* Profile total pause time */ |
226 #define ALARM_FLAG_DOOR 0x0001 /* Door open */ |
246 #define ALARM_FLAG_DOOR 0x0001 /* Door open */ |
227 #define ALARM_FLAG_PSU 0x0002 /* PSU problem */ |
247 #define ALARM_FLAG_PSU 0x0002 /* PSU problem */ |
228 #define ALARM_FLAG_CHILLER 0x0100 /* Chiller too warm */ |
248 #define ALARM_FLAG_CHILLER 0x0100 /* Chiller too warm */ |
229 |
249 |
230 |
250 |
231 |
|
232 /* |
|
233 * Fermenting steps |
|
234 */ |
|
235 typedef struct _prof_step { |
|
236 struct _prof_step *next; |
|
237 int version; /* Version 1 */ |
|
238 int steptime; /* Step time to target in hours */ |
|
239 int resttime; /* Rest time on target in hours */ |
|
240 float target_lo; /* Low Target temperature */ |
|
241 float target_hi; /* High target temperature */ |
|
242 int fridge_mode; /* Fridge or beer mode */ |
|
243 } prof_step; |
|
244 |
|
245 /* |
|
246 * Fermenting profiles |
|
247 */ |
|
248 typedef struct _prof_list { |
|
249 struct _prof_list *next; |
|
250 int version; /* Version 1 */ |
|
251 char *uuid; /* Profile uuid */ |
|
252 char *name; /* Profile name */ |
|
253 int busy; /* Profile busy == 1, free == 0 */ |
|
254 float inittemp_lo; /* Low target before start */ |
|
255 float inittemp_hi; /* High target before start */ |
|
256 int fridge_mode; /* Fridge or beer mode */ |
|
257 prof_step *steps; /* Profile steps */ |
|
258 } profiles_list; |
|
259 |
|
260 #define PROFILE_OFF 0 /* Profile not active */ |
251 #define PROFILE_OFF 0 /* Profile not active */ |
261 #define PROFILE_PAUSE 1 /* Profile pause */ |
252 #define PROFILE_PAUSE 1 /* Profile pause */ |
262 #define PROFILE_RUN 2 /* Profile is running */ |
253 #define PROFILE_RUN 2 /* Profile is running */ |
263 #define PROFILE_DONE 3 /* Profile is finished */ |
254 #define PROFILE_DONE 3 /* Profile is finished */ |
264 #define PROFILE_ABORT 4 /* Profile abort */ |
255 #define PROFILE_ABORT 4 /* Profile abort */ |
267 /* |
258 /* |
268 * External devices like sensors, relays. |
259 * External devices like sensors, relays. |
269 */ |
260 */ |
270 typedef struct _dev_list { |
261 typedef struct _dev_list { |
271 struct _dev_list *next; |
262 struct _dev_list *next; |
272 int version; /* Version 1 */ |
|
273 char *uuid; /* UUID of this device */ |
263 char *uuid; /* UUID of this device */ |
274 int type; /* Device type */ |
264 int type; /* Device type */ |
275 int direction; /* Device direction */ |
265 int direction; /* Device direction */ |
276 int value; /* Device value */ |
266 int value; /* Device value */ |
277 int offset; /* Device offset value */ |
267 int offset; /* Device offset value */ |
317 * thermal sensor that measures the air and one that measures the beer. |
307 * thermal sensor that measures the air and one that measures the beer. |
318 * It looks like a normal live setup. |
308 * It looks like a normal live setup. |
319 */ |
309 */ |
320 typedef struct _simulator { |
310 typedef struct _simulator { |
321 struct _simulator *next; |
311 struct _simulator *next; |
322 int version; /* Version of this record */ |
|
323 char *uuid; /* Simulator uuid */ |
312 char *uuid; /* Simulator uuid */ |
324 char *name; /* Simulator name */ |
313 char *name; /* Simulator name */ |
325 int volume_air; /* Volume air of the frigo */ |
314 int volume_air; /* Volume air of the frigo */ |
326 int volume_beer; /* Volume beer inside frigo */ |
315 int volume_beer; /* Volume beer inside frigo */ |
327 double room_temperature; /* Temp outside frigo */ |
316 double room_temperature; /* Temp outside frigo */ |
366 int lcd_cols; /* LCD display columns */ |
355 int lcd_cols; /* LCD display columns */ |
367 int lcd_rows; /* LCD display rows */ |
356 int lcd_rows; /* LCD display rows */ |
368 int lcd_address; /* LCD display i2c address */ |
357 int lcd_address; /* LCD display i2c address */ |
369 int next_unit; /* Next unit alias name */ |
358 int next_unit; /* Next unit alias name */ |
370 units_list *units; /* Fermenter units */ |
359 units_list *units; /* Fermenter units */ |
371 profiles_list *profiles; /* Ferment profiles */ |
360 // profiles_list *profiles; /* Ferment profiles */ |
372 devices_list *devices; /* Sensors and switches */ |
361 devices_list *devices; /* Sensors and switches */ |
373 #ifdef USE_SIMULATOR |
362 #ifdef USE_SIMULATOR |
374 simulator_list *simulators; /* Simulators */ |
363 simulator_list *simulators; /* Simulators */ |
375 #endif |
364 #endif |
376 char *mqtt_host; /* MQTT host to connect to */ |
365 char *mqtt_host; /* MQTT host to connect to */ |