This repository was archived by the owner on Apr 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathESP_BaPoTeSta.h
More file actions
138 lines (116 loc) · 2.68 KB
/
ESP_BaPoTeSta.h
File metadata and controls
138 lines (116 loc) · 2.68 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
enum sensorType {
TEMP,
BATTERY,
HUMIDITY,
TIME,
TEMPHI,
PRESSURE,
PRESSUREASL,
WIFIRSSI
};
const char* sensorTypeName[] = {
"temp",
"battery",
"humidity",
"time",
"tempHI",
"pressure",
"pressureASL",
"wifiRSSI"
};
enum unitType {
CENT_DEGC,
PERCENT,
RAW,
MVOLT,
USEC,
CENT_PERC,
PASCAL,
DBM
};
const char* unitTypeName[] = {
"centdegc",
"percent",
"raw",
"millivolt",
"microsec",
"centpercent",
"pascal",
"dbm"
};
struct sensorMeasurement {
unsigned int sensorId;
enum sensorType type;
int value;
enum unitType unit;
};
struct allMeasurements {
unsigned long int chipId;
unsigned int timestep;
byte nrMeasurements;
struct sensorMeasurement * sensorMeasurements;
};
struct config {
byte cfgversion = 5;
char ssid[32] = "tabr.org";
char password[32] = "";
IPAddress ip = {10, 1, 0, 38};
byte netmask = 24;
IPAddress gw = {10, 1, 0, 1};
IPAddress mqttip = {10, 1, 0, 9};
unsigned int mqttport = 1883;
bool usedallas = true;
byte dallasres = 12;
float biasDallasTemp = 0.0;
bool dallaswait = false;
bool usedht = true;
byte dhttype = DHT22;
float biasDHTTemp = 0.0;
float biasDHTHumid = 0.0;
bool dhthi = true;
bool battery = true;
bool battraw = false;
bool doperf = true;
bool perfraw = false;
bool dowifi = true; // send WiFi RSSI?
bool usebmp280 = true;
byte bmp280addr = 0x76; // 0 or 0x77 for SDO=HIGH, 0x76 for SDO=LOW
bool bmppress = true; // calculate pressure at current height?
bool bmpslp = true; // calculate pressure at sea level?
int16_t heightASL = 450; // height above sea level (meter)
unsigned int deltat = 300;
int8_t pinblue = -1;
bool invblue = true;
byte pinconfig = 4;
byte pinpwrsens = 13;
byte pindallas = 5;
byte pindhtdata = 2;
byte pini2cscl = 14;
byte pini2csda = 12;
byte adcmeas = 5;
float battdiv = 10.0/66;
};
void sendTemp(float temp);
int readADC();
void getBattery();
float calcBattery(int raw);
void bubbleSort(float * analogValues, int nr);
void bubbleSort(int * analogValues, int nr);
void gotoSleep(unsigned int seconds);
void collectData();
void getDallas();
void getDHT();
void getPerf();
void addData(unsigned int sensorId, enum sensorType type,
int value, enum unitType unit);
void sendData();
void powerSensors(bool on);
void setupNormal();
void setupWebserver();
String ipToString (IPAddress ip);
IPAddress stringToIP (String text);
void webForm();
void webCSS();
void getConfig();
void storeConfig();
void debugPrint(String msg);