ESPNode
config.h
Go to the documentation of this file.
1 #ifndef _CONFIG_H_
2 #define _CONFIG_H_
3 
4 #include <Arduino.h>
5 
12 //#if ESP_IDF_VERSION_MAJOR == 5
13 // Hier wird der zu erzeugende Node aktiviert
14 // Achtung: Es darf nur ein Node ausgewählt werden!
15 //#define NODESIMPLE
16 //#define NODE18B20
17 //#define NODEBOSCH
18 //#define WITTYNODE
19 #define NODE_AUDIO
20 //#define NODE_TTGO_T_DISPLAY
21 
22 // meine produktiven Nodes
23 //#define NODE_WOHNZIMMER
24 //#define NODE_TERASSE
25 //#define NODE_TEICH
26 //#define NODE_FLUR
27 //#define NODE_KUECHENRADIO
28 //#define NODE_WOHNZIMMERRADIO
29 //---------------------------
30 // Ab hier werden Abhängigkeiten gesetzt.
31 // Die folgende Einstellungen müssen an die aktuelle Umgebung angepasst werden.
32 //---------------------------
33 // Change below to your requirements and infrastructure.
34 //---------------------------
35 #define SWVERSION "0.999 beta3"
36 // Network Time Protocoll
37 #define NTP_SERVER "de.pool.ntp.org"
38 #define TZ_INFO "CET-1CEST,M3.5.0/03,M10.5.0/03"
39 //#define TZ_INFO "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00"
40 //#define NTP_SERVER "th.pool.ntp.org"
41 //#define TZ_INFO "WIB-7"
42 // enter your time zone (https://remotemonitoringsystems.ca/time-zone-abbreviations.php)
43 
44 // MQTT Default Configuration
45 #define DEFAULT_MQTT_SERVER "rpi1.fritz.box"
46 
47 // RF24 Default Configuration
48 #define DEFAULT_RF24GW_HUB_SERVER "rpi1.fritz.box"
49 #define DEFAULT_RF24GW_HUB_UDP_PORTNO 7004
50 #define DEFAULT_RF24GW_GW_UDP_PORTNO 7003
51 
52 //---------------------------
53 // Ab hier werden Abhängigkeiten gesetzt. Normalerweise sollte ab hier nichts editiert werden, es sei denn....
54 // man weiss was man tut !!!!
55 //---------------------------
56 // No changes below - exept you know what are you doing !!!
57 //---------------------------
58 
59 // Globale Einstellungen für Sensoren, können in den Settings für jeden Node überschrieben werden.
60 #ifndef REFRESHTIME
64 #define REFRESHTIME 300
65 #endif
66 
67 #ifndef MEASUREDELAY
71 #define MEASUREDELAY 10
72 #endif
73 
74 #ifndef RESOLUTION_18B20
78 #define RESOLUTION_18B20 12
79 #endif
80 
81 #ifndef ONEWIREBUS
85 #define ONEWIREBUS 4
86 #endif
87 
88 #ifdef CONFIG_IDF_TARGET_ESP32S3
89 #ifndef ESP32
90 #define ESP32
91 #endif
92 #endif
93 #ifdef CONFIG_IDF_TARGET_ESP32
94 #ifndef ESP32
95 #define ESP32
96 #endif
97 #endif
98 
99 #include "Node_settings.h"
100 
101 // Hier werden die allgemeinen Parameter für den Einsatz festgelegt
102 // Alternativ können diese Einstellungen auch in der Konfiguration des Nodes
103 // festgelegt werden.
104 // Achtung: Die Festlegung hier kann für jeden Node überschrieben werden!
105 
106 #ifndef MAGICNO
111 #define MAGICNO 0
112 #endif
113 
115 #ifdef MODULE1_DEFINITION
116 #define MODULE1
117 #endif
118 #ifdef MODULE2_DEFINITION
119 #define MODULE2
120 #endif
121 #ifdef MODULE3_DEFINITION
122 #define MODULE3
123 #endif
124 #ifdef MODULE4_DEFINITION
125 #define MODULE4
126 #endif
127 #ifdef MODULE5_DEFINITION
128 #define MODULE5
129 #endif
130 #ifdef MODULE6_DEFINITION
131 #define MODULE6
132 #endif
133 
136 #ifdef DEBUG_SERIAL_MODULE
137 #define DEBUG_SERIAL
138 #endif
139 #ifdef DEBUG_SERIAL_RF24
140 #define DEBUG_SERIAL
141 #endif
142 #ifdef DEBUG_SERIAL_WEB
143 #define DEBUG_SERIAL
144 #endif
145 #ifdef DEBUG_SERIAL_MQTT
146 #define DEBUG_SERIAL
147 #endif
148 #ifdef DEBUG_SERIAL_MODULE
149 #define DEBUG_SERIAL
150 #endif
151 
153 #ifndef MQTT_SERVER
154 #define MQTT_SERVER DEFAULT_MQTT_SERVER
155 #endif
156 #ifdef MQTT_CLIENT
157 #define MQTT true
158 #ifndef MQTT_TOPICP2
159 #define MQTT_TOPICP2 MQTT_CLIENT
160 #endif
161 #endif
162 
164 #ifndef RF24GW_HUB_SERVER
165 #define RF24GW_HUB_SERVER DEFAULT_RF24GW_HUB_SERVER
166 #endif
167 #ifndef RF24GW_HUB_UDP_PORTNO
168 #define RF24GW_HUB_UDP_PORTNO DEFAULT_RF24GW_HUB_UDP_PORTNO
169 #endif
170 #ifndef RF24GW_GW_UDP_PORTNO
171 #define RF24GW_GW_UDP_PORTNO DEFAULT_RF24GW_GW_UDP_PORTNO
172 #endif
173 #ifdef RF24GW_NO
174 #define RF24GW true
175 #endif
176 
177 //Set a default hostname
178 #ifndef HOSTNAME
179 #define HOSTNAME "ESPNode"
180 #endif
181 
182 //Settings for Logging
183 #ifndef DO_LOG_WEB
184 #define DO_LOG_WEB false
185 #endif
186 #ifndef DO_LOG_MODULE
187 #define DO_LOG_MODULE false
188 #endif
189 #ifndef DO_LOG_SYSTEM
190 #define DO_LOG_SYSTEM false
191 #endif
192 #ifndef DO_LOG_MQTT
193 #define DO_LOG_MQTT false
194 #endif
195 #ifndef DO_LOG_RF24
196 #define DO_LOG_RF24 false
197 #endif
198 #ifndef DO_LOG_CRITICAL
199 #define DO_LOG_CRITICAL false
200 #endif
201 
204 #define TOPIC_PART1_SIZE 5
205 #define MQTT_STATUS "stat"
206 #define MQTT_TELEMETRIE "tele"
207 #define MQTT_COMMAND "cmnd"
208 
209 #define TOPIC_PART2_SIZE 30
210 #define TOPIC_PART3_SIZE 10
211 //Settings for QoS
212 #define MQTT_QOS 0
213 #define MQTT_WILLRETAIN true
214 
218 #ifndef STATINTERVAL
219 #define STATINTERVAL 300
220 #endif
221 
224 #ifndef MEASUREDELAY
225 #define MEASUREDELAY 10
226 #endif
227 
231 #ifndef TELEINTERVAL
232 #define TELEINTERVAL 1200
233 #endif
234 
238 #define LOOP_TIME_ALARM 1000
239 
240 #define DEBUGFILE "/debugfile.txt"
241 
243 #ifndef RF24_RADIO_CE_PIN
244 #define RF24_RADIO_CE_PIN 15
245 #endif
247 #ifndef RF24_RADIO_CSN_PIN
248 #define RF24_RADIO_CSN_PIN 16
249 #endif
251 #ifndef RF24_CHANNEL
252 #define RF24_CHANNEL 92
253 #endif
255 #ifndef RF24_SPEED
256 #define RF24_SPEED RF24_250KBPS
257 #endif
259 #ifndef RF24_HUB2NODE
260 #define RF24_HUB2NODE { 0xf0, 0xcc, 0xfc, 0xcc, 0xcc}
261 #endif
263 #ifndef RF24_NODE2HUB
264 #define RF24_NODE2HUB { 0x33, 0xcc, 0xfc, 0xcc, 0xcc}
265 #endif
267 #ifndef NODE_DATTYPE
268 #define NODE_DATTYPE uint8_t
269 #endif
271 #ifndef ONR_DATTYPE
272 #define ONR_DATTYPE uint8_t
273 #endif
274 
275 
278 typedef struct {
282  NODE_DATTYPE node_id;
285  uint8_t msg_id;
287  uint8_t msg_type;
289  uint8_t msg_flags;
294  ONR_DATTYPE orderno;
298  uint8_t heartbeatno;
300  uint8_t reserved1;
302  uint8_t reserved2;
304  uint32_t data1;
306  uint32_t data2;
308  uint32_t data3;
310  uint32_t data4;
312  uint32_t data5;
314  uint32_t data6;
315 } payload_t;
316 
317 
320 
321 typedef struct {
323  uint16_t gw_no; // the number of the sending gateway
325  payload_t payload; // the payload to send forward
327  time_t utime;
328 } udpdata_t;
329 
331 #ifndef LOG_RF24
332 #define LOG_RF24 0
333 #endif
334 #ifndef LOG_SYSTEM
335 #define LOG_SYSTEM 1
336 #endif
337 #ifndef LOG_MQTT
338 #define LOG_MQTT 2
339 #endif
340 #ifndef LOG_MODULE
341 #define LOG_MODULE 3
342 #endif
343 #ifndef LOG_WEB
344 #define LOG_WEB 4
345 #endif
346 #ifndef LOG_CRITICAL
347 #define LOG_CRITICAL 5
348 #endif
349 #ifndef LOG_DAYBREAK
350 #define LOG_DAYBREAK 6
351 #endif
352 
353 
354 #endif
Anschlusspin für den CE Pin des Funkmodules.
Definition: config.h:278
uint8_t reserved1
noch nicht genutzt
Definition: config.h:300
uint32_t data6
Datenpaket 6 (32Bit)
Definition: config.h:314
uint32_t data1
Datenpaket 1 (32Bit)
Definition: config.h:304
uint8_t msg_flags
Nachrichtenflag, Definition siehe Nachrichtenflags.
Definition: config.h:289
uint8_t msg_type
Art der Nachricht, Definition siehe Nachrichtentyp.
Definition: config.h:287
NODE_DATTYPE node_id
Definition: config.h:282
ONR_DATTYPE orderno
Definition: config.h:294
uint8_t heartbeatno
Definition: config.h:298
uint8_t reserved2
noch nicht genutzt
Definition: config.h:302
uint32_t data2
Datenpaket 2 (32Bit)
Definition: config.h:306
uint8_t msg_id
Definition: config.h:285
uint32_t data5
Datenpaket 5 (32Bit)
Definition: config.h:312
uint32_t data4
Datenpaket 4 (32Bit)
Definition: config.h:310
uint32_t data3
Datenpaket 3 (32Bit)
Definition: config.h:308
Die Datenstructur zur Übertragung der Daten zwischen Gateway und Hub Im Prinzig ebtspricht diese Stru...
Definition: config.h:321
uint16_t gw_no
Die eindeutige Gateway ID.
Definition: config.h:323
payload_t payload
Die Payloadstruktur wie unter payload_t definiert.
Definition: config.h:325
time_t utime
Der Unix Timestamp.
Definition: config.h:327