-
Notifications
You must be signed in to change notification settings - Fork 15
/
cfg_basic.h
571 lines (465 loc) · 16.9 KB
/
cfg_basic.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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
#pragma once
#include <Arduino.h>
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Old releases of Arduino IDE can do not processing some compiler options and throw error compilation.
Release 1.6.11 is okay.
Go to NETWORK MODULE SECTION, that placed below to change local address / subnet / gateway
!!! ENC28J60 users !!!
1. Please do not try to use 3.3V from Arduino board pin if you do not sure that it provide sufficient power.
The likelihood of getting problems tends to 100%. Use additional external power source.
2. Leave as much free memory as possible. If Arduino IDE show to you "Low memory available, stability problems may occur", it
means that the chances of sudden and unpredictable hang your device are large.
3. Sometime ENC28J60's RX buffer or configuration registry have corrupt and network module stops network processing. But Arduino board
still live and make blink by State LED. Zabbuino will try detect this case and fix the problem.
4. When (1) & (2) & (3) did not help to add stability, you can buy Wiznet 5xxx shield or rewrite the source code.
>>> NOTE that network drivers (UIPEthernet & WIZNet libs) are integrated to Zabbuino source code <<<
*/
#define NETWORK_ETHERNET_W5100 // Arduino Ethernet Shield and Compatibles ...
//#define NETWORK_ETHERNET_ENC28J60 // Microchip __ENC28J60__ network modules
//#define NETWORK_ETHERNET_W5500 // WIZ550io, ioShield series of WIZnet, tested but not satisfied with the performance on intensive traffic
//#define NETWORK_SERIAL_INTERFACE // not implemented yet
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PROGRAMM FEATURES SECTION
Comment #define's below to save RAM and Flash and uncomment to enable some feature
*/
/**** New ****/
//
// Obtain an IP-address using DHCP
//
// Note: Do not forget to enable UDP prototol support for network module driver.
//
//#define FEATURE_NET_DHCP_ENABLE
//
// Force obtain IP-address using DHCP even netConfig.useDHCP = false
//
//#define FEATURE_NET_DHCP_FORCE
//
// MCU ID (in HEX) used as hostname, and last byte of MCU ID as IP's 4-th octet, and last 3 byte as MAC`s NIC speciific part (4,5,6 octets)
//
// Note: Unique MCU ID defined for ATMega328PB and can not exist on other MCU's (but seems that it exists on my ATMega328P).
// You need try to read it before use for network addresses generating.
// Using only 3 last bytes not guarantee making unique MAC or IP.
//
//#define FEATURE_NET_USE_MCUID
/**** Arduino wrappers ****/
// Enable commands:
// - analogWrite[];
// - digitalWrite[]
// - analogRead[];
// - digitalRead[]
// - delay[]
//
//
#define FEATURE_ARDUINO_BASIC_ENABLE
//
// Enable commands:
// - Tone[];
// - NoTone[]
//
//
//#define FEATURE_TONE_ENABLE
//
// Enable commands:
// - RandomSeed[];
// - Random[]
//
//#define FEATURE_RANDOM_ENABLE
//
// Enable command:
// - ShiftOut[]
//
//#define FEATURE_SHIFTOUT_ENABLE
/**** Interrupts related ****/
//
// Enable external interrupts handling and commands:
// - ExtInt.Count[]
//
//#define FEATURE_EXTERNAL_INTERRUPT_ENABLE
//
// Handle incremental encoder that connected to interrupt-pin and enable command:
// - IncEnc.Value[]
//
//#define FEATURE_INCREMENTAL_ENCODER_ENABLE
/**** 1-Wire bus ****/
//
// Enable 1-Wire processing and command:
// - OW.Scan[]
//
#define FEATURE_OW_ENABLE
//
// Enable Dallas DS18x20 sensors handling and command:
// - DS18x20.Temperature[]
//
#define FEATURE_DS18X20_ENABLE
/**** I2C bus ****/
//
// Enable I2C processing and commands:
// - I2C.Scan[];
// - I2C.Write[];
// - I2C.Read[];
// - I2C.BitWrite[];
// - I2C.BitRead[]
//
//
#define FEATURE_I2C_ENABLE
//
// Enable BOSCH BMP180 sensors handling and commands:
// - BMP.Pressure[];
// - BMP.Temperature[]
//
//
//#define FEATURE_BMP180_ENABLE
//
// Enable BOSCH BMP280 sensors handling and commands:
// - BMP.Pressure[];
// - BMP.Temperature[]
//
//
#define FEATURE_BMP280_ENABLE
//
// Enable BOSCH BME280 sensors handling and enable additional command
// - BME.Humidity[]
//
// Note: BME280 is BMP280+Humidity sensor. Temperature and pressure is can be taken with BMP.Temperature[] / BMP.Pressure[] commands
//
//#define FEATURE_BME280_ENABLE
//
// Enable ROHM BH1750 ambient light sensor handling and command:
// - BH1750.Light[]
//
// Note: To BH1750.Light command can be replaced with I2C.Read[....] with result multiplication by 0.83333.. (lux = raw / 1.2).
// This replacement allow to save a little progmem space
//
//#define FEATURE_BH1750_ENABLE
//
// Enable MAX44009 support and commands:
// - MAX44009.light[]
//
//#define FEATURE_MAX44009_ENABLE
//
// Enable TSL2561 support and commands:
// - TSL2561.light[]
//
//#define FEATURE_TSL2561_ENABLE
//
// Enable VEML6070 support and commands:
// - VEML6070.uv[]
//
//#define FEATURE_VEML6070_ENABLE
//
// Enable ADPS9960 support and commands:
// - ADPS9960.ambient[]
// - ADPS9960.red[]
// - ADPS9960.green[]
// - ADPS9960.blue[]
//
//#define FEATURE_ADPS9960_ENABLE
//
// Enable LCD that connected via PCF8574(A)-based I2C expander and command:
// - PCF8574.LCDPrint[]
//
//
//#define FEATURE_PCF8574_LCD_ENABLE
//
// Enable Sensirion SHT2x sensors handling and commands:
// - SHT2x.Humidity[];
// - SHT2x.Temperature[]
//
//#define FEATURE_SHT2X_ENABLE
//
// Enable INA219 Zer0-Drift, Bidirectional Current/Power Monitor With I2C Interface support and commands:
// - INA219.BusVoltage[]
// - INA219.Current[]
// - INA219.Power[]
//
//#define FEATURE_INA219_ENABLE
//
// Enable support external I2C EEPROM chip (AT24C family) and commands:
// - AT24CXX.write[]
// - AT24CXX.read[]
//
//#define FEATURE_AT24CXX_ENABLE
//
// Enable PCA9685 support and commands:
// - PCA9685.write[]
//
//#define FEATURE_PCA9685_ENABLE
//
// Enable Sensirion SGP30 sensor support and command:
// - sgp30.co2e[]
// - sgp30.tvoc[]
//
//#define FEATURE_SGP30_ENABLE
//
// Enable Telaire T67XX sensors support and command:
// - t67xx.i2c.co2[]
//
//#define FEATURE_T67XX_ENABLE
//
// Enable Melexis MLX90614 sensor support and command:
// - mlx90614.temperature[]
//
//#define FEATURE_MLX90614_ENABLE
//
// Enable Wuhan Cubic PM2011 dust sensor support and command:
// - WCPM.I2C.All[]
//
//#define FEATURE_WUHAN_CUBIC_PM_I2C_ENABLE
/**** MicroWire bus ****/
//
// Enable MAX7219 with 8x8 LED matrix handling and command:
// - MAX7219.Write[]
//
//#define FEATURE_MAX7219_ENABLE
/**** UART bus ****/
//
// Enable PZEM-004 (non-Modbus release) energy monitor support and commands:
// - pzem004.current[]
// - pzem004.voltage[]
// - pzem004.power[]
// - pzem004.energy[]
//
//#define FEATURE_PZEM004_ENABLE
//
// Enable MH-Zxx family PWM/UART protocol support and command:
// - mhzxx.pwm.co2[]
// - mhzxx.uart.co2[]
//
//#define FEATURE_MHZXX_PWM_ENABLE
//#define FEATURE_MHZXX_UART_ENABLE
//
// Enable DFPlayer Mini support and command:
// - DFPlayer.run[]
//
//#define FEATURE_DFPLAYER_ENABLE
//
// Enable APC SmartUPS protocol support and command:
// - ups.apcsmart[]
//
//#define FEATURE_UPS_APCSMART_ENABLE
//
// Enable Megatec protocol support and command:
// - ups.megatec[]
//
// Note: command is not tested on real hardware. Please, send report to me.
//
//#define FEATURE_UPS_MEGATEC_ENABLE
//
// Enable Plantower PMS-xxxx sensors support and command:
// - PMSxx.all[]
// - PMSxx.epm[]
// - PMSxx.fpm[]
//
// Note: PMS.all command output is JSON (for Zabbix v3.4 and above)
//
//#define FEATURE_PLANTOWER_PMSXX_ENABLE
//
// Enable Nova Fitness SDSxxx sensors support and command:
// - SDS.all[]
// - SDS.epm[]
//
// Note: SDS.all command output is JSON (for Zabbix v3.4 and above)
//
//#define FEATURE_NOVA_FITNESS_SDS_ENABLE
//
// Enable Wuhan Cubic PM2011 dust sensor support and command:
// - WCPM.UART.All[]
//
//#define FEATURE_WUHAN_CUBIC_PM_UART_ENABLE
//
// Enable Winsen ZE08-CH2O sensor support and command:
// - ze08.ch2o[]
//
//#define FEATURE_ZE08_CH2O_ENABLE
/**** DHT/AM family ****/
//
// Enable DHT/AM humidity sensors handling and commands:
// - DHT.Humidity[];
// - DHT.Temperature[]
//
#define FEATURE_DHT_ENABLE
/**** Ultrasonic ****/
//
// Enable HC-SR04 sensor and command:
// - Ultrasonic.Distance[];
//
//#define FEATURE_ULTRASONIC_ENABLE
/**** ACS7XX family ****/
//
// Enable Allegro ACS7XX current sensor and commands:
// - ACS7XX.ZC[];
// - ACS7XX.AC[]
//
//#define FEATURE_ACS7XX_ENABLE
/**** InfraRed transmitters emulation ****/
//
// Enable commands:
// - IR.Send[];
// - IR.SendRAW[]
//
// Note: See below to include special signal types supporting
//
//#define FEATURE_IR_ENABLE
//#define SUPPORT_IR_RC5
//#define SUPPORT_IR_RC6
//#define SUPPORT_IR_SONY
//#define SUPPORT_IR_NEC
//#define SUPPORT_IR_SAMSUNG
//#define SUPPORT_IR_WHYNTER
//#define SUPPORT_IR_LG
//#define SUPPORT_IR_DISH
//#define SUPPORT_IR_SHARP
//#define SUPPORT_IR_DENON
/**** Led Pixel modules ****/
//
// Enable WS2812 led chip support and command:
// - ws2812.sendraw[]
//
//#define FEATURE_WS2812_ENABLE
/**** Unsorted features ****/
//
// Enable MAX6675 support and command:
// - MAX6675.temperature[]
//
//#define FEATURE_MAX6675_ENABLE
//
// Enable digital Servo's (like SG-90) support and command:
// - Servo.turn[]
//
//#define FEATURE_SERVO_ENABLE
//
// Enable various turn on / turn off tricks support and command:
// - relay[]
// - pulse[]
//
//#define FEATURE_RELAY_ENABLE
/**** System ****/
//
// Enable calling user functions on device start and every _constUserFunctionCallInterval_ if no active network session exist
// You can write to _plugin.ino_ your own code and use all Zabbuino's internal functions to query sensors and handle actuators
//
#define FEATURE_USER_FUNCTION_PROCESSING
//
// Support Zabbix's Action functionality and enable command:
// - system.run[]
//
//#define FEATURE_REMOTE_COMMANDS_ENABLE
//
// Enable AVR watchdog
// !!! BEWARE !!!
// NOT ALL BOOTLOADERS HANDLE WATCHDOG PROPERLY: http://forum.arduino.cc/index.php?topic=157406.0
//
// Note: OptiBoot is watchdog compatible and use less flash space that stock bootloader.
// Note: watchdog timeout may be vary for many controllers, see comments to macro WTD_TIMEOUT in zabbuino.h
//
//
//#define FEATURE_WATCHDOG_ENABLE
//
// Use analogReference() function in analogread[] and acs7xx.*[] commands
//
// Uncomment ***only*** if you know all about AREF pin using ***risks***
//
// // // // #define FEATURE_AREF_ENABLE
//
// Store runtime settings in EEPROM and use its on start
//
//#define FEATURE_EEPROM_ENABLE
//
// Force protect (enable even netConfig.useProtection is false) your system from illegal access for change runtime settings and reboots
//
//#define FEATURE_PASSWORD_PROTECTION_FORCE
//
// Enable commands which returns system information and can be used in system debug process:
// - System.HW.CPU[];
// - System.HW.Chassis[];
// - Sys.MCU.ID[];
// - Sys.PHY.Module[];
// - Sys.Cmd.Count[];
// - Sys.Cmd.TimeMax[];
// - Sys.RAM.Free[];
// - Sys.RAM.FreeMin[]
//
//#define FEATURE_SYSINFO_ENABLE
//
// Enable support the system RTC (DS3231 or PCF8563 RTC chip which connected via I2C interface) and commands:
// - set.localtime[]
// - system.localtime[]
//
// Refer to SYSTEM HARDWARE SECTION in src\tune.h
//
//#define FEATURE_SYSTEM_RTC_DS3231_ENABLE
//#define FEATURE_SYSTEM_RTC_PCF8563_ENABLE
//
// View the more or less debug messages on the Serial Monitor. 0 - no messages .. 2 - max
//
#define FEATURE_DEBUG_MESSAGING_LEVEL 1
// Various runtime info for development needs
//#define FEATURE_DEBUG_TO_SERIAL_DEV
//
// Recieve command from Serial Monitor too. Do not forget to enable one of FEATURE_DEBUG_TO_SERIAL_* macro
//
// Note that 64 bytes buffer reserved for Serial (refer to HardwareSerial.h) and long commands like ws2812.sendraw[5,1,over9000chars] can be processed uncorrectly
//
// #define FEATURE_SERIAL_LISTEN_TOO
//
// Send back to user text messages if error is occurs. Otherwise - send numeric code
//
//#define USE_TEXT_ERROR_MESSAGES
//
// Use interrupt on Timer1 for internal metric gathering
//
#define GATHER_METRIC_USING_TIMER_INTERRUPT
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
NETWORK MODULE SECTION
Note: MAC or IP-address separately changing may cause "strange" network errors until the moment when the router delete old ARP-records from the cache.
*/
const uint8_t constNetDefaultUseDHCP = false;
/*
Universally administered and locally administered addresses are distinguished by setting the second-least-significant bit of the first octet of the address.
This bit is also referred to as the U/L bit, short for Universal/Local, which identifies how the address is administered. If the bit is 0, the address is universally
administered. If it is 1, the address is locally administered. In the example address 06-00-00-00-00-00 the first octet is 06 (hex), the binary form of which
is 00000110, where the second-least-significant bit is 1. Therefore, it is a locally administered address.[7] Consequently, this bit is 0 in all OUIs.
https://en.wikipedia.org/wiki/MAC_address
Note: changing MAC or IP-address separately may cause "strange" network errors until the moment when the router flush ARP cache.
*/
// Zabbuino's IP address
const uint8_t constDefaultMacAddress[6] PROGMEM = {0xBE, 0xAD, 0xEB, 0xA8, 0x00, 0xDE};
const uint8_t constDefaultIPAddress[4] PROGMEM = {192, 168, 0, 123};
const uint8_t constDefaultGateway[4] PROGMEM = {192, 168, 0, 1};
const uint8_t constDefaultNetmask[4] PROGMEM = {255, 255, 255, 0};
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ALARM SECTION
*/
// Where is state LED connected
const uint8_t constStateLedPin = 0x09;
// State LED must blink or just be turned on?
#define ON_ALARM_STATE_BLINK
// Use more blinks to runtime stage indication
//#define ADVANCED_BLINKING
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SYSTEM CONFIGURATION SECTION
*/
#define DEBUG_PORT Serial
/*
#define NETWORK_SERIAL_INTERFACE_PORT Serial
const uint32_t constNetworkSerialInterfaceSpeed = 115200;
const uint8_t constNetworkSerialInterfaceMode = SERIAL_8N1;
*/
// Debug serial port speed in baud
const uint32_t constSerialMonitorSpeed = 115200;
// Access password must be used anytime.
const uint8_t constSysDefaultProtection = true;
// It's just number of "long int" type. Surprise!
const uint32_t constSysDefaultPassword = 0x00;
// Digital pin which must shorted on the GND for constHoldTimeToFactoryReset time to copy default system setting into EEPROM
const uint8_t constFactoryResetButtonPin = 0x08;
//
const uint16_t constSysTZOffset = 0x2A30; // 10800 sec, 3h;
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AGENT CONFIGURATION SECTION
*/
const uint16_t constZbxAgentTcpPort = 10050;
const char constZbxAgentDefaultHostname[] PROGMEM = "zabbuino";
// Domain name used only to make FDQN if FEATURE_NET_USE_MCUID is allowed, and FEATURE_EEPROM_ENABLE is disabled
const char constZbxAgentDefaultDomain[] PROGMEM = ".local.net";
const char constZbxAgentVersion[] PROGMEM = "Zabbuino 1.4.0";