brewco/brewco.h

changeset 435
4b1ed6897d80
parent 434
eb724767860d
child 438
7d1ec160d751
--- a/brewco/brewco.h	Wed Nov 25 22:49:35 2015 +0100
+++ b/brewco/brewco.h	Thu Nov 26 22:47:42 2015 +0100
@@ -83,6 +83,27 @@
 #define MBSE_SS(x) (x)?(x):"(null)"
 
 
+/*
+ * Sensor strcuture
+ */
+typedef struct _sensor_var {
+    char		uuid[37];		/* sensor uuid			*/
+    int			state;			/* sensor state			*/
+    int			value;			/* sensor value			*/
+} sensor_var;
+
+
+
+/*
+ * Switch structure
+ */
+typedef struct _switch_var {
+    char		uuid[37];		/* switch uuid			*/
+    int			value;			/* switch value (0..100)	*/
+    int			delay;			/* switch delay			*/
+} switch_var;
+
+
 
 /*
  * Brewing units. The sensors of the units are connected via the 1-wire bus.
@@ -94,22 +115,24 @@
     int                 version;                /* Record version               */
     char		*uuid;			/* uuid code			*/
     char                *name;                  /* Unit name                    */
-    char                *hlt_sensor_address;    /* HLT sensor address           */
-    int                 hlt_sensor_state;       /* HLT sensor state             */
-    int                 hlt_sensor_value;       /* HLT sensor value             */
-    char		*hlt_heater_address;	/* HLT heater address		*/
-    int			hlt_heater_state;	/* HLT heater state 0..100	*/
-    int			hlt_heater_delay;	/* HLT heater delay / 15 sec	*/
+    sensor_var		*hlt_sensor;		/* HLT sensor			*/
+    switch_var		*hlt_heater;		/* HLT heater			*/
     int			hlt_heater_mltfirst;	/* HLT heater MLT high priority	*/
-    char                *mlt_sensor_address;    /* MLT sensor address           */
-    int                 mlt_sensor_state;       /* MLT sensor state             */
-    int                 mlt_sensor_value;       /* MLT sensor value             */
-    char		*mlt_heater_address;	/* MLT heater address		*/
-    int			mlt_heater_state;	/* MLT heater state 0..100	*/
-    int			mlt_heater_delay;	/* MLT heater delay / 15 sec	*/
-    char		*mlt_pump_address;	/* MLT pump address		*/
-    int			mlt_pump_state;		/* MLT pump state 0..100	*/
-    int			mlt_pump_delay;		/* MLT_pump_delay		*/
+    sensor_var		*mlt_sensor;		/* MLT sensor			*/
+    switch_var		*mlt_heater;		/* MLT heater			*/
+    switch_var		*mlt_pump;		/* MLT pump			*/
+    int			pump_cycle;		/* 5..15 minutes 		*/
+    int			pump_rest;		/* 1..5 minutes			*/
+    int			pump_premash;		/* 0/1				*/
+    int			pump_onmash;		/* 0/1				*/
+    int			pump_mashout;		/* 0/1				*/
+    int			pump_onboil;		/* 0/1 pump during boiling	*/
+    int			pump_stop;		/* 80..105 C			*/
+    int			skip_add;		/* 0/1 skip Add phase		*/
+    int			skip_remove;		/* 0/1 skip Remove phase	*/
+    int			skip_iodine;		/* 0/1 skip Iodine test		*/
+    int			iodine_time;		/* 0..90 minutes		*/
+    int			whirlpool;		/* off/cold/hot			*/
     pid_var		*PID_hlt;		/* HLT PID			*/
     pid_var		*PID_mlt;		/* MLT PID			*/
 } units_list;
@@ -161,6 +184,48 @@
 #define DEVDIR_INTERN           6               /* Internal function            */
 
 
+
+/*
+ * Recipes.
+ */
+typedef struct _mash_step {
+    char		name[21];		/* Step name			*/
+    int			min;			/* Minimum temperature		*/
+    int			max;			/* Maximum temperature		*/
+    int			canskip;		/* 0/1 can we skip this step	*/
+    int			setpoint;		/* Temperature setpoint		*/
+    int			skip;			/* Skip this step		*/
+    int			duration;		/* Step duration		*/
+} mash_step;
+
+// mash-in	20	80	noskip
+// fitasi	25	55	canskip
+// glucanasi	35	50	canskip
+// proteasi	45	60	canskip
+// B-amilasi	50	70	canskip
+// A-amilasi 1	60	76	canskip
+// A-amilasi 2	60	76	noskip
+// mash-out	75	80	noskip
+
+typedef struct _hop_addition {
+    char		name[21];		/* Hop name			*/
+    int			boil_duration;		/* -1=fwh, 0..boiltime		*/
+} hop_addition;
+
+typedef struct _a_recipe {
+    char		uuid[37];		/* Recipe uuid			*/
+    char		code[21];		/* Recipe code			*/
+    char		name[21];		/* Recipe name			*/
+    mash_step		mash[8];		/* 8 mash steps			*/
+    hop_addition	hops[10];		/* 10 hop additions		*/
+    int			boiltime;		/* 1..240 minutes		*/
+    time_t		started;		/* Start time			*/
+    time_t		endtime;		/* Ending time			*/
+} a_recipe;
+
+
+
+
 #ifdef USE_SIMULATOR
 
 /*
@@ -198,12 +263,7 @@
     char		*name;			/* Configuration name		*/
     int			my_port;		/* my client/server port	*/
     unsigned char	tempFormat;		/* Temperature format, C or F	*/
-    char                *temp_address;          /* Environment temperature      */
-    int                 temp_state;             /* 0=ok, 1=missing, 2=error     */
-    int                 temp_value;             /* Air temperature in C * 1000  */
-    char                *hum_address;           /* Environment huminity         */
-    int                 hum_state;              /* 0=ok, 1=missing, 2=error     */
-    int                 hum_value;              /* Huminity in % * 1000         */
+    sensor_var		*roomtemp;		/* Environment temperature      */
     int			lcd_cols;		/* LCD display columns		*/
     int			lcd_rows;		/* LCD display rows		*/
     int			lcd_address;		/* LCD display i2c address	*/

mercurial