brewco/brewco.h

Fri, 04 Dec 2015 22:57:23 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 04 Dec 2015 22:57:23 +0100
changeset 445
3ec477cda546
parent 444
eafb140a1ddd
child 447
b48368855ec4
permissions
-rw-r--r--

Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.

409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 #ifndef _BREWCO_H
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 #define _BREWCO_H
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 #define TRUE 1
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 #define FALSE 0
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 #include "../config.h"
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
8 #include "pid.h"
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 #include <stdlib.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 #include <stdio.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 #include <stdint.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 #include <stdarg.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 #include <string.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 #include <ctype.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 #include <sys/types.h>
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
17 #include <sys/socket.h>
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include <sys/stat.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include <sys/time.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include <time.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 #include <fcntl.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 #include <syslog.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #include <unistd.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include <errno.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 #include <signal.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include <getopt.h>
410
e3f8a51b566a Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
27 #include <limits.h>
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
28 #include <sys/socket.h>
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
29 #include <arpa/inet.h>
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
30 #include <netdb.h>
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
31 #include <poll.h>
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
32 #include <dirent.h>
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
33 #include <uuid/uuid.h>
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
34 #include <math.h>
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 #ifndef HAVE_WIRINGPI_H
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 #include <pthread.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 #endif
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 #include <libxml/xmlmemory.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 #include <libxml/parser.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 #include <libxml/encoding.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 #include <libxml/xmlwriter.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 #ifdef HAVE_WIRINGPI_H
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 /* wiringPi */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 #include <wiringPi.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 #include <pcf8574.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 #include <lcd.h>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 * Thread locks
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 #define LOCK_DEVICES 0
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 #define LOCK_LCD 1
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 #define LOCK_MENU 2
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 #define LOCK_SPARE2 3
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 #endif
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 * 1-Wire devices
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 #define W1_FAMILY_DEFAULT 0
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 #define W1_FAMILY_SMEM_01 0x01
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 #define W1_FAMILY_SMEM_81 0x81
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 #define W1_THERM_DS18S20 0x10
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 #define W1_FAMILY_DS28E04 0x1C
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 #define W1_COUNTER_DS2423 0x1D
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 #define W1_THERM_DS1822 0x22
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 #define W1_EEPROM_DS2433 0x23
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 #define W1_THERM_DS18B20 0x28
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 #define W1_FAMILY_DS2408 0x29
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 #define W1_EEPROM_DS2431 0x2D
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 #define W1_FAMILY_DS2760 0x30
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 #define W1_FAMILY_DS2780 0x32
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 #define W1_FAMILY_DS2413 0x3A
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 #define W1_THERM_DS1825 0x3B
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 #define W1_FAMILY_DS2781 0x3D
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 #define W1_THERM_DS28EA00 0x42
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 #define MBSE_SS(x) (x)?(x):"(null)"
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85
443
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 441
diff changeset
86
6b80a37fdf8d Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents: 441
diff changeset
87
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
88 /*
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
89 * Sensor strcuture
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
90 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
91 typedef struct _sensor_var {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
92 char uuid[37]; /* sensor uuid */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
93 int state; /* sensor state */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
94 int value; /* sensor value */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
95 } sensor_var;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
96
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
97
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
98
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
99 /*
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
100 * Switch structure
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
101 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
102 typedef struct _switch_var {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
103 char uuid[37]; /* switch uuid */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
104 int value; /* switch value (0..100) */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
105 int delay; /* switch delay */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
106 } switch_var;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
107
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
108
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
109
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
110 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
111 * Brewing units. The sensors of the units are connected via the 1-wire bus.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
112 * The heaters, pumps (or mixer) are connected on the Pi GPIO. The hardware
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
113 * is configured in the devices lists.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
114 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
115 typedef struct _units_list {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
116 struct _units_list *next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
117 int version; /* Record version */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
118 char *uuid; /* uuid code */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
119 char *name; /* Unit name */
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
120 int number; /* Unit number */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
121 int active; /* 0/1 active unit */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
122 sensor_var *hlt_sensor; /* HLT sensor */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
123 switch_var *hlt_heater; /* HLT heater */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
124 int hlt_heater_mltfirst; /* HLT heater MLT high priority */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
125 sensor_var *mlt_sensor; /* MLT sensor */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
126 switch_var *mlt_heater; /* MLT heater */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
127 switch_var *mlt_pump; /* MLT pump */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
128 int pump_cycle; /* 5..15 minutes */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
129 int pump_rest; /* 1..5 minutes */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
130 int pump_premash; /* 0/1 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
131 int pump_onmash; /* 0/1 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
132 int pump_mashout; /* 0/1 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
133 int pump_onboil; /* 0/1 pump during boiling */
445
3ec477cda546 Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents: 444
diff changeset
134 float pump_stop; /* 80..105 C */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
135 int skip_add; /* 0/1 skip Add phase */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
136 int skip_remove; /* 0/1 skip Remove phase */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
137 int skip_iodine; /* 0/1 skip Iodine test */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
138 int iodine_time; /* 0..90 minutes */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
139 int whirlpool; /* off/cold/hot */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
140 pid_var *PID_hlt; /* HLT PID */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
141 pid_var *PID_mlt; /* MLT PID */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
142 } units_list;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
143
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
144
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
145
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
146 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
147 * External devices like sensors, relays, SSR.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
148 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
149 typedef struct _dev_list {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
150 struct _dev_list *next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
151 int version; /* Version 1 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
152 char *uuid; /* UUID of this device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
153 int type; /* Device type */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
154 int direction; /* Device direction */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
155 int value; /* Device value */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
156 int offset; /* Device offset value */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
157 int present; /* Device present */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
158 char *address; /* Device address */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
159 int subdevice; /* Device sub address */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
160 int gpiopin; /* Device GPIO pin or -1 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
161 char *description; /* Device description */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
162 int inuse; /* In use counter */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
163 char *comment; /* What we think it is */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
164 time_t timestamp; /* Last updated */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
165 } devices_list;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
166
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
167
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
168 #define DEVTYPE_NA 0 /* Unknown device type */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
169 #define DEVTYPE_W1 1 /* 1-Wire bus */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
170 #define DEVTYPE_GPIO 2 /* GPIO I/O device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
171 #define DEVTYPE_I2C 3 /* I2C bus device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
172 #define DEVTYPE_SPI 4 /* SPI bus device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
173 #ifdef USE_SIMULATOR
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
174 #define DEVTYPE_SIM 5 /* Simulated device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
175 #endif
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
176
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
177 #define DEVPRESENT_UNDEF 0 /* Precence not testable */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
178 #define DEVPRESENT_NO 1 /* Device is missing */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
179 #define DEVPRESENT_YES 2 /* Device is detected */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
180 #define DEVPRESENT_ERROR 3 /* Device is in error */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
181
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
182 #define DEVDIR_UNDEF 0 /* Undefined */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
183 #define DEVDIR_IN_BIN 1 /* Binary input */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
184 #define DEVDIR_OUT_BIN 2 /* Binary output */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
185 #define DEVDIR_IN_ANALOG 3 /* Temperature input etc. */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
186 #define DEVDIR_OUT_ANALOG 4 /* Analog steering */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
187 #define DEVDIR_OUT_PWM 5 /* PWM outout */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
188 #define DEVDIR_INTERN 6 /* Internal function */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
189
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
190
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
191
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
192 /*
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
193 * Recipes.
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
194 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
195 typedef struct _mash_step {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
196 char name[21]; /* Step name */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
197 int min; /* Minimum temperature */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
198 int max; /* Maximum temperature */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
199 int canskip; /* 0/1 can we skip this step */
445
3ec477cda546 Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents: 444
diff changeset
200 float setpoint; /* Temperature setpoint */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
201 int skip; /* Skip this step */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
202 int duration; /* Step duration */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
203 } mash_step;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
204
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
205 // mash-in 20 80 noskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
206 // fitasi 25 55 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
207 // glucanasi 35 50 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
208 // proteasi 45 60 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
209 // B-amilasi 50 70 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
210 // A-amilasi 1 60 76 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
211 // A-amilasi 2 60 76 noskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
212 // mash-out 75 80 noskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
213
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
214 typedef struct _hop_addition {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
215 char name[21]; /* Hop name */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
216 int boil_duration; /* -1=fwh, 0..boiltime */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
217 } hop_addition;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
218
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
219 typedef struct _a_recipe {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
220 char uuid[37]; /* Recipe uuid */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
221 char code[21]; /* Recipe code */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
222 char name[21]; /* Recipe name */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
223 mash_step mash[8]; /* 8 mash steps */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
224 hop_addition hops[10]; /* 10 hop additions */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
225 int boiltime; /* 1..240 minutes */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
226 time_t started; /* Start time */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
227 time_t endtime; /* Ending time */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
228 } a_recipe;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
229
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
230
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
231
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
232
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
233 #ifdef USE_SIMULATOR
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
234
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
235 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
236 * Simulate a HLT and MLT.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
237 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
238 typedef struct _simulator {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
239 double room_temperature; /* Simulated envionment temp */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
240 double hlt_temperature; /* Simulated HLT temperature */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
241 double hlt_heater_temp; /* Maximum heater temp */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
242 int hlt_heater_time; /* Time to reach temperature */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
243 float hlt_heater_size; /* Size of the heater */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
244 int hlt_heater_state; /* Heater status */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
245 double mlt_temperature; /* Simulated MLT temperature */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
246 double mlt_heater_temp; /* Maximum heater temp */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
247 int mlt_heater_time; /* Time to reach temperature */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
248 float mlt_heater_size; /* Size of the heater */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
249 int mlt_heater_state; /* Heater status */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
250 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
251 * Status values, maintained by the simulator but stored
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
252 * here so they don't get lost over program restarts.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
253 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
254 double s_hlt_temp; /* Temp HLT */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
255 double s_mlt_temp; /* Temp MLT */
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
256 } simulator_var;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
257
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
258 #endif
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
259
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
260
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
261
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 typedef struct _sys_config {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 char *name; /* Configuration name */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
264 int my_port; /* my client/server port */
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 unsigned char tempFormat; /* Temperature format, C or F */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
266 sensor_var *roomtemp; /* Environment temperature */
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 int lcd_cols; /* LCD display columns */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 int lcd_rows; /* LCD display rows */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 int lcd_address; /* LCD display i2c address */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
270 units_list *units; /* Brewing units */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
271 devices_list *devices; /* Sensors and switches */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
272 #ifdef USE_SIMULATOR
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
273 simulator_var *simulator; /* Simulator */
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 #endif
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 } sys_config;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
278
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
279 /*
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
280 * Brewing state file ~/.brewco/var/brewing.xml
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
281 * If present a brew session is running
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
282 */
444
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
283 #define STEP_NA 0 /* Not in any step yet */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
284 #define STEP_BREWINIT 1 /* Initialize brew */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
285 #define STEP_WAITSTART 2 /* Wait for starttime */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
286 #define STEP_PREMASH 3 /* Pre-mash */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
287 #define STEP_MASHING 4 /* Mash steps */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
288 #define STEP_IODINE 5 /* Iodine test */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
289 #define STEP_MASHREMOVE 6 /* Remove mash */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
290 #define STEP_PREBOIL 7 /* Heating before boil */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
291 #define STEP_BOILING 8 /* Boil */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
292 #define STEP_BOILDONE 9 /* Boil done, hopstand */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
293 #define STEP_COOLING 10 /* Cooling */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
294 #define STEP_WHIRLPOOL 11 /* Whirlpool */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
295 #define STEP_CLEANUP 12 /* Cleanup */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
296 #define STEP_BREWDONE 13 /* Final step */
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
297
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
298 #define MAISH_NA 0 /* Not in any state yet */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
299 #define MASIH_PROMPT 1 /* Prompt the user */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
300 #define MAISH_HEATING 2 /* Heating phase */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
301 #define MAISH_REST 3 /* Rest phase */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
302 #define MAISH_DONE 4 /* This step is done */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
303
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
304
444
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
305
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
306 typedef struct _brew_session {
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
307 char *uuid_recipe; /* Brewing this recipe */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
308 char *uuid_unit; /* Brewing unit */
444
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
309 int brewstep; /* Main steps */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
310 int mashstep; /* Mash step */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
311 int timeout; /* Generic time downcouner */
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
312 int boiltimer; /* Boiling downcount */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
313 time_t starttime; /* Start of brew */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
314 time_t endtime; /* End of brew */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
315 } brew_session;
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
316
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
317
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 #endif

mercurial