LightHub
4.6.0
Open-source smart home controller firmware
Toggle main menu visibility
Loading...
Searching...
No Matches
options.h
Go to the documentation of this file.
1
#pragma once
2
#include <Arduino.h>
3
4
// PID: do not filter (scale/clamp) the regulator output
5
#ifndef NOT_FILTER_PID_OUT
6
#define NOT_FILTER_PID_OUT 1
7
#endif
8
9
#define DHCP_ATTEMPTS_FALLBACK 3
// DHCP attempts before falling back to static IP
10
#define TENS_FRACT_LEN 2
// fraction digits of "tens" fixed-point values
11
#define TENS_BASE 100
// scale factor of "tens" fixed-point values
12
13
#define DEFAULT_FILESIZE_LIMIT 65535
// max download size in bytes
14
// Max JSON config size, per platform
15
#ifndef MAX_JSON_CONF_SIZE
16
17
#if defined(__SAM3X8E__)
18
#define MAX_JSON_CONF_SIZE 65535
19
#elif defined(ARDUINO_ARCH_AVR)
20
#define MAX_JSON_CONF_SIZE 4096
21
#elif defined(ARDUINO_ARCH_ESP32)
22
#define MAX_JSON_CONF_SIZE 65535
23
#else
24
#define MAX_JSON_CONF_SIZE 32000
25
#endif
26
27
#endif
28
29
#ifdef MDNS_ENABLE
30
#ifndef OTA_PORT
31
#define OTA_PORT 65280
32
#endif
33
#endif
34
35
// Configuration of drivers enabled
36
#define SYSLOG_LOCAL_SOCKET 514
37
38
#ifndef MODBUS_UART_RX_PIN
39
#define MODBUS_UART_RX_PIN -1
// UART RX pin for the Modbus RS485 bus
40
#endif
41
42
#ifndef MODBUS_UART_TX_PIN
43
#define MODBUS_UART_TX_PIN -1
// UART TX pin for the Modbus RS485 bus
44
#endif
45
46
#ifndef FASTLED
47
#define ADAFRUIT_LED
48
#endif
49
// ADAFRUIT library allow to dynamically configure SPI LED Strip Parameters
50
51
// If not defined ADAFRUIT_LED - FastLED library will be used instead
52
// And strip type, pin, order must defined on compilation time
53
#ifndef CONTROLLER
54
#define CONTROLLER TM1809
// Default LED strip controller type
55
#endif
56
57
#ifndef SCALE_VOLUME_100
58
#define SCALE_VOLUME_100 false
59
#endif
60
61
#ifndef DATA_PIN
62
#define DATA_PIN 4
// LED strip data (DIN) pin
63
#endif
64
65
#ifndef ORDER
66
#define ORDER BRG
// LED strip color order
67
#endif
68
69
// RS485 transceiver direction (DE/RE) control pin
70
#ifndef MODBUS_TX_PIN
71
#define TXEnablePin 13
72
#else
73
#define TXEnablePin MODBUS_TX_PIN
74
#endif
75
76
//#define ESP_EEPROM_SIZE 2048
77
78
#ifndef AVR_DMXOUT_PIN
79
#define AVR_DMXOUT_PIN 18
// Software DMX output pin on AVR
80
#endif
81
82
#define WIFI_TIMEOUT 60000UL
// Max time waiting for a WiFi connection
83
#define TIMEOUT_RECONNECT 10000UL
// Delay before retrying an MQTT reconnect
84
#define TIMEOUT_REINIT 5000UL
// Delay before re-initializing the LAN
85
#define TIMEOUT_RELOAD 30000UL
// Delay before reloading the config
86
#define TIMEOUT_RETAIN 8000UL
// Delay while publishing retained states
87
#define TIMEOUT_REINIT_NOT_CONFIGURED 120000UL
// Longer re-init when not yet configured
88
#define INTERVAL_1W 5000UL
// 1-Wire temperature poll interval (ms)
89
#define PERIOD_THERMOSTAT_FAILED (600 * 1000UL)
//16000 sec (4h) max
90
91
//#define T_ATTEMPTS 200
92
//#define IET_TEMP 0
93
//#define IET_ATTEMPTS 1
94
#ifndef THERMO_GIST_CELSIUS
95
#define THERMO_GIST_CELSIUS 1.
// Thermostat hysteresis / dead-band (deg C)
96
#endif
97
98
#ifndef THERMO_OVERHEAT_CELSIUS
99
#define THERMO_OVERHEAT_CELSIUS 38.
// Thermostat overheat alarm threshold
100
#endif
101
102
#ifndef FM_OVERHEAT_CELSIUS
103
#define FM_OVERHEAT_CELSIUS 40.
// Fan/AC overheat alarm threshold
104
#endif
105
106
#ifndef MIN_VOLUME
107
#define MIN_VOLUME 20
// Minimum LED strip brightness
108
#endif
109
110
#ifndef INIT_VOLUME
111
#define INIT_VOLUME 30
// Initial LED strip brightness on power-up
112
#endif
113
114
/*
115
#define MAXFLASHSTR 32
116
#define PWDFLASHSTR 16
117
#define EEPROM_SIGNATURE "LHCF"
118
#define EEPROM_SIGNATURE_LENGTH 4
119
120
#define OFFSET_MAC 0
121
#define OFFSET_IP OFFSET_MAC+6
122
#define OFFSET_DNS OFFSET_IP+4
123
#define OFFSET_GW OFFSET_DNS+4
124
#define OFFSET_MASK OFFSET_GW+4
125
#define OFFSET_CONFIGSERVER OFFSET_MASK+4
126
#define OFFSET_MQTT_PWD OFFSET_CONFIGSERVER+MAXFLASHSTR
127
#define OFFSET_SIGNATURE OFFSET_MQTT_PWD+PWDFLASHSTR
128
#define EEPROM_offset_NotAlligned OFFSET_SIGNATURE+EEPROM_SIGNATURE_LENGTH
129
#define EEPROM_offsetJSON EEPROM_offset_NotAlligned + (4 -(EEPROM_offset_NotAlligned & 3))
130
//#define EEPROM_offsetJSON IFLASH_PAGE_SIZE
131
#define EEPROM_FIX_PART_LEN EEPROM_offsetJSON-OFFSET_MAC
132
*/
133
134
#ifndef INTERVAL_CHECK_INPUT
135
#define INTERVAL_CHECK_INPUT 11
// ms between digital input scans
136
#endif
137
138
#define INTERVAL_CHECK_ULTRASONIC 100
// ms between ultrasonic sensor reads
139
140
#ifndef TIMER_CHECK_INPUT
141
#define TIMER_CHECK_INPUT 15
// ms between timer (pulse-count) input scans
142
#endif
143
#ifndef INTERVAL_CHECK_SENSOR
144
#define INTERVAL_CHECK_SENSOR 5000
// ms between periodic sensor polls
145
#endif
146
147
#define INTERVAL_SLOW_POLLING 1000
// ms between slow item polls
148
//#define INTERVAL_POLLING 100
149
#ifndef THERMOSTAT_CHECK_PERIOD
150
#define THERMOSTAT_CHECK_PERIOD 30000
// ms between thermostat control checks
151
#endif
152
153
#ifndef OW_UPDATE_INTERVAL
154
#define OW_UPDATE_INTERVAL 5000
// ms between 1-Wire update cycles
155
#endif
156
157
#ifndef MODBUS_SERIAL_BAUD
158
#define MODBUS_SERIAL_BAUD 9600
// Modbus RS485 baud rate
159
#endif
160
161
#ifndef MODBUS_SERIAL_PARAM
162
#define MODBUS_SERIAL_PARAM SERIAL_8N1
// Modbus RS485 framing
163
#endif
164
165
/*
166
#ifndef MODBUS_TCP_BAUD
167
#define MODBUS_TCP_BAUD 9600
168
#endif
169
170
#ifndef MODBUS_TCP_PARAM
171
#define MODBUS_TCP_PARAM SERIAL_8N1
172
#endif
173
*/
174
175
#define MODBUS_FM_BAUD 9600
// VACOM/FM Modbus device baud rate
176
#define MODBUS_FM_PARAM SERIAL_8N1
// VACOM/FM Modbus device framing
177
178
#ifndef SERIAL_BAUD
179
#define SERIAL_BAUD 115200
// Debug serial baud rate
180
#endif
181
182
// Default MAC used when the chip provides no unique ID
183
#ifndef CUSTOM_FIRMWARE_MAC
184
#define DEFAULT_FIRMWARE_MAC {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xFF}
185
#endif
186
187
// Remote configuration server (MY_CONFIG_SERVER overrides the default)
188
#ifndef MY_CONFIG_SERVER
189
#define CONFIG_SERVER "lazyhome.ru"
190
#else
191
#define CONFIG_SERVER QUOTE(MY_CONFIG_SERVER)
192
#endif
193
194
#ifndef HOMETOPIC
195
#define HOMETOPIC "myhome"
// Root of all MQTT topics
196
#endif
197
198
//Default output topic
199
#ifndef OUTTOPIC
200
#define OUTTOPIC "s_out"
201
#endif
202
203
//Topic to receive CLI commands
204
#ifndef CMDTOPIC
205
#define CMDTOPIC "$command"
206
#endif
207
208
//Default broadcast topic
209
#ifndef INTOPIC
210
#define INTOPIC "in"
211
#endif
212
213
#define MQTT_SUBJECT_LENGTH 20
// Max length of an MQTT subject name
214
#define MQTT_TOPIC_LENGTH 64
// Max length of a full MQTT topic
215
216
// Feature enable/disable toggles
217
#ifndef DMX_DISABLE
218
#define _dmxin
219
#define _dmxout
220
#endif
221
222
#ifndef OWIRE_DISABLE
223
#define _owire
224
#endif
225
226
#if !(defined (MODBUS_DISABLE) && defined (MBUS_DISABLE))
227
#define _modbus
228
#endif
229
230
#ifdef ARTNET_ENABLE
231
#define _artnet
232
#endif
233
234
#ifndef LAN_INIT_DELAY
235
#define LAN_INIT_DELAY 500
// ms to wait before starting LAN init
236
#endif
237
238
#define DEFAULT_INC_STEP 5
// Default step for INCREASE/DECREASE commands
239
240
241
#if defined(ARDUINO_ARCH_AVR)
242
//All options available
243
#ifdef CONTROLLINO
244
#define modbusSerial Serial3
245
#ifndef AC_Serial
246
#define AC_Serial Serial2
247
#endif
248
#else
249
#ifndef modbusSerial
250
#define modbusSerial Serial2
251
#endif
252
253
#ifndef AC_Serial
254
#define AC_Serial Serial3
255
#endif
256
#endif
257
#define dmxin DMXSerial
258
#define dmxout DmxSimple
259
#endif
260
261
#if defined(__SAM3X8E__)
262
#ifndef modbusSerial
263
#define modbusSerial Serial2
264
#endif
265
266
#ifndef AC_Serial
267
#define AC_Serial Serial3
268
#endif
269
270
#define dmxout DmxDue1
271
#define dmxin DmxDue1
272
#endif
273
274
#if defined(NRF5)
275
//#define modbusSerial Serial1
276
#undef _dmxin
277
#undef _dmxout
278
#undef _modbus
279
#endif
280
281
#if defined(ARDUINO_ARCH_ESP8266)
282
#undef _dmxin
283
284
#ifndef DMX_DISABLE
285
#define _espdmx
286
#endif
287
288
#ifndef modbusSerial
289
#define modbusSerial Serial1
290
#endif
291
292
#ifndef AC_Serial
293
#define AC_Serial Serial1
294
#endif
295
296
#endif
297
298
#if defined(ARDUINO_ARCH_ESP32)
299
#undef _dmxin
300
#ifndef DMX_DISABLE
301
#define _espdmx
302
#endif
303
304
#ifndef modbusSerial
305
#define modbusSerial Serial2
306
#endif
307
308
#ifndef AC_Serial
309
#define AC_Serial Serial2
310
#endif
311
312
#ifdef ARDUINO_USB_CDC_ON_BOOT
313
#define debugSerialPort Serial
314
#endif
315
316
#endif
317
318
#ifndef _dmxout
319
#undef _artnet
320
#endif
321
322
#ifdef WIFI_MANAGER_DISABLE
323
#ifndef ESP_WIFI_AP
324
#define ESP_WIFI_AP mywifiap
325
#endif
326
327
#ifndef ESP_WIFI_PWD
328
#define ESP_WIFI_PWD mywifipass
329
#endif
330
#endif
331
332
#define DHT_POLL_DELAY_DEFAULT 15000
// Default DHT sensor poll interval (ms)
333
#define UPTIME_POLL_DELAY_DEFAULT 30000
// Default uptime stats publish interval (ms)
334
335
#ifdef ARDUINO_ARCH_STM32F1
336
#define strncpy_P strncpy
337
#endif
338
339
#ifndef DMX_SMOOTH_DELAY
340
#define DMX_SMOOTH_DELAY 10
// ms between DMX output smoothing steps
341
#endif
342
343
//#ifdef M5STACK
344
//#define debugSerial M5.Lcd
345
//#endif
346
#ifdef NOSERIAL
347
#undef debugSerialPort
348
#else
349
#ifndef debugSerialPort
350
#define debugSerialPort Serial
351
#endif
352
#endif
353
354
#ifndef Wiz5500
355
#define W5100_ETHERNET_SHIELD
356
#else
357
#define W5500_ETHERNET_SHIELD
358
#endif
359
360
361
#if defined(ARDUINO_ARCH_AVR)
362
#define PINS_COUNT NUM_DIGITAL_PINS
363
#define isAnalogPin(p) ((p >= 54) && (p<=69))
364
#endif
365
366
#if defined(__SAM3X8E__)
367
#define isAnalogPin(p) (g_APinDescription[p].ulPinAttribute & PIN_ATTR_ANALOG) == PIN_ATTR_ANALOG
368
#endif
369
370
#if defined(ARDUINO_ARCH_STM32)
371
#define PINS_COUNT NUM_DIGITAL_PINS
372
#define isAnalogPin(p) ((p >= 44) && (p<=57))
373
#endif
374
375
#if defined(ESP8266)
376
#define PINS_COUNT NUM_DIGITAL_PINS
377
#define isAnalogPin(p) ( p ==17 )
378
#endif
379
380
#if defined(ARDUINO_ARCH_ESP32)
381
#define PINS_COUNT NUM_DIGITAL_PINS
382
#define isAnalogPin(p) ((p ==4) || (p>=12)&& (p<=15) || (p>=25)&& (p<=27)||(p>=32)&& (p<=33) || (p>=37)&& (p<=38))
383
#endif
384
385
#if defined(NRF5)
386
//#define PINS_COUNT NUM_DIGITAL_PINS
387
#define isAnalogPin(p) ((p >= 14) && (p<=21))
388
#endif
389
390
// Minimum free RAM (bytes) required before a heavy operation
391
#ifdef AVR
392
#define minimalMemory 200
393
#else
394
#define minimalMemory 1200
395
#endif
396
397
// Comma-separated list of GPIO pins protected from raw control
398
#if not defined PROTECTED_PINS
399
#define PROTECTED_PINS
400
#endif
401
402
#if not defined DEFAULT_OTA_USERNAME
403
#define DEFAULT_OTA_USERNAME arduino
// Default OTA update login
404
#endif
405
406
#if not defined DEFAULT_OTA_PASSWORD
407
#define DEFAULT_OTA_PASSWORD password
// Default OTA update password
408
#endif
409
410
const
short
protectedPins
[]={
PROTECTED_PINS
};
411
#define protectedPinsNum (sizeof(protectedPins)/sizeof(short))
412
413
#ifdef CRYPT
414
// Shared secret used for config encryption
415
#if not defined SHAREDSECRET
416
#define SHAREDSECRET "12345678"
417
#endif
418
419
#endif
PROTECTED_PINS
#define PROTECTED_PINS
Definition
options.h:399
protectedPins
const short protectedPins[]
Definition
options.h:410
lighthub
options.h
Generated by
1.18.0