brewco/brewco.h

Tue, 15 Dec 2015 23:11:42 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 15 Dec 2015 23:11:42 +0100
changeset 459
1f88be70f253
parent 457
24a34b7a693d
child 463
a1da58215b65
permissions
-rw-r--r--

Added the beginning of the recipes editor. Added load and save of recipes file.

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>
447
b48368855ec4 Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 445
diff changeset
35 #include <zlib.h>
b48368855ec4 Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 445
diff changeset
36
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
37
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 #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
39 #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
40 #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
41 #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
42 #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
43 #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
44 #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
45
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 #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
47 /* 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
48 #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
49 #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
50 #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
51
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 * 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
54 */
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_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
56 #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
57 #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
58 #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
59
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 #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
62
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 * 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
65 */
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_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
67 #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
68 #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
69 #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
70 #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
71 #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
72 #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
73 #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
74 #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
75 #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
76 #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
77 #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
78 #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
79 #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
80 #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
81 #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
82 #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
83
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 #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
86
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
87
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
88
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
89
435
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 * Sensor strcuture
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
92 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
93 typedef struct _sensor_var {
449
1277fb94999f Added selecting sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 447
diff changeset
94 char *uuid; /* sensor uuid */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
95 int state; /* sensor state */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
96 int value; /* sensor value */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
97 } sensor_var;
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
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 * Switch structure
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
103 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
104 typedef struct _switch_var {
450
8fe99759c27f Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
105 char *uuid; /* switch uuid */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
106 int value; /* switch value (0..100) */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
107 int delay; /* switch delay */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
108 } switch_var;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
109
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
110
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
111
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
112 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
113 * 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
114 * 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
115 * is configured in the devices lists.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
116 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
117 typedef struct _units_list {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
118 struct _units_list *next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
119 int version; /* Record version */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
120 char *uuid; /* uuid code */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
121 char *name; /* Unit name */
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
122 int number; /* Unit number */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
123 int active; /* 0/1 active unit */
449
1277fb94999f Added selecting sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 447
diff changeset
124 sensor_var hlt_sensor; /* HLT sensor */
450
8fe99759c27f Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
125 switch_var hlt_heater; /* HLT heater */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
126 int hlt_heater_mltfirst; /* HLT heater MLT high priority */
449
1277fb94999f Added selecting sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 447
diff changeset
127 sensor_var mlt_sensor; /* MLT sensor */
450
8fe99759c27f Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
128 switch_var mlt_heater; /* MLT heater */
8fe99759c27f Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents: 449
diff changeset
129 switch_var mlt_pump; /* MLT pump */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
130 int pump_cycle; /* 5..15 minutes */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
131 int pump_rest; /* 1..5 minutes */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
132 int pump_premash; /* 0/1 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
133 int pump_onmash; /* 0/1 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
134 int pump_mashout; /* 0/1 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
135 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
136 float pump_stop; /* 80..105 C */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
137 int skip_add; /* 0/1 skip Add phase */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
138 int skip_remove; /* 0/1 skip Remove phase */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
139 int skip_iodine; /* 0/1 skip Iodine test */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
140 int iodine_time; /* 0..90 minutes */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
141 int whirlpool; /* off/cold/hot */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
142 pid_var *PID_hlt; /* HLT PID */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
143 pid_var *PID_mlt; /* MLT PID */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
144 } units_list;
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
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 * External devices like sensors, relays, SSR.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
150 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
151 typedef struct _dev_list {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
152 struct _dev_list *next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
153 int version; /* Version 1 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
154 char *uuid; /* UUID of this device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
155 int type; /* Device type */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
156 int direction; /* Device direction */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
157 int value; /* Device value */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
158 int offset; /* Device offset value */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
159 int present; /* Device present */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
160 char *address; /* Device address */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
161 int subdevice; /* Device sub address */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
162 int gpiopin; /* Device GPIO pin or -1 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
163 char *description; /* Device description */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
164 int inuse; /* In use counter */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
165 char *comment; /* What we think it is */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
166 time_t timestamp; /* Last updated */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
167 } devices_list;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
168
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
169
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
170 #define DEVTYPE_NA 0 /* Unknown device type */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
171 #define DEVTYPE_W1 1 /* 1-Wire bus */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
172 #define DEVTYPE_GPIO 2 /* GPIO I/O device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
173 #define DEVTYPE_I2C 3 /* I2C bus device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
174 #define DEVTYPE_SPI 4 /* SPI bus device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
175 #ifdef USE_SIMULATOR
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
176 #define DEVTYPE_SIM 5 /* Simulated device */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
177 #endif
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
178
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
179 #define DEVPRESENT_UNDEF 0 /* Precence not testable */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
180 #define DEVPRESENT_NO 1 /* Device is missing */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
181 #define DEVPRESENT_YES 2 /* Device is detected */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
182 #define DEVPRESENT_ERROR 3 /* Device is in error */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
183
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
184 #define DEVDIR_UNDEF 0 /* Undefined */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
185 #define DEVDIR_IN_BIN 1 /* Binary input */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
186 #define DEVDIR_OUT_BIN 2 /* Binary output */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
187 #define DEVDIR_IN_ANALOG 3 /* Temperature input etc. */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
188 #define DEVDIR_OUT_ANALOG 4 /* Analog steering */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
189 #define DEVDIR_OUT_PWM 5 /* PWM outout */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
190 #define DEVDIR_INTERN 6 /* Internal function */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
191
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
192
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
193
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 * Recipes.
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
196 */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
197 typedef struct _mash_step {
459
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
198 char *name; /* Step name */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
199 int min; /* Minimum temperature */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
200 int max; /* Maximum temperature */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
201 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
202 float setpoint; /* Temperature setpoint */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
203 int skip; /* Skip this step */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
204 int duration; /* Step duration */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
205 } mash_step;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
206
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
207 // mash-in 20 80 noskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
208 // fitasi 25 55 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
209 // glucanasi 35 50 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
210 // proteasi 45 60 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
211 // B-amilasi 50 70 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
212 // A-amilasi 1 60 76 canskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
213 // A-amilasi 2 60 76 noskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
214 // mash-out 75 80 noskip
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
215
457
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
216 typedef struct _hop_stand {
459
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
217 char *name; /* Hop stand name */
457
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
218 int min; /* Minimum temperature */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
219 int max; /* Maximum temperature */
459
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
220 int hold; /* Hold temperature at */
457
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
221 float setpoint; /* Hold temperature setpoint */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
222 int skip; /* Skip this one */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
223 int duration; /* Hold time */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
224 } hop_stand;
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
225
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
226 typedef struct _hop_addition {
459
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
227 char *name; /* Hop name */
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
228 int boiltime; /* -1=fwh, 0..boiltime */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
229 } hop_addition;
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 typedef struct _a_recipe {
459
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
232 struct _a_recipe *next;
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
233 char *uuid; /* Recipe uuid */
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
234 char *code; /* Recipe code */
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
235 char *name; /* Recipe name */
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
236 int boiltime; /* 1..240 minutes */
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
237 time_t starttime; /* Start time */
1f88be70f253 Added the beginning of the recipes editor. Added load and save of recipes file.
Michiel Broek <mbroek@mbse.eu>
parents: 457
diff changeset
238 time_t endtime; /* Ending time */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
239 mash_step mash[8]; /* 8 mash steps */
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
240 hop_addition hops[10]; /* 10 hop additions */
457
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
241 hop_stand hopstand[3]; /* 3 hopstand slots */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
242 } a_recipe;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
243
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
244
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
245
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
246
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
247 #ifdef USE_SIMULATOR
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
248
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
249 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
250 * Simulate a HLT and MLT.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
251 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
252 typedef struct _simulator {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
253 double room_temperature; /* Simulated envionment temp */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
254 double hlt_temperature; /* Simulated HLT temperature */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
255 double hlt_heater_temp; /* Maximum heater temp */
455
f84501d8dd87 Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
256 int hlt_heater_volume; /* Water volume */
f84501d8dd87 Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
257 int hlt_heater_power; /* Power of the heater */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
258 int hlt_heater_state; /* Heater status */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
259 double mlt_temperature; /* Simulated MLT temperature */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
260 double mlt_heater_temp; /* Maximum heater temp */
455
f84501d8dd87 Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
261 int mlt_heater_volume; /* Water volume */
f84501d8dd87 Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents: 450
diff changeset
262 int mlt_heater_power; /* Power of the heater */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
263 int mlt_heater_state; /* Heater status */
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
264 } simulator_var;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
265
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
266 #endif
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
267
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
268
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
269
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
270 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
271 char *name; /* Configuration name */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
272 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
273 unsigned char tempFormat; /* Temperature format, C or F */
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
274 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
275 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
276 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
277 int lcd_address; /* LCD display i2c address */
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
278 units_list *units; /* Brewing units */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
279 devices_list *devices; /* Sensors and switches */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
280 #ifdef USE_SIMULATOR
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
281 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
282 #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
283 } 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
284
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
285
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 410
diff changeset
286
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
287 /*
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
288 * Brewing state file ~/.brewco/var/brewing.xml
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
289 * If present a brew session is running
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
290 */
444
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
291 #define STEP_NA 0 /* Not in any step yet */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
292 #define STEP_BREWINIT 1 /* Initialize brew */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
293 #define STEP_WAITSTART 2 /* Wait for starttime */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
294 #define STEP_PREMASH 3 /* Pre-mash */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
295 #define STEP_MASHING 4 /* Mash steps */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
296 #define STEP_IODINE 5 /* Iodine test */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
297 #define STEP_MASHREMOVE 6 /* Remove mash */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
298 #define STEP_PREBOIL 7 /* Heating before boil */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
299 #define STEP_BOILING 8 /* Boil */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
300 #define STEP_BOILDONE 9 /* Boil done, hopstand */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
301 #define STEP_COOLING 10 /* Cooling */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
302 #define STEP_WHIRLPOOL 11 /* Whirlpool */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
303 #define STEP_CLEANUP 12 /* Cleanup */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
304 #define STEP_BREWDONE 13 /* Final step */
457
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
305 #define STEP_HOPSTAND1 14 /* Hopstand 88..100 */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
306 #define STEP_HOPSTAND2 15 /* Hopstand 71..77 */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
307 #define STEP_HOPSTAND3 16 /* Hopstand 60..66 */
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
308
457
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
309 #define MASH_NA 0 /* Not in any state yet */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
310 #define MASH_PROMPT 1 /* Prompt the user */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
311 #define MASH_HEATING 2 /* Heating phase */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
312 #define MASH_REST 3 /* Rest phase */
24a34b7a693d Updated configuration to allow hopstands.
Michiel Broek <mbroek@mbse.eu>
parents: 455
diff changeset
313 #define MASH_DONE 4 /* This step is done */
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
314
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
315
444
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
316
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
317 typedef struct _brew_session {
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
318 char *uuid_recipe; /* Brewing this recipe */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
319 char *uuid_unit; /* Brewing unit */
444
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
320 int brewstep; /* Main steps */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
321 int mashstep; /* Mash step */
eafb140a1ddd Better brew state field names.
Michiel Broek <mbroek@mbse.eu>
parents: 443
diff changeset
322 int timeout; /* Generic time downcouner */
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
323 int boiltimer; /* Boiling downcount */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
324 time_t starttime; /* Start of brew */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
325 time_t endtime; /* End of brew */
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
326 } brew_session;
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
327
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
328
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
329 #endif

mercurial