forked from andypugh/ESP-Heat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.h
106 lines (95 loc) · 3.07 KB
/
globals.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Defaut Pin States. 0 out o=low, 1 out high, i input, x ignore
// 111111111122222222222333333333
// 0123456789012345678901234567890123456789
char pins[41] = "1xix11xxxxxx1i111111xxxxx111xxxxi1iiixxi";
struct DS18B20 {
char channel = -1; // DS482 channel number -1 indicates temp over IP.
DeviceAddress address; // DS18B20 ROM address
char str_address[17];
char dot_address[25];
};
struct zone {
int state;
long hours; // bit field. 0 = 00:00 to 01:00 ... 23 = 23:00 to 00:00. 24 = manual-on, 25 = manual-off
byte on_temp;
byte off_temp;
float temp;
byte in_pin = -1;
byte out_pin;
bool default_state;
DS18B20 sensor;
char name[20];
char shape[50]; // room shape
int middle; // room legend positions
int top;
int bottom;
time_t timeout;
};
struct pump {
int state;
int mask;
int out_pin;
int run_on_mask;
};
struct boiler {
int state;
int mask;
int out_pin;
unsigned long run_on_timer;
DS18B20 f_sensor;
DS18B20 r_sensor;
float f_temp;
float r_temp;
};
zone zones[max_zones];
pump pumps[max_pumps];
boiler boilers[max_boilers];
DS18B20 all_sensors[max_sensors]; // array of found sensors
// Some initial defaults
int num_zones = 5;
int num_pumps = 3;
int num_boilers = 1;
int num_sensors = 0; // sensors are discovered
int units = 0; // Set to 1 for Fahrenheit
int ds2482_reset = 15;
// GPIO Pins
//int boiler_out[max_boilers] = {33};
//int zone_out[max_zones] = {25, 26, 27, 14, 19}; // and 16
//int zone_in[max_zones] = {36, 39, 34, 35, 32}; // and 13
//int pump_out[max_pumps] = {4, 5, 12}; // and 17, 18
//bool default_state[max_zones] = {0, 0, 0, 1, 0};
//For each pump the pump mask is AND-ed with the active zone bitfield. Non-zero turns on the pump
//int pump_mask[max_pumps] = {0x01, 0x06, 0x18};
//For each pump the pump mask is AND-ed with the boiler run-on bitfield. Non-zero turns on the pump
//int run_on_mask[max_pumps] = {0x0, 0x0, 0x1};
//For each boiler the pump mask is AND-ed with the active zone bitfield. Non-zero turns on the pump
//int boiler_mask[max_boilers] = {0x1F};
char* ext_ip[16];
unsigned long valve_timeout[max_zones];
//int valve[max_zones] = {0}; // valve status
//long zone[max_zones] = {0}; // bit field. 0 = 00:00 to 01:00 ... 23 = 23:00 to 00:00. 24 = manual-on, 25 = manual-off
int zone_on; // bitfield
int pump_on; // bitfield
int boiler_on; // bit field
int run_on; // bit-field
//byte on_temp[max_zones]; // temperature * 2
//byte off_temp[max_zones];
//float temp[max_zones];
//int run_on_timer[max_boilers];
byte counter[4] = {0}; // up/down arrow accelleration
struct tm timeinfo;
char buffer[200];
//Network credentials
char ssid[33] = "ssid";
char password[33] = "password";
char error_subject[33] = "Heating Fault Detected";
char error_email[33] = "None";
char error_recipient[33] = "[email protected]";
char error_password[33] = "password";
char smtp_server[33] = "mail.mail.com";
int smtp_port = 465;
char http_user[33] = "admin";
char http_pass[33] = "admin";
char hostname[33] = "heating";
char ntpServer[33] = "pool.ntp.org";
char TZstr[33] = "GMT0BST,M3.3.0/1,M10.5.0";