-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
460 lines (361 loc) · 13.6 KB
/
config.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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
/*----------------------------------------------------------------------------
Copyright: Radig Ulrich mailto: mail@ulrichradig.de
Author: Radig Ulrich
Remarks:
known Problems: none
Version: 03.11.2007
Description: Webserver Config-File
-----------------------------------------------------------------------------
Modifiziert für AVR-NET-IO von Pollin durch RoBue u.a.
**************************************************
*Achtung: Bitte alles hier sorgfaeltig durchlesen*
**************************************************
Grundidee: Konfiguration über EINE Datei (= config.h)
-----------------------------------------------------
- Taktfrequenz
- PORTS
- LCD
- Bezeichnungen für die Schaltausgänge (-> webpage.h)
- Netzwerkeinstellungen (MAC, IP. Subnet, Routing, NTP, WOL)
- 1-Wire-Sensoren (Anzahl, ID)
- ...
Rest lässt sich über UART/Telnet und Webpage konfigurieren
Konfiguration (vgl. main.c, httpd.c, webpage.h):
-----------------------------------------------
PORTA -> Eingabe (A0-3 digital, A4-6 analog, A7 1-Wire)
PORTB -> ENC-Netwerkcontroller (PB0 -> LCD)
PORTC -> Schaltausgaenge (z.B. Pollin Relaiskarte)
PORTD -> D0,1 -> UART, RS232, WebCam
D2-7 -> LCD (4-Bit Mode), Schaltausgaenge, Servo
PORTD ist fuer zusaetzliche "Spielereien" gedacht.
Dabei ist jedoch nicht alles zugleich möglich!
Standard-Beispiel-Konfiguration von config.h fuer V1.5:
------------------------------------------------------
UART/RS232 (PORTD0,1)
LCD im 4-Bit Mode an PORTD2-7, PORTB0 (= EXT-Port)
Temperaturmessung mit 5 Sensoren (DS1820)
- Raum_1
- Raum_2
- Aussen
- Zirkulationspumpe (Rücklauf, Vorlauf)
(Die IDs der Sensoren muessen in config.h. manuell eingegeben werden.
Es gibt bisher noch keine sinnvolle automatische Suchfunktion.
Platz ist fuer max. 8 Sensoren reserviert.)
Schaltfunktionen (vgl. main.c, httpd.c, webpage.h):
- PORTC0: Raum_1 abhaengig von Sensor 0
- PORTC1: Raum_2 abhaengig von Sensor 1 und Fenster offen/zu (PORTA1)
- PORTC4: Zirkulationspumpe mit Sensor 3,4
- PORTC6: Licht ein/aus abhaengig von LDR an PORTA6 (AD-Wert)
- PORTC7: Zeitschaltuhr
Erweiterungsmoeglichkeiten in V1.5 ueber config.h:
-------------------------------------------------
- minimal (nur Schaltfunktionen)
#define OUTC 0xFF
#define OUTD 0xFC
#define USE_PORTD_SCHALT 1
#define USE_SER_LCD 0
#define USE_OW 0
#define USE_AUTOMATIK 0
- WebCam
#define F_CPU 14745600UL
#define USE_CAM 1
#define CAM_RESELUTION 0
(UART/RS232 faellt automatisch weg)
- Servo (evtl. in Zusammenarbeit mit WebCam)
#define USE_SERVO 1
#define OUTD 0xFC
(PORTD7 wird benoetigt, d.h. kein LCD mehr moeglich)
#define USE_SER_LCD 0 (LCD im seriellen Mode geht)
#define USE_LCD_4Bit 0 (LCD im 4-Bit Mode geht auf keinen Fall!)
(Schaltfunktion fuer PORTD abschalten)
#define USE_PORTD_SCHALT 0
- PORTD2-7 fuer zusaetzliche Schaltfunktionen
#define USE_PORTD_SCHALT 1
#define OUTD 0xFC
(Kein LCD, kein Servo moeglich)
#define USE_SERVO 0
#define USE_SER_LCD 0
- SHT71-Sensor
#define USE_SHT 1
(In makefile bitte dann aendern:
# cni:
# Add LibSHT
SRC += sht/libsht.c
Braucht viel Platz!)
Natürlich sind auch andere Kombinationen möglich,
dies erfordert aber den Eingriff in andere Programmteile (Sourcen)
-> main.c, httpd.c, webpage.h.
Solche Änderungen sollten über sog. MOD-Files erfolgen,
die die vorhandenen Source-File durch entsprechend angepasste ersetzen.
Achtung:
Falls bestimmte Routinen gar nicht gebraucht werden (z.B. LCD, 1-Wire),
spart es Platz, diese auch in "makefile" zu deaktivieren ("#" davorsetzen).
Viel Spaß und Erfolg, RoBue
-----------------------------------------------------------------------------
Dieses Programm ist freie Software. Sie können es unter den Bedingungen der
GNU General Public License, wie von der Free Software Foundation veröffentlicht,
weitergeben und/oder modifizieren, entweder gemäß Version 2 der Lizenz oder
(nach Ihrer Option) jeder späteren Version.
Die Veröffentlichung dieses Programms erfolgt in der Hoffnung,
daß es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE,
sogar ohne die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT
FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
Programm erhalten haben.
Falls nicht, schreiben Sie an die Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
//Version
#define SoftVers "V1.0.99"
#define RoBueVers "Version 1.5 RoBue vom 18.02.2009"
#define Version "1.5"
// Konfiguration des Systems
// -------------------------
//Taktfrequenz (bei AVR-NET-IO i.d.R. 16MHz
#define F_CPU 16000000UL
//#define F_CPU 14745600UL
//#define F_CPU 11059200UL
//Timertakt intern oder extern
#define EXTCLOCK 0 //0=Intern 1=Externer Uhrenquarz
//Baudrate der seriellen Schnittstelle
#define BAUDRATE 9600
// define BAUDRATE 19200 // -> Handy Siemens C35i
// PORTS (HEX) (1=OUTPUT / 0=INPUT)
// --------------------------------
// PORTA: 0-3 -> dig. input, 4-6 -> analog. input, 7 - 1-Wire
// (PORTA4-7 ist mit blauen Schraubklemmen verbunden)
#define OUTA 0x00
//PORTB -> ENC-Netzwerkkontroller
//nur ändern wenn man weiß was man macht!
// PORTC: Schaltausgaenge
#define OUTC 0xFF
// PoRTD: 0,1 -> UART, 2-7 Schaltausgänge
// PORTD2-7 als zusaetzliche Schaltausgaenge
// Das bedeutet: #define USE_SER_LCD 0 (Kein LCD!)
#define USE_PORTD_SCHALT 0
// Fuer LCD, Schaltausgaenge, Servo:
#define OUTD 0xFC
//AD-Wandler benutzen?
#define USE_ADC 1
// LCD Einstellungen (-> PORTD)
// -----------------
// LCD ja/nein
#define USE_SER_LCD 0
// LCD im 4Bit Mode oder seriell
// Das bedeutet:
// #define USE_PORTD_SCHALT 0 (PORTD kein Schaltausgang!)
// #define USE_SERVO 0 (Kein Servo an PORTD7!)
#define USE_LCD_4Bit 1
// LCD im 4-Bit: 1 1; LCD seriell: 1 0
//Anzahl der Zeilen 1,2 oder 4
//#define ONE_LINES
//#define TWO_LINES
//#define THREE_LINES
#define FOUR_LINES
//LCD-Belegung im seriellen Modus (PORTD2-4):
//LCD_DATA_ENABLE -> PORTD2
//LCD_DATA -> PORTD3
//LCD_CLOCK -> PORTD4
//LCD-Belegung 4-Bit-Modus (PORTD, EXT):
//EXT LCD PORT
// 9 --> Pin 1 GND
//10 --> Pin 2 +5V
// 1 --> Pin 4 RS PORTD2
// 2 --> Pin 5 RW PORTD3
// 7 --> Pin 6 E PORTB0
//GND --> Pin 7
//GND --> Pin 8
//GND --> Pin 9
//GND --> Pin 10
// 3 --> Pin 11 DB4 PORTD4
// 4 --> Pin 12 DB5 PORTD5
// 5 --> Pin 13 DB6 PORTD6
// 6 --> Pin 14 DB7 PORTD7
// 8 --> Hintergrundbeleuchtung
// Einstellungen zur Ausgabe -> main.c
// Welche Sensoren:
#define TEMPWERT1 0 // Raum_1
#define TEMPWERT2 1 // Raum_2
#define TEMPWERT3 3 // Pumpe VL
#define TEMPWERT4 4 // Pumpe RL
// Was erscheint in der 4.Zeile:
// Nur alternativ moeglich !!!
#define LCD_ZEILE3_TEMP 0 // 1 -> TEMPWERT3+4
#define LCD_ZEILE3_PORTC 1 // 1 -> Status/Pins PORTC
#define LCD_ZEILE3_SHT 0 // 1 -> SHT71-Ausgabe
// Namen für die dig. Eingänge (PORTA0-3) -> webpage.h
// ---------------------------------------------------
#define Eing_A0 "Schaltschrank"
#define Eing_A1 "Unbelegt 1"
#define Eing_A2 "Unbelegt 2"
#define Eing_A3 "Unbelegt 3"
// Namen für die analogen Eingänge -> webpage.h
// ---------------------------------------------------
#define Eing_ADC1 "Netzteil"
#define Eing_ADC2 "Funkruf"
#define Eing_ADC3 "APRS"
// Namen für die Schaltausgänge -> webpage.h (abhängig von LCD)
// -----------------------------------------
// Zuordnung der Aufgaben von PORTC0-7 -> webpage.h
// Achtung: Kein LCD an PORTC anschließen! Beschädigung möglich.
#define Ausg_C0 "Strom 12V APRS"
#define Ausg_C1 "Strom 12V Funkruf"
#define Ausg_C2 "Linux PC Reset"
#define Ausg_C3 "Linux PC On/Off"
#define Ausg_C4 "Ausgang 4"
#define Ausg_C5 "Ausgang 5"
#define Ausg_C6 "Ausgang 6"
#define Ausg_C7 "Ausgang 7"
// Netzwerkeinstellungen
// ---------------------
//ETH_M32_EX (www.ulrichradig.de)
#define USE_ENC28J60 1
//Holger Buss (www.mikrocontroller.com) Mega32-Board
#define USE_RTL8019 0
//IP des Webservers
#define MYIP IP(44,225,56,198)
//Netzwerkmaske
#define NETMASK IP(255,255,255,224)
//IP des Routers
#define ROUTER_IP IP(44,225,56,193)
//IP des NTP-Servers z.B. Server 1.de.pool.ntp.org
#define USE_NTP 1 // 1= NTP Client on
#define NTP_IP IP(44,225,56,193)
//Broadcast-Adresse für WOL
#define USE_WOL 0 //1 = WOL on
#define WOL_BCAST_IP IP(192,168,0,255)
#define WOL_MAC {0x00,0x1A,0xA0,0x9C,0xC6,0x0A}
//MAC Adresse des Webservers
#define MYMAC1 0x00
#define MYMAC2 0x22
#define MYMAC3 0xF9
#define MYMAC4 0x01
#define MYMAC5 0xAC
#define MYMAC6 0xF3
//Umrechnung von IP zu unsigned long
#define IP(a,b,c,d) ((unsigned long)(d)<<24)+((unsigned long)(c)<<16)+((unsigned long)(b)<<8)+a
//Webserver mit Passwort? (0 == mit Passwort)
#define HTTP_AUTH_DEFAULT 0
//AUTH String "USERNAME:PASSWORT" max 14Zeichen
//für Username:Passwort
#define HTTP_AUTH_STRING "admin:password"
// 1-Wire-Einstellungen
// --------------------
// Konzipiert fuer 8 Sensoren, auch wenn weniger genutzt werden.
// In webpage.h sind z.Z. nur Eintraege fuer 4 vorhanden.
// 1-Wire ja/nein (0=nein, 1=ja)
#define USE_OW 0
// max. Anzahl der Sensoren
#define MAXSENSORS 8
// z.Z. nur EIN 1-Wire-Bus
#define OW_ONE_BUS 1
// Länge der ID (rom-code) des Sensors incl. CRC
#define OW_ROMCODE_SIZE 8
// Port fuer 1-Wire
#define OW_PIN PA7
#define OW_IN PINA
#define OW_OUT PORTA
#define OW_DDR DDRA
// ROM-IDs der DS1820 müssen "per Hand" eingetragen werden!
// Damit kann man am leichtesten einem Sensor eine Aufgabe zuordnen.
// Die IDs kann man mit dem Flash-File "sensoren.hex" ermitteln.
#define OW_ID_T01 {0x10,0x7a,0x8c,0x48,0x01,0x08,0x00,0x67}
#define OW_ID_T02 {0x10,0x44,0x9e,0x53,0x01,0x08,0x00,0xca}
#define OW_ID_T03 {0x10,0x02,0xaF,0x53,0x01,0x08,0x00,0x44}
#define OW_ID_T04 {0x10,0x9e,0x7d,0x98,0x01,0x08,0x00,0xf8}
#define OW_ID_T05 {0x10,0x00,0x6c,0x98,0x01,0x08,0x00,0xeb}
#define OW_ID_T06 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // leer
#define OW_ID_T07 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // leer
#define OW_ID_T08 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // leer
#define OW_ID_Last {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
// Startwerte in ow_array
#define OW_START 150
#define OW_MINMAX 0
// Entsprechende Ortszuweisung für die Sensoren fuer webpage.h:
#define T00 "Raum_1"
#define T01 "Raum_2"
#define T02 "Aussen"
#define T03 "Pumpe VL"
#define T04 "Pumpe RL"
#define T05 "Reserve"
#define T06 "Reserve"
#define T07 "Reserve"
// cni
// SHT Sensor einbinden
// --------------------
//
// In makefile bitte dann aendern bzw. aktivieren:
// # cni:
// # Add LibSHT
// SRC += sht/libsht.c
//
// Braucht viel Platz!!!
//
// 2 Versionen:
// - Version an PORTD5,6 wird hier in config.h konfiguriert
// - Version an PORTA5,6 wird über eigene MOD-Files eingebunden
#define USE_SHT 0
// SHT SCK and DATA Port and Pin definitions
#define SHT_SCK_PORT PORTD
#define SHT_SCK_DDR DDRD
#define SHT_SCK_PIN PD5
#define SHT_DATA_PORT PORTD
#define SHT_DATA_DDR DDRD
#define SHT_DATA_PORT_PIN PIND
#define SHT_DATA_PIN PD6
// Kamera und Servo mit einbinden
// ------------------------------
//Achtung: Kamera arbeitet nur mit einem 14,7456Mhz Quarz!
#define USE_CAM 0
//In cam.c können weitere Parameter eingestellt werde
//z.B. Licht, Kompression usw.
//Auflösungen
//0 = 160x120 Pixel kürzer (zum testen OK ;-)
//1 = 320x240 Pixel ca. 10 Sek. bei einem Mega644
//2 = 640x480 Pixel länger (dauert zu lang!)
#define CAM_RESELUTION 0
#define USE_SERVO 0
// Das bedeutet:
// #define USE_SER_LCD 0 (LCD im seriellen Mode geht evtl.)
// #define USE_LCD_4Bit 0 (LCD im 4-Bit Mode geht auf keinen Fall!)
// #define USE_PORTD_SCHALT 0 (PORTD geht nicht zum Schalten)
//
// Weitere Einstellungen Servo (varrieren je nach Hersteller leicht):
#define SERVO_MIN 14 // linker Anschlag
#define SERVO_MAX 36 // rechter Anschlag
// Rest
// ----
// Schaltautomatik installieren (-> main.c, httpd.c, webpage.h)
#define USE_AUTOMATIK 0
// Feuchtesensor HIH4000 (experimentell)
#define USE_HIH4000 0
#define VA_IN_HIH4000 4
#define VA_OUT_HIH4000 24
//Emailversand benutzen? Konfiguration des
//Emailclient in der Sendmail.h
#define USE_MAIL 0
//Empfang von Wetterdaten auf der Console (über HTTP_GET)
#define GET_WEATHER 0
// Lokale Wetterdaten
#define WETTER24 0
#define LOCALWEATHER24 "http://www.wetter24.de/nc/de/home/wetter/weltwetter/ortewetter.html?cityID=49X7241&type=98"
//Commandos und Ausgaben erfolgen über Telnet
//UART/RS232 geht dann nicht mehr!
#define CMD_TELNET 0
#define MAX_VAR_ARRAY 30 // ursprünglich 10
// RoBue:
// Variablen-Array
// zum Abspeichern verschiedener Werte
// und zum Einfügen in die Webseite %VA@00 bis %VA@29
// VA0-3 -> ??? / SHT71
// VA4-7 -> Analogwert von PORTA4-7
// VA8 -> Reserve (Servo-Position)
// VA9 -> Schaltautomatik ein/aus
// VA10-17 -> Schalttemperaturen
// VA18,19 -> Schaltwert analog
// VA20-23 -> Schaltzeiten ein/aus hh,mm,hh,mm
// VA24-28 -> Reserve / HIH4000
// VA-Ende -> Counter
#endif //_CONFIG_H