thermferm/thermferm.h

changeset 71
a09c5cdc4022
parent 66
805f1d285acd
child 72
f7cb53c50ee1
--- a/thermferm/thermferm.h	Mon Jun 23 20:01:27 2014 +0200
+++ b/thermferm/thermferm.h	Mon Jun 23 22:16:29 2014 +0200
@@ -48,11 +48,55 @@
 
 /* rdconfig.c */
 typedef struct _key_list {
-    char	*key;
-    int		(*prc)(char **);
-    char	**dest;
+    char		*key;
+    int			(*prc)(char **);
+    char		**dest;
 } key_list;
 
+/*
+ * Fermenter units. These units are connected via the 1-wire bus.
+ * Each unit can have:
+ *  a DS18B20 sensor to measure the air temperature inside the unit.
+ *  a DS18B20 sensor to measure the beer temperature.
+ *  a DS2408 for 8 bits I/O to read status, turn heater/cooler on/off etc.
+ */
+typedef struct _units_list {
+    struct _units_list	*next;
+    char		*uid;			/* uid code			*/
+    char		*name;			/* friendly name		*/
+    float		volume;			/* Volume of this unit		*/
+    char		*air_address;		/* DS18B20 address		*/
+    float		air_temp;		/* Air temperature		*/
+    char		*beer_address;		/* DS18B20 address		*/
+    float		beer_temp;		/* Beer temperature		*/
+    char		*io_address;		/* DS2408 address		*/
+    unsigned char	io_read;		/* I/O ports read state		*/
+    bool		heater_available;	/* Heater available		*/
+    int			heater_state;		/* Heater status		*/
+    bool		cooler_available;	/* Cooler available		*/
+    int			cooler_state;		/* Cooler status		*/
+    bool		fan_available;		/* Fan available		*/
+    int			fan_state;		/* Fan status			*/
+    bool		light_available;	/* Door sensor and int. light	*/
+    int			light_state;		/* Door and light status	*/
+    int			mode;			/* Unit mode			*/
+    char		*profile;		/* Active profile		*/
+    time_t		prof_started;		/* Profile start time		*/
+} units_list;
+
+#define	UNITMODE_NA		0		/* Unit is missing		*/
+#define	UNITMODE_OFF		1		/* Unit turned off		*/
+#define	UNITMODE_NONE		2		/* Unit on but does nothing	*/
+#define	UNITMODE_FRIDGE		3		/* Unit acts as a fridge	*/
+#define	UNITMODE_BEER		4		/* Unit acts as beer cooler	*/
+#define	UNITMODE_PROFILE	5		/* Unit runs in profile mode	*/
+
+#define	UNITIO_HEATER		0x01		/* Heater bit			*/
+#define	UNITIO_COOLER		0x02		/* Cooler bit			*/
+#define	UNITIO_FAN		0x04		/* Fan bit			*/
+#define	UNITIO_LIGHT		0x08		/* Light bit			*/
+#define	UNITIO_DOOR		0x10		/* Door status			*/
+
 typedef struct _w1_therm {
     struct _w1_therm    *next;
     char                *master;                /* Master for this device       */
@@ -82,6 +126,7 @@
     int			tx433;			/* 433 MHz transmitter pin	*/
     rc_switch		*rcswitch;		/* 433 MHz RC Power switches	*/
 #endif
+    units_list		*units;			/* Fermenter units		*/
     						/* ControlSettings:		*/
     unsigned char	cs_mode;		/* mode				*/
     float		cs_beerSet;		/* beer temperature		*/

mercurial