Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1448 lines
46 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
6 years ago
6 years ago
  1. // =============================================================================
  2. // SENSORS - General data
  3. // =============================================================================
  4. #define SENSOR_DEBUG 0 // Debug sensors
  5. #define SENSOR_READ_INTERVAL 6 // Read data from sensors every 6 seconds
  6. #define SENSOR_READ_MIN_INTERVAL 1 // Minimum read interval
  7. #define SENSOR_READ_MAX_INTERVAL 3600 // Maximum read interval
  8. #define SENSOR_INIT_INTERVAL 10000 // Try to re-init non-ready sensors every 10s
  9. #define SENSOR_REPORT_EVERY 10 // Report every this many readings
  10. #define SENSOR_REPORT_MIN_EVERY 1 // Minimum every value
  11. #define SENSOR_REPORT_MAX_EVERY 60 // Maximum
  12. #define SENSOR_USE_INDEX 0 // Use the index in topic (i.e. temperature/0)
  13. // even if just one sensor (0 for backwards compatibility)
  14. #ifndef SENSOR_POWER_CHECK_STATUS
  15. #define SENSOR_POWER_CHECK_STATUS 1 // If set to 1 the reported power/current/energy will be 0 if the relay[0] is OFF
  16. #endif
  17. #ifndef SENSOR_TEMPERATURE_CORRECTION
  18. #define SENSOR_TEMPERATURE_CORRECTION 0.0 // Offset correction
  19. #endif
  20. #ifndef TEMPERATURE_MIN_CHANGE
  21. #define TEMPERATURE_MIN_CHANGE 0.0 // Minimum temperature change to report
  22. #endif
  23. #ifndef SENSOR_HUMIDITY_CORRECTION
  24. #define SENSOR_HUMIDITY_CORRECTION 0.0 // Offset correction
  25. #endif
  26. #ifndef HUMIDITY_MIN_CHANGE
  27. #define HUMIDITY_MIN_CHANGE 0 // Minimum humidity change to report
  28. #endif
  29. #ifndef ENERGY_MAX_CHANGE
  30. #define ENERGY_MAX_CHANGE 0 // Maximum energy change to report (if >0 it will allways report when delta(E) is greater than this)
  31. #endif
  32. #ifndef SENSOR_SAVE_EVERY
  33. #define SENSOR_SAVE_EVERY 0 // Save accumulating values to EEPROM (atm only energy)
  34. // A 0 means do not save and it's the default value
  35. // A number different from 0 means it should store the value in EEPROM
  36. // after these many reports
  37. // Warning: this might wear out flash fast!
  38. #endif
  39. #define SENSOR_PUBLISH_ADDRESSES 0 // Publish sensor addresses
  40. #define SENSOR_ADDRESS_TOPIC "address" // Topic to publish sensor addresses
  41. #ifndef SENSOR_TEMPERATURE_UNITS
  42. #define SENSOR_TEMPERATURE_UNITS TMP_CELSIUS // Temperature units (TMP_CELSIUS | TMP_FAHRENHEIT)
  43. #endif
  44. #ifndef SENSOR_ENERGY_UNITS
  45. #define SENSOR_ENERGY_UNITS ENERGY_JOULES // Energy units (ENERGY_JOULES | ENERGY_KWH)
  46. #endif
  47. #ifndef SENSOR_POWER_UNITS
  48. #define SENSOR_POWER_UNITS POWER_WATTS // Power units (POWER_WATTS | POWER_KILOWATTS)
  49. #endif
  50. // =============================================================================
  51. // Specific data for each sensor
  52. // =============================================================================
  53. //------------------------------------------------------------------------------
  54. // AM2320 Humidity & Temperature sensor over I2C
  55. // Enable support by passing AM2320_SUPPORT=1 build flag
  56. //------------------------------------------------------------------------------
  57. #ifndef AM2320_SUPPORT
  58. #define AM2320_SUPPORT 0
  59. #endif
  60. #ifndef AM2320_ADDRESS
  61. #define AM2320_ADDRESS 0x00 // 0x00 means auto
  62. #endif
  63. //------------------------------------------------------------------------------
  64. // Analog sensor
  65. // Enable support by passing ANALOG_SUPPORT=1 build flag
  66. //--------------------------------------------------------------------------------
  67. #ifndef ANALOG_SUPPORT
  68. #define ANALOG_SUPPORT 0
  69. #endif
  70. #ifndef ANALOG_SAMPLES
  71. #define ANALOG_SAMPLES 10 // Number of samples
  72. #endif
  73. #ifndef ANALOG_DELAY
  74. #define ANALOG_DELAY 0 // Delay between samples in micros
  75. #endif
  76. //Use the following to perform scaling of raw analog values
  77. // scaledRead = ( factor * rawRead ) + offset
  78. //
  79. //Please take note that the offset is not affected by the scaling factor
  80. #ifndef ANALOG_FACTOR
  81. #define ANALOG_FACTOR 1.0 // Multiply raw reading by this factor
  82. #endif
  83. #ifndef ANALOG_OFFSET
  84. #define ANALOG_OFFSET 0.0 // Add this offset to *scaled* value
  85. #endif
  86. // Round to this number of decimals
  87. #ifndef ANALOG_DECIMALS
  88. #define ANALOG_DECIMALS 2
  89. #endif
  90. //------------------------------------------------------------------------------
  91. // BH1750
  92. // Enable support by passing BH1750_SUPPORT=1 build flag
  93. // http://www.elechouse.com/elechouse/images/product/Digital%20light%20Sensor/bh1750fvi-e.pdf
  94. //------------------------------------------------------------------------------
  95. #ifndef BH1750_SUPPORT
  96. #define BH1750_SUPPORT 0
  97. #endif
  98. #ifndef BH1750_ADDRESS
  99. #define BH1750_ADDRESS 0x00 // 0x00 means auto
  100. #endif
  101. #define BH1750_MODE BH1750_CONTINUOUS_HIGH_RES_MODE
  102. //------------------------------------------------------------------------------
  103. // BMP085/BMP180
  104. // Enable support by passing BMP180_SUPPORT=1 build flag
  105. //------------------------------------------------------------------------------
  106. #ifndef BMP180_SUPPORT
  107. #define BMP180_SUPPORT 0
  108. #endif
  109. #ifndef BMP180_ADDRESS
  110. #define BMP180_ADDRESS 0x00 // 0x00 means auto
  111. #endif
  112. #define BMP180_MODE 3 // 0 for ultra-low power, 1 for standard, 2 for high resolution and 3 for ultrahigh resolution
  113. //------------------------------------------------------------------------------
  114. // BME280/BMP280
  115. // Enable support by passing BMX280_SUPPORT=1 build flag
  116. //------------------------------------------------------------------------------
  117. #ifndef BMX280_SUPPORT
  118. #define BMX280_SUPPORT 0
  119. #endif
  120. #ifndef BMX280_NUMBER
  121. #define BMX280_NUMBER 1 // Number of sensors present. Either 1 or 2 allowed
  122. #endif
  123. #ifndef BMX280_ADDRESS
  124. #define BMX280_ADDRESS 0x00 // 0x00 means auto (0x76 or 0x77 allowed) for sensor #0
  125. #endif // If (BMX280_NUMBER == 2) and
  126. // (BMX280_ADDRESS == 0x00) then sensor #1 is auto-discovered
  127. // (BMX280_ADDRESS != 0x00) then sensor #1 is the unnamed address
  128. #ifndef BMX280_MODE
  129. #define BMX280_MODE 1 // 0 for sleep mode, 1 or 2 for forced mode, 3 for normal mode
  130. #endif
  131. #ifndef BMX280_STANDBY
  132. #define BMX280_STANDBY 0 // 0 for 0.5ms, 1 for 62.5ms, 2 for 125ms
  133. // 3 for 250ms, 4 for 500ms, 5 for 1000ms
  134. // 6 for 10ms, 7 for 20ms
  135. #endif
  136. #ifndef BMX280_FILTER
  137. #define BMX280_FILTER 0 // 0 for OFF, 1 for 2 values, 2 for 4 values, 3 for 8 values and 4 for 16 values
  138. #endif
  139. #ifndef BMX280_TEMPERATURE
  140. #define BMX280_TEMPERATURE 1 // Oversampling for temperature (set to 0 to disable magnitude)
  141. // 0b000 = 0 = Skip measurement
  142. // 0b001 = 1 = 1x 16bit/0.0050C resolution
  143. // 0b010 = 2 = 2x 17bit/0.0025C
  144. // 0b011 = 3 = 4x 18bit/0.0012C
  145. // 0b100 = 4 = 8x 19bit/0.0006C
  146. // 0b101 = 5 = 16x 20bit/0.0003C
  147. #endif
  148. #ifndef BMX280_HUMIDITY
  149. #define BMX280_HUMIDITY 1 // Oversampling for humidity (set to 0 to disable magnitude, only for BME280)
  150. // 0b000 = 0 = Skip measurement
  151. // 0b001 = 1 = 1x 0.07% resolution
  152. // 0b010 = 2 = 2x 0.05%
  153. // 0b011 = 3 = 4x 0.04%
  154. // 0b100 = 4 = 8x 0.03%
  155. // 0b101 = 5 = 16x 0.02%
  156. #endif
  157. #ifndef BMX280_PRESSURE
  158. #define BMX280_PRESSURE 1 // Oversampling for pressure (set to 0 to disable magnitude)
  159. // 0b000 = 0 = Skipped
  160. // 0b001 = 1 = 1x 16bit/2.62 Pa resolution
  161. // 0b010 = 2 = 2x 17bit/1.31 Pa
  162. // 0b011 = 3 = 4x 18bit/0.66 Pa
  163. // 0b100 = 4 = 8x 19bit/0.33 Pa
  164. // 0b101 = 5 = 16x 20bit/0.16 Pa
  165. #endif
  166. //------------------------------------------------------------------------------
  167. // Dallas OneWire temperature sensors
  168. // Enable support by passing DALLAS_SUPPORT=1 build flag
  169. //------------------------------------------------------------------------------
  170. #ifndef DALLAS_SUPPORT
  171. #define DALLAS_SUPPORT 0
  172. #endif
  173. #ifndef DALLAS_PIN
  174. #define DALLAS_PIN 14
  175. #endif
  176. #define DALLAS_RESOLUTION 9 // Not used atm
  177. #define DALLAS_READ_INTERVAL 2000 // Force sensor read & cache every 2 seconds
  178. //------------------------------------------------------------------------------
  179. // DHTXX temperature/humidity sensor
  180. // Enable support by passing DHT_SUPPORT=1 build flag
  181. //------------------------------------------------------------------------------
  182. #ifndef DHT_SUPPORT
  183. #define DHT_SUPPORT 0
  184. #endif
  185. #ifndef DHT_PIN
  186. #define DHT_PIN 14
  187. #endif
  188. #ifndef DHT_TYPE
  189. #define DHT_TYPE DHT_CHIP_DHT22
  190. #endif
  191. //------------------------------------------------------------------------------
  192. // CSE7766 based power sensor
  193. // Enable support by passing CSE7766_SUPPORT=1 build flag
  194. //------------------------------------------------------------------------------
  195. #ifndef CSE7766_SUPPORT
  196. #define CSE7766_SUPPORT 0
  197. #endif
  198. #ifndef CSE7766_PIN
  199. #define CSE7766_PIN 1 // TX pin from the CSE7766
  200. #endif
  201. #ifndef CSE7766_PIN_INVERSE
  202. #define CSE7766_PIN_INVERSE 0 // Signal is inverted
  203. #endif
  204. #define CSE7766_SYNC_INTERVAL 300 // Safe time between transmissions (ms)
  205. #define CSE7766_BAUDRATE 4800 // UART baudrate
  206. #define CSE7766_V1R 1.0 // 1mR current resistor
  207. #define CSE7766_V2R 1.0 // 1M voltage resistor
  208. //------------------------------------------------------------------------------
  209. // Digital sensor
  210. // Enable support by passing DIGITAL_SUPPORT=1 build flag
  211. //------------------------------------------------------------------------------
  212. #ifndef DIGITAL_SUPPORT
  213. #define DIGITAL_SUPPORT 0
  214. #endif
  215. #ifndef DIGITAL1_PIN
  216. #define DIGITAL1_PIN 2
  217. #endif
  218. #ifndef DIGITAL1_PIN_MODE
  219. #define DIGITAL1_PIN_MODE INPUT_PULLUP
  220. #endif
  221. #ifndef DIGITAL1_DEFAULT_STATE
  222. #define DIGITAL1_DEFAULT_STATE 1
  223. #endif
  224. #ifndef DIGITAL2_PIN
  225. #define DIGITAL2_PIN 2
  226. #endif
  227. #ifndef DIGITAL2_PIN_MODE
  228. #define DIGITAL2_PIN_MODE INPUT_PULLUP
  229. #endif
  230. #ifndef DIGITAL2_DEFAULT_STATE
  231. #define DIGITAL2_DEFAULT_STATE 1
  232. #endif
  233. #ifndef DIGITAL3_PIN
  234. #define DIGITAL3_PIN 2
  235. #endif
  236. #ifndef DIGITAL3_PIN_MODE
  237. #define DIGITAL3_PIN_MODE INPUT_PULLUP
  238. #endif
  239. #ifndef DIGITAL3_DEFAULT_STATE
  240. #define DIGITAL3_DEFAULT_STATE 1
  241. #endif
  242. #ifndef DIGITAL4_PIN
  243. #define DIGITAL4_PIN 2
  244. #endif
  245. #ifndef DIGITAL4_PIN_MODE
  246. #define DIGITAL4_PIN_MODE INPUT_PULLUP
  247. #endif
  248. #ifndef DIGITAL4_DEFAULT_STATE
  249. #define DIGITAL4_DEFAULT_STATE 1
  250. #endif
  251. #ifndef DIGITAL5_PIN
  252. #define DIGITAL5_PIN 2
  253. #endif
  254. #ifndef DIGITAL5_PIN_MODE
  255. #define DIGITAL5_PIN_MODE INPUT_PULLUP
  256. #endif
  257. #ifndef DIGITAL5_DEFAULT_STATE
  258. #define DIGITAL5_DEFAULT_STATE 1
  259. #endif
  260. #ifndef DIGITAL6_PIN
  261. #define DIGITAL6_PIN 2
  262. #endif
  263. #ifndef DIGITAL6_PIN_MODE
  264. #define DIGITAL6_PIN_MODE INPUT_PULLUP
  265. #endif
  266. #ifndef DIGITAL6_DEFAULT_STATE
  267. #define DIGITAL6_DEFAULT_STATE 1
  268. #endif
  269. #ifndef DIGITAL7_PIN
  270. #define DIGITAL7_PIN 2
  271. #endif
  272. #ifndef DIGITAL7_PIN_MODE
  273. #define DIGITAL7_PIN_MODE INPUT_PULLUP
  274. #endif
  275. #ifndef DIGITAL7_DEFAULT_STATE
  276. #define DIGITAL7_DEFAULT_STATE 1
  277. #endif
  278. #ifndef DIGITAL8_PIN
  279. #define DIGITAL8_PIN 2
  280. #endif
  281. #ifndef DIGITAL8_PIN_MODE
  282. #define DIGITAL8_PIN_MODE INPUT_PULLUP
  283. #endif
  284. #ifndef DIGITAL8_DEFAULT_STATE
  285. #define DIGITAL8_DEFAULT_STATE 1
  286. #endif
  287. //------------------------------------------------------------------------------
  288. // ECH1560 based power sensor
  289. // Enable support by passing ECH1560_SUPPORT=1 build flag
  290. //------------------------------------------------------------------------------
  291. #ifndef ECH1560_SUPPORT
  292. #define ECH1560_SUPPORT 0
  293. #endif
  294. #ifndef ECH1560_CLK_PIN
  295. #define ECH1560_CLK_PIN 4 // CLK pin for the ECH1560
  296. #endif
  297. #ifndef ECH1560_MISO_PIN
  298. #define ECH1560_MISO_PIN 5 // MISO pin for the ECH1560
  299. #endif
  300. #ifndef ECH1560_INVERTED
  301. #define ECH1560_INVERTED 0 // Signal is inverted
  302. #endif
  303. //------------------------------------------------------------------------------
  304. // Energy Monitor general settings
  305. //------------------------------------------------------------------------------
  306. #define EMON_MAX_SAMPLES 1000 // Max number of samples to get
  307. #define EMON_MAX_TIME 250 // Max time in ms to sample
  308. #define EMON_FILTER_SPEED 512 // Mobile average filter speed
  309. #define EMON_REFERENCE_VOLTAGE 3.3 // Reference voltage of the ADC
  310. #ifndef EMON_MAINS_VOLTAGE
  311. #define EMON_MAINS_VOLTAGE 230 // Mains voltage
  312. #endif
  313. #ifndef EMON_CURRENT_RATIO
  314. #define EMON_CURRENT_RATIO 30 // Current ratio in the clamp (30A/1V)
  315. #endif
  316. #ifndef EMON_REPORT_CURRENT
  317. #define EMON_REPORT_CURRENT 0 // Report current
  318. #endif
  319. #ifndef EMON_REPORT_POWER
  320. #define EMON_REPORT_POWER 1 // Report power
  321. #endif
  322. #ifndef EMON_REPORT_ENERGY
  323. #define EMON_REPORT_ENERGY 1 // Report energy
  324. #endif
  325. //------------------------------------------------------------------------------
  326. // Energy Monitor based on ADC121
  327. // Enable support by passing EMON_ADC121_SUPPORT=1 build flag
  328. //------------------------------------------------------------------------------
  329. #ifndef EMON_ADC121_SUPPORT
  330. #define EMON_ADC121_SUPPORT 0 // Do not build support by default
  331. #endif
  332. #define EMON_ADC121_I2C_ADDRESS 0x00 // 0x00 means auto
  333. //------------------------------------------------------------------------------
  334. // Energy Monitor based on ADS1X15
  335. // Enable support by passing EMON_ADS1X15_SUPPORT=1 build flag
  336. //------------------------------------------------------------------------------
  337. #ifndef EMON_ADS1X15_SUPPORT
  338. #define EMON_ADS1X15_SUPPORT 0 // Do not build support by default
  339. #endif
  340. #define EMON_ADS1X15_I2C_ADDRESS 0x00 // 0x00 means auto
  341. #define EMON_ADS1X15_TYPE ADS1X15_CHIP_ADS1115
  342. #define EMON_ADS1X15_GAIN ADS1X15_REG_CONFIG_PGA_4_096V
  343. #define EMON_ADS1X15_MASK 0x0F // A0=1 A1=2 A2=4 A3=8
  344. //------------------------------------------------------------------------------
  345. // Energy Monitor based on interval analog GPIO
  346. // Enable support by passing EMON_ANALOG_SUPPORT=1 build flag
  347. //------------------------------------------------------------------------------
  348. #ifndef EMON_ANALOG_SUPPORT
  349. #define EMON_ANALOG_SUPPORT 0 // Do not build support by default
  350. #endif
  351. //------------------------------------------------------------------------------
  352. // Counter sensor
  353. // Enable support by passing EVENTS_SUPPORT=1 build flag
  354. //------------------------------------------------------------------------------
  355. #ifndef EVENTS_SUPPORT
  356. #define EVENTS_SUPPORT 0 // Do not build with counter support by default
  357. #endif
  358. #ifndef EVENTS1_TRIGGER
  359. #define EVENTS1_TRIGGER 1 // 1 to trigger callback on events,
  360. // 0 to only count them and report periodically
  361. #endif
  362. #ifndef EVENTS1_PIN
  363. #define EVENTS1_PIN 2 // GPIO to monitor
  364. #endif
  365. #ifndef EVENTS1_PIN_MODE
  366. #define EVENTS1_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  367. #endif
  368. #ifndef EVENTS1_INTERRUPT_MODE
  369. #define EVENTS1_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  370. #endif
  371. #ifndef EVENTS1_DEBOUNCE
  372. #define EVENTS1_DEBOUNCE 50 // Do not register events within less than 50 millis
  373. #endif
  374. #ifndef EVENTS2_TRIGGER
  375. #define EVENTS2_TRIGGER 1 // 1 to trigger callback on events,
  376. // 0 to only count them and report periodically
  377. #endif
  378. #ifndef EVENTS2_PIN
  379. #define EVENTS2_PIN 2 // GPIO to monitor
  380. #endif
  381. #ifndef EVENTS2_PIN_MODE
  382. #define EVENTS2_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  383. #endif
  384. #ifndef EVENTS2_INTERRUPT_MODE
  385. #define EVENTS2_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  386. #endif
  387. #ifndef EVENTS2_DEBOUNCE
  388. #define EVENTS2_DEBOUNCE 50 // Do not register events within less than 50 millis
  389. #endif
  390. #ifndef EVENTS3_TRIGGER
  391. #define EVENTS3_TRIGGER 1 // 1 to trigger callback on events,
  392. // 0 to only count them and report periodically
  393. #endif
  394. #ifndef EVENTS3_PIN
  395. #define EVENTS3_PIN 2 // GPIO to monitor
  396. #endif
  397. #ifndef EVENTS3_PIN_MODE
  398. #define EVENTS3_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  399. #endif
  400. #ifndef EVENTS3_INTERRUPT_MODE
  401. #define EVENTS3_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  402. #endif
  403. #ifndef EVENTS3_DEBOUNCE
  404. #define EVENTS3_DEBOUNCE 50 // Do not register events within less than 50 millis
  405. #endif
  406. #ifndef EVENTS4_TRIGGER
  407. #define EVENTS4_TRIGGER 1 // 1 to trigger callback on events,
  408. // 0 to only count them and report periodically
  409. #endif
  410. #ifndef EVENTS4_PIN
  411. #define EVENTS4_PIN 2 // GPIO to monitor
  412. #endif
  413. #ifndef EVENTS4_PIN_MODE
  414. #define EVENTS4_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  415. #endif
  416. #ifndef EVENTS4_INTERRUPT_MODE
  417. #define EVENTS4_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  418. #endif
  419. #ifndef EVENTS4_DEBOUNCE
  420. #define EVENTS4_DEBOUNCE 50 // Do not register events within less than 50 millis
  421. #endif
  422. #ifndef EVENTS5_TRIGGER
  423. #define EVENTS5_TRIGGER 1 // 1 to trigger callback on events,
  424. // 0 to only count them and report periodically
  425. #endif
  426. #ifndef EVENTS5_PIN
  427. #define EVENTS5_PIN 2 // GPIO to monitor
  428. #endif
  429. #ifndef EVENTS5_PIN_MODE
  430. #define EVENTS5_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  431. #endif
  432. #ifndef EVENTS5_INTERRUPT_MODE
  433. #define EVENTS5_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  434. #endif
  435. #ifndef EVENTS5_DEBOUNCE
  436. #define EVENTS5_DEBOUNCE 50 // Do not register events within less than 50 millis
  437. #endif
  438. #ifndef EVENTS6_TRIGGER
  439. #define EVENTS6_TRIGGER 1 // 1 to trigger callback on events,
  440. // 0 to only count them and report periodically
  441. #endif
  442. #ifndef EVENTS6_PIN
  443. #define EVENTS6_PIN 2 // GPIO to monitor
  444. #endif
  445. #ifndef EVENTS6_PIN_MODE
  446. #define EVENTS6_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  447. #endif
  448. #ifndef EVENTS6_INTERRUPT_MODE
  449. #define EVENTS6_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  450. #endif
  451. #ifndef EVENTS6_DEBOUNCE
  452. #define EVENTS6_DEBOUNCE 50 // Do not register events within less than 50 millis
  453. #endif
  454. #ifndef EVENTS7_TRIGGER
  455. #define EVENTS7_TRIGGER 1 // 1 to trigger callback on events,
  456. // 0 to only count them and report periodically
  457. #endif
  458. #ifndef EVENTS7_PIN
  459. #define EVENTS7_PIN 2 // GPIO to monitor
  460. #endif
  461. #ifndef EVENTS7_PIN_MODE
  462. #define EVENTS7_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  463. #endif
  464. #ifndef EVENTS7_INTERRUPT_MODE
  465. #define EVENTS7_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  466. #endif
  467. #ifndef EVENTS7_DEBOUNCE
  468. #define EVENTS7_DEBOUNCE 50 // Do not register events within less than 50 millis
  469. #endif
  470. #ifndef EVENTS8_TRIGGER
  471. #define EVENTS8_TRIGGER 1 // 1 to trigger callback on events,
  472. // 0 to only count them and report periodically
  473. #endif
  474. #ifndef EVENTS8_PIN
  475. #define EVENTS8_PIN 2 // GPIO to monitor
  476. #endif
  477. #ifndef EVENTS8_PIN_MODE
  478. #define EVENTS8_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  479. #endif
  480. #ifndef EVENTS8_INTERRUPT_MODE
  481. #define EVENTS8_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  482. #endif
  483. #ifndef EVENTS8_DEBOUNCE
  484. #define EVENTS8_DEBOUNCE 50 // Do not register events within less than 50 millis
  485. #endif
  486. //------------------------------------------------------------------------------
  487. // Geiger sensor
  488. // Enable support by passing GEIGER_SUPPORT=1 build flag
  489. //------------------------------------------------------------------------------
  490. #ifndef GEIGER_SUPPORT
  491. #define GEIGER_SUPPORT 0 // Do not build with geiger support by default
  492. #endif
  493. #ifndef GEIGER_PIN
  494. #define GEIGER_PIN D1 // GPIO to monitor "D1" => "GPIO5"
  495. #endif
  496. #ifndef GEIGER_PIN_MODE
  497. #define GEIGER_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  498. #endif
  499. #ifndef GEIGER_INTERRUPT_MODE
  500. #define GEIGER_INTERRUPT_MODE RISING // RISING, FALLING, CHANGE
  501. #endif
  502. #define GEIGER_DEBOUNCE 25 // Do not register events within less than 25 millis.
  503. // Value derived here: Debounce time 25ms, because https://github.com/Trickx/espurna/wiki/Geiger-counter
  504. #define GEIGER_CPM2SIEVERT 240 // CPM to µSievert per hour conversion factor
  505. // Typically the literature uses the invers, but I find an integer type more convienient.
  506. #define GEIGER_REPORT_SIEVERTS 1 // Enabler for local dose rate reports in µSv/h
  507. #define GEIGER_REPORT_CPM 1 // Enabler for local dose rate reports in counts per minute
  508. //------------------------------------------------------------------------------
  509. // GUVAS12SD UV Sensor (analog)
  510. // Enable support by passing GUVAS12SD_SUPPORT=1 build flag
  511. //------------------------------------------------------------------------------
  512. #ifndef GUVAS12SD_SUPPORT
  513. #define GUVAS12SD_SUPPORT 0
  514. #endif
  515. #ifndef GUVAS12SD_PIN
  516. #define GUVAS12SD_PIN 14
  517. #endif
  518. //------------------------------------------------------------------------------
  519. // HLW8012 Energy monitor IC
  520. // Enable support by passing HLW8012_SUPPORT=1 build flag
  521. //------------------------------------------------------------------------------
  522. #ifndef HLW8012_SUPPORT
  523. #define HLW8012_SUPPORT 0
  524. #endif
  525. #ifndef HLW8012_SEL_PIN
  526. #define HLW8012_SEL_PIN 5
  527. #endif
  528. #ifndef HLW8012_CF1_PIN
  529. #define HLW8012_CF1_PIN 13
  530. #endif
  531. #ifndef HLW8012_CF_PIN
  532. #define HLW8012_CF_PIN 14
  533. #endif
  534. #ifndef HLW8012_SEL_CURRENT
  535. #define HLW8012_SEL_CURRENT HIGH // SEL pin to HIGH to measure current
  536. #endif
  537. #ifndef HLW8012_CURRENT_R
  538. #define HLW8012_CURRENT_R 0.001 // Current resistor
  539. #endif
  540. #ifndef HLW8012_VOLTAGE_R_UP
  541. #define HLW8012_VOLTAGE_R_UP ( 5 * 470000 ) // Upstream voltage resistor
  542. #endif
  543. #ifndef HLW8012_VOLTAGE_R_DOWN
  544. #define HLW8012_VOLTAGE_R_DOWN ( 1000 ) // Downstream voltage resistor
  545. #endif
  546. #ifndef HLW8012_CURRENT_RATIO
  547. #define HLW8012_CURRENT_RATIO 0 // Set to 0 to use factory defaults
  548. #endif
  549. #ifndef HLW8012_VOLTAGE_RATIO
  550. #define HLW8012_VOLTAGE_RATIO 0 // Set to 0 to use factory defaults
  551. #endif
  552. #ifndef HLW8012_POWER_RATIO
  553. #define HLW8012_POWER_RATIO 0 // Set to 0 to use factory defaults
  554. #endif
  555. #ifndef HLW8012_USE_INTERRUPTS
  556. #define HLW8012_USE_INTERRUPTS 1 // Use interrupts to trap HLW8012 signals
  557. #endif
  558. #ifndef HLW8012_WAIT_FOR_WIFI
  559. #define HLW8012_WAIT_FOR_WIFI 0 // Weather to enable interrupts only after
  560. // wifi connection has been stablished
  561. #endif
  562. #ifndef HLW8012_INTERRUPT_ON
  563. #define HLW8012_INTERRUPT_ON CHANGE // When to trigger the interrupt
  564. // Use CHANGE for HLW8012
  565. // Use FALLING for BL0937 / HJL0
  566. #endif
  567. //------------------------------------------------------------------------------
  568. // LDR sensor
  569. // Enable support by passing LDR_SUPPORT=1 build flag
  570. //------------------------------------------------------------------------------
  571. #ifndef SENSOR_LUX_CORRECTION
  572. #define SENSOR_LUX_CORRECTION 0.0 // Offset correction
  573. #endif
  574. #ifndef LDR_SUPPORT
  575. #define LDR_SUPPORT 0
  576. #endif
  577. #ifndef LDR_SAMPLES
  578. #define LDR_SAMPLES 10 // Number of samples
  579. #endif
  580. #ifndef LDR_DELAY
  581. #define LDR_DELAY 0 // Delay between samples in micros
  582. #endif
  583. #ifndef LDR_TYPE
  584. #define LDR_TYPE LDR_GL5528
  585. #endif
  586. #ifndef LDR_ON_GROUND
  587. #define LDR_ON_GROUND true
  588. #endif
  589. #ifndef LDR_RESISTOR
  590. #define LDR_RESISTOR 10000 // Resistance
  591. #endif
  592. #ifndef LDR_MULTIPLICATION
  593. #define LDR_MULTIPLICATION 32017200
  594. #endif
  595. #ifndef LDR_POWER
  596. #define LDR_POWER 1.5832
  597. #endif
  598. //------------------------------------------------------------------------------
  599. // MHZ19 CO2 sensor
  600. // Enable support by passing MHZ19_SUPPORT=1 build flag
  601. //------------------------------------------------------------------------------
  602. #ifndef MHZ19_SUPPORT
  603. #define MHZ19_SUPPORT 0
  604. #endif
  605. #ifndef MHZ19_RX_PIN
  606. #define MHZ19_RX_PIN 13
  607. #endif
  608. #ifndef MHZ19_TX_PIN
  609. #define MHZ19_TX_PIN 15
  610. #endif
  611. //------------------------------------------------------------------------------
  612. // MICS-2710 (and MICS-4514) NO2 sensor
  613. // Enable support by passing MICS2710_SUPPORT=1 build flag
  614. //------------------------------------------------------------------------------
  615. #ifndef MICS2710_SUPPORT
  616. #define MICS2710_SUPPORT 0
  617. #endif
  618. #ifndef MICS2710_NOX_PIN
  619. #define MICS2710_NOX_PIN 0
  620. #endif
  621. #ifndef MICS2710_PRE_PIN
  622. #define MICS2710_PRE_PIN 4
  623. #endif
  624. #define MICS2710_PREHEAT_TIME 10000 // 10s preheat for NOX read
  625. #define MICS2710_RL 820 // RL, load resistor
  626. #define MICS2710_R0 2200 // R0 calibration value for NO2 sensor,
  627. // Typical value as per datasheet
  628. //------------------------------------------------------------------------------
  629. // MICS-5525 (and MICS-4514) CO sensor
  630. // Enable support by passing MICS5525_SUPPORT=1 build flag
  631. //------------------------------------------------------------------------------
  632. #ifndef MICS5525_SUPPORT
  633. #define MICS5525_SUPPORT 0
  634. #endif
  635. #ifndef MICS5525_RED_PIN
  636. #define MICS5525_RED_PIN 0
  637. #endif
  638. #define MICS5525_RL 820 // RL, load resistor
  639. #define MICS5525_R0 750000 // R0 calibration value for NO2 sensor,
  640. // Typical value as per datasheet
  641. //------------------------------------------------------------------------------
  642. // NTC sensor
  643. // Enable support by passing NTC_SUPPORT=1 build flag
  644. //--------------------------------------------------------------------------------
  645. #ifndef NTC_SUPPORT
  646. #define NTC_SUPPORT 0
  647. #endif
  648. #ifndef NTC_SAMPLES
  649. #define NTC_SAMPLES 10 // Number of samples
  650. #endif
  651. #ifndef NTC_DELAY
  652. #define NTC_DELAY 0 // Delay between samples in micros
  653. #endif
  654. #ifndef NTC_R_UP
  655. #define NTC_R_UP 0 // Resistor upstream, set to 0 if none
  656. #endif
  657. #ifndef NTC_R_DOWN
  658. #define NTC_R_DOWN 10000 // Resistor downstream, set to 0 if none
  659. #endif
  660. #ifndef NTC_T0
  661. #define NTC_T0 298.15 // 25 Celsius
  662. #endif
  663. #ifndef NTC_R0
  664. #define NTC_R0 10000 // Resistance at T0
  665. #endif
  666. #ifndef NTC_BETA
  667. #define NTC_BETA 3977 // Beta coeficient
  668. #endif
  669. //------------------------------------------------------------------------------
  670. // Particle Monitor based on Plantower PMS
  671. // Enable support by passing PMSX003_SUPPORT=1 build flag
  672. //------------------------------------------------------------------------------
  673. #ifndef PMSX003_SUPPORT
  674. #define PMSX003_SUPPORT 0
  675. #endif
  676. #ifndef PMS_TYPE
  677. #define PMS_TYPE PMS_TYPE_X003
  678. #endif
  679. // You can enable smart sleep (read 6-times then sleep on 24-reading-cycles) to extend PMS sensor's life.
  680. // Otherwise the default lifetime of PMS sensor is about 8000-hours/1-years.
  681. // The PMS's fan will stop working on sleeping cycle, and will wake up on reading cycle.
  682. #ifndef PMS_SMART_SLEEP
  683. #define PMS_SMART_SLEEP 0
  684. #endif
  685. #ifndef PMS_USE_SOFT
  686. #define PMS_USE_SOFT 0 // If PMS_USE_SOFT == 1, DEBUG_SERIAL_SUPPORT must be 0
  687. #endif
  688. #ifndef PMS_RX_PIN
  689. #define PMS_RX_PIN 13 // Software serial RX GPIO (if PMS_USE_SOFT == 1)
  690. #endif
  691. #ifndef PMS_TX_PIN
  692. #define PMS_TX_PIN 15 // Software serial TX GPIO (if PMS_USE_SOFT == 1)
  693. #endif
  694. #ifndef PMS_HW_PORT
  695. #define PMS_HW_PORT Serial // Hardware serial port (if PMS_USE_SOFT == 0)
  696. #endif
  697. //------------------------------------------------------------------------------
  698. // Pulse Meter Energy monitor
  699. // Enable support by passing PULSEMETER_SUPPORT=1 build flag
  700. //------------------------------------------------------------------------------
  701. #ifndef PULSEMETER_SUPPORT
  702. #define PULSEMETER_SUPPORT 0
  703. #endif
  704. #ifndef PULSEMETER_PIN
  705. #define PULSEMETER_PIN 5
  706. #endif
  707. #ifndef PULSEMETER_ENERGY_RATIO
  708. #define PULSEMETER_ENERGY_RATIO 4000 // In pulses/kWh
  709. #endif
  710. #ifndef PULSEMETER_INTERRUPT_ON
  711. #define PULSEMETER_INTERRUPT_ON FALLING
  712. #endif
  713. #ifndef PULSEMETER_DEBOUNCE
  714. #define PULSEMETER_DEBOUNCE 50 // Do not register pulses within less than 50 millis
  715. #endif
  716. //------------------------------------------------------------------------------
  717. // PZEM004T based power monitor
  718. // Enable support by passing PZEM004T_SUPPORT=1 build flag
  719. //------------------------------------------------------------------------------
  720. #ifndef PZEM004T_SUPPORT
  721. #define PZEM004T_SUPPORT 0
  722. #endif
  723. #ifndef PZEM004T_USE_SOFT
  724. #define PZEM004T_USE_SOFT 0 // Software serial is not working atm, use hardware serial
  725. #endif
  726. #ifndef PZEM004T_RX_PIN
  727. #define PZEM004T_RX_PIN 13 // Software serial RX GPIO (if PZEM004T_USE_SOFT == 1)
  728. #endif
  729. #ifndef PZEM004T_TX_PIN
  730. #define PZEM004T_TX_PIN 15 // Software serial TX GPIO (if PZEM004T_USE_SOFT == 1)
  731. #endif
  732. #ifndef PZEM004T_HW_PORT
  733. #define PZEM004T_HW_PORT Serial // Hardware serial port (if PZEM004T_USE_SOFT == 0)
  734. #endif
  735. #ifndef PZEM004T_ADDRESSES
  736. #define PZEM004T_ADDRESSES "192.168.1.1" // Device(s) address(es), separated by space, "192.168.1.1 192.168.1.2 192.168.1.3"
  737. #endif
  738. #ifndef PZEM004T_READ_INTERVAL
  739. #define PZEM004T_READ_INTERVAL 1500 // Read interval between same device
  740. #endif
  741. #ifndef PZEM004T_MAX_DEVICES
  742. #define PZEM004T_MAX_DEVICES 3
  743. #endif
  744. //------------------------------------------------------------------------------
  745. // SDS011 particulates sensor
  746. // Enable support by passing SDS011_SUPPORT=1 build flag
  747. //------------------------------------------------------------------------------
  748. #ifndef SDS011_SUPPORT
  749. #define SDS011_SUPPORT 0
  750. #endif
  751. #ifndef SDS011_RX_PIN
  752. #define SDS011_RX_PIN 14
  753. #endif
  754. #ifndef SDS011_TX_PIN
  755. #define SDS011_TX_PIN 12
  756. #endif
  757. //------------------------------------------------------------------------------
  758. // SenseAir CO2 sensor
  759. // Enable support by passing SENSEAIR_SUPPORT=1 build flag
  760. //------------------------------------------------------------------------------
  761. #ifndef SENSEAIR_SUPPORT
  762. #define SENSEAIR_SUPPORT 0
  763. #endif
  764. #ifndef SENSEAIR_RX_PIN
  765. #define SENSEAIR_RX_PIN 0
  766. #endif
  767. #ifndef SENSEAIR_TX_PIN
  768. #define SENSEAIR_TX_PIN 2
  769. #endif
  770. //------------------------------------------------------------------------------
  771. // SHT3X I2C (Wemos) temperature & humidity sensor
  772. // Enable support by passing SHT3X_I2C_SUPPORT=1 build flag
  773. //------------------------------------------------------------------------------
  774. #ifndef SHT3X_I2C_SUPPORT
  775. #define SHT3X_I2C_SUPPORT 0
  776. #endif
  777. #ifndef SHT3X_I2C_ADDRESS
  778. #define SHT3X_I2C_ADDRESS 0x00 // 0x00 means auto
  779. #endif
  780. //------------------------------------------------------------------------------
  781. // SI7021 temperature & humidity sensor
  782. // Enable support by passing SI7021_SUPPORT=1 build flag
  783. //------------------------------------------------------------------------------
  784. #ifndef SI7021_SUPPORT
  785. #define SI7021_SUPPORT 0
  786. #endif
  787. #ifndef SI7021_ADDRESS
  788. #define SI7021_ADDRESS 0x00 // 0x00 means auto
  789. #endif
  790. //------------------------------------------------------------------------------
  791. // Sonar
  792. // Enable support by passing SONAR_SUPPORT=1 build flag
  793. //------------------------------------------------------------------------------
  794. #ifndef SONAR_SUPPORT
  795. #define SONAR_SUPPORT 0
  796. #endif
  797. #ifndef SONAR_TRIGGER
  798. #define SONAR_TRIGGER 12 // GPIO for the trigger pin (output)
  799. #endif
  800. #ifndef SONAR_ECHO
  801. #define SONAR_ECHO 14 // GPIO for the echo pin (input)
  802. #endif
  803. #ifndef SONAR_MAX_DISTANCE
  804. #define SONAR_MAX_DISTANCE MAX_SENSOR_DISTANCE // Max sensor distance in cm
  805. #endif
  806. #ifndef SONAR_ITERATIONS
  807. #define SONAR_ITERATIONS 5 // Number of iterations to ping for
  808. #endif // error correction.
  809. //------------------------------------------------------------------------------
  810. // T6613 CO2 sensor
  811. // Enable support by passing T6613_SUPPORT=1 build flag
  812. //------------------------------------------------------------------------------
  813. #ifndef T6613_SUPPORT
  814. #define T6613_SUPPORT 0
  815. #endif
  816. #ifndef T6613_RX_PIN
  817. #define T6613_RX_PIN 4
  818. #endif
  819. #ifndef T6613_TX_PIN
  820. #define T6613_TX_PIN 5
  821. #endif
  822. //------------------------------------------------------------------------------
  823. // TMP3X analog temperature sensor
  824. // Enable support by passing TMP3X_SUPPORT=1 build flag
  825. //------------------------------------------------------------------------------
  826. #ifndef TMP3X_SUPPORT
  827. #define TMP3X_SUPPORT 0
  828. #endif
  829. #ifndef TMP3X_TYPE
  830. #define TMP3X_TYPE TMP3X_TMP35
  831. #endif
  832. //------------------------------------------------------------------------------
  833. // V9261F based power sensor
  834. // Enable support by passing SI7021_SUPPORT=1 build flag
  835. //------------------------------------------------------------------------------
  836. #ifndef V9261F_SUPPORT
  837. #define V9261F_SUPPORT 0
  838. #endif
  839. #ifndef V9261F_PIN
  840. #define V9261F_PIN 2 // TX pin from the V9261F
  841. #endif
  842. #ifndef V9261F_PIN_INVERSE
  843. #define V9261F_PIN_INVERSE 1 // Signal is inverted
  844. #endif
  845. #define V9261F_SYNC_INTERVAL 600 // Sync signal length (ms)
  846. #define V9261F_BAUDRATE 4800 // UART baudrate
  847. // Default ratios
  848. #define V9261F_CURRENT_FACTOR 79371434.0
  849. #define V9261F_VOLTAGE_FACTOR 4160651.0
  850. #define V9261F_POWER_FACTOR 153699.0
  851. #define V9261F_RPOWER_FACTOR V9261F_CURRENT_FACTOR
  852. //------------------------------------------------------------------------------
  853. // VEML6075 based power sensor
  854. // Enable support by passing VEML6075_SUPPORT=1 build flag
  855. //------------------------------------------------------------------------------
  856. #ifndef VEML6075_SUPPORT
  857. #define VEML6075_SUPPORT 0
  858. #endif
  859. #ifndef VEML6075_INTEGRATION_TIME
  860. #define VEML6075_INTEGRATION_TIME VEML6075::IT_100MS // The time, in milliseconds, allocated for a single
  861. #endif // measurement. A longer timing budget allows for more
  862. // accurate results at the cost of power.
  863. #ifndef VEML6075_DYNAMIC_MODE
  864. #define VEML6075_DYNAMIC_MODE VEML6075::DYNAMIC_NORMAL // The dynamic mode can either be normal or high. In high
  865. #endif // dynamic mode, the resolution increases by about two
  866. // times.
  867. //------------------------------------------------------------------------------
  868. // VL53L1X
  869. // Enable support by passing VL53L1X_SUPPORT=1 build flag
  870. //------------------------------------------------------------------------------
  871. #ifndef VL53L1X_SUPPORT
  872. #define VL53L1X_SUPPORT 0
  873. #endif
  874. #ifndef VL53L1X_I2C_ADDRESS
  875. #define VL53L1X_I2C_ADDRESS 0x00 // 0x00 means auto
  876. #endif
  877. #ifndef VL53L1X_DISTANCE_MODE
  878. #define VL53L1X_DISTANCE_MODE VL53L1X::Long // The distance mode of the sensor. Can be one of
  879. #endif // `VL53L1X::Short`, `VL53L1X::Medium`, or `VL53L1X::Long.
  880. // Shorter distance modes are less affected by ambient light
  881. // but have lower maximum ranges, especially in the dark.
  882. #ifndef VL53L1X_MEASUREMENT_TIMING_BUDGET
  883. #define VL53L1X_MEASUREMENT_TIMING_BUDGET 140000 // The time, in microseconds, allocated for a single
  884. // measurement. A longer timing budget allows for more
  885. // accurate at the cost of power. The minimum budget is
  886. // 20 ms (20000 us) in short distance mode and 33 ms for
  887. // medium and long distance modes.
  888. #endif
  889. #ifndef VL53L1X_INTER_MEASUREMENT_PERIOD
  890. #define VL53L1X_INTER_MEASUREMENT_PERIOD 50 // Period, in milliseconds, determining how
  891. #endif // often the sensor takes a measurement.
  892. //------------------------------------------------------------------------------
  893. // MAX6675
  894. // Enable support by passing MAX6675_SUPPORT=1 build flag
  895. //------------------------------------------------------------------------------
  896. #ifndef MAX6675_CS_PIN
  897. #define MAX6675_CS_PIN 13
  898. #endif
  899. #ifndef MAX6675_SO_PIN
  900. #define MAX6675_SO_PIN 12
  901. #endif
  902. #ifndef MAX6675_SCK_PIN
  903. #define MAX6675_SCK_PIN 14
  904. #endif
  905. //------------------------------------------------------------------------------
  906. // EZOPH pH meter
  907. // Enable support by passing EZOPH_SUPPORT=1 build flag
  908. //------------------------------------------------------------------------------
  909. #ifndef EZOPH_SUPPORT
  910. #define EZOPH_SUPPORT 0
  911. #endif
  912. #ifndef EZOPH_RX_PIN
  913. #define EZOPH_RX_PIN 13 // Software serial RX GPIO
  914. #endif
  915. #ifndef EZOPH_TX_PIN
  916. #define EZOPH_TX_PIN 15 // Software serial TX GPIO
  917. #endif
  918. #ifndef EZOPH_SYNC_INTERVAL
  919. #define EZOPH_SYNC_INTERVAL 1000 // Amount of time (in ms) sync new readings.
  920. #endif
  921. // =============================================================================
  922. // Sensor helpers configuration - can't move to dependencies.h
  923. // =============================================================================
  924. #ifndef SENSOR_SUPPORT
  925. #define SENSOR_SUPPORT ( \
  926. AM2320_SUPPORT || \
  927. ANALOG_SUPPORT || \
  928. BH1750_SUPPORT || \
  929. BMP180_SUPPORT || \
  930. BMX280_SUPPORT || \
  931. CSE7766_SUPPORT || \
  932. DALLAS_SUPPORT || \
  933. DHT_SUPPORT || \
  934. DIGITAL_SUPPORT || \
  935. ECH1560_SUPPORT || \
  936. EMON_ADC121_SUPPORT || \
  937. EMON_ADS1X15_SUPPORT || \
  938. EMON_ANALOG_SUPPORT || \
  939. EVENTS_SUPPORT || \
  940. EZOPH_SUPPORT || \
  941. GEIGER_SUPPORT || \
  942. GUVAS12SD_SUPPORT || \
  943. HLW8012_SUPPORT || \
  944. LDR_SUPPORT || \
  945. MAX6675_SUPPORT || \
  946. MICS2710_SUPPORT || \
  947. MICS5525_SUPPORT || \
  948. MHZ19_SUPPORT || \
  949. NTC_SUPPORT || \
  950. SDS011_SUPPORT || \
  951. SENSEAIR_SUPPORT || \
  952. PMSX003_SUPPORT || \
  953. PZEM004T_SUPPORT || \
  954. PULSEMETER_SUPPORT || \
  955. SHT3X_I2C_SUPPORT || \
  956. SI7021_SUPPORT || \
  957. SONAR_SUPPORT || \
  958. T6613_SUPPORT || \
  959. TMP3X_SUPPORT || \
  960. V9261F_SUPPORT || \
  961. VEML6075_SUPPORT || \
  962. VL53L1X_SUPPORT || \
  963. ADE7953_SUPPORT \
  964. )
  965. #endif
  966. // -----------------------------------------------------------------------------
  967. // ADC
  968. // -----------------------------------------------------------------------------
  969. // Default ADC mode is to monitor internal power supply
  970. #ifndef ADC_MODE_VALUE
  971. #define ADC_MODE_VALUE ADC_VCC
  972. #endif
  973. // -----------------------------------------------------------------------------
  974. // I2C
  975. // -----------------------------------------------------------------------------
  976. #ifndef I2C_SUPPORT
  977. #define I2C_SUPPORT 0 // I2C enabled (1.98Kb)
  978. #endif
  979. #define I2C_USE_BRZO 0 // Use brzo_i2c library or standard Wire
  980. #ifndef I2C_SDA_PIN
  981. #define I2C_SDA_PIN SDA // SDA GPIO (Sonoff => 4)
  982. #endif
  983. #ifndef I2C_SCL_PIN
  984. #define I2C_SCL_PIN SCL // SCL GPIO (Sonoff => 14)
  985. #endif
  986. #define I2C_CLOCK_STRETCH_TIME 200 // BRZO clock stretch time
  987. #define I2C_SCL_FREQUENCY 1000 // BRZO SCL frequency
  988. #define I2C_CLEAR_BUS 0 // Clear I2C bus on boot
  989. #define I2C_PERFORM_SCAN 1 // Perform a bus scan on boot
  990. // -----------------------------------------------------------------------------
  991. // ADE7953 Shelly Sensor
  992. // Enable support by passing ADE7953_SUPPORT=1 build flag
  993. // -----------------------------------------------------------------------------
  994. #ifndef ADE7953_SUPPORT
  995. #define ADE7953_SUPPORT 0
  996. #endif
  997. #ifndef ADE7953_ADDRESS
  998. #define ADE7953_ADDRESS 0x38
  999. #endif
  1000. //--------------------------------------------------------------------------------
  1001. // Class loading
  1002. //--------------------------------------------------------------------------------
  1003. #if SENSOR_SUPPORT
  1004. #if AM2320_SUPPORT
  1005. #include "../sensors/AM2320Sensor.h"
  1006. #endif
  1007. #if ANALOG_SUPPORT
  1008. #include "../sensors/AnalogSensor.h"
  1009. #endif
  1010. #if BH1750_SUPPORT
  1011. #include "../sensors/BH1750Sensor.h"
  1012. #endif
  1013. #if BMP180_SUPPORT
  1014. #include "../sensors/BMP180Sensor.h"
  1015. #endif
  1016. #if BMX280_SUPPORT
  1017. #include "../sensors/BMX280Sensor.h"
  1018. #endif
  1019. #if CSE7766_SUPPORT
  1020. #include "../sensors/CSE7766Sensor.h"
  1021. #endif
  1022. #if DALLAS_SUPPORT
  1023. #include "../sensors/DallasSensor.h"
  1024. #endif
  1025. #if DHT_SUPPORT
  1026. #include "../sensors/DHTSensor.h"
  1027. #endif
  1028. #if DIGITAL_SUPPORT
  1029. #include "../sensors/DigitalSensor.h"
  1030. #endif
  1031. #if ECH1560_SUPPORT
  1032. #include "../sensors/ECH1560Sensor.h"
  1033. #endif
  1034. #if EMON_ADC121_SUPPORT
  1035. #include "../sensors/EmonADC121Sensor.h"
  1036. #endif
  1037. #if EMON_ADS1X15_SUPPORT
  1038. #include "../sensors/EmonADS1X15Sensor.h"
  1039. #endif
  1040. #if EMON_ANALOG_SUPPORT
  1041. #include "../sensors/EmonAnalogSensor.h"
  1042. #endif
  1043. #if EVENTS_SUPPORT
  1044. #include "../sensors/EventSensor.h"
  1045. #endif
  1046. #if EZOPH_SUPPORT
  1047. #include "../sensors/EZOPHSensor.h"
  1048. #endif
  1049. #if GEIGER_SUPPORT
  1050. #include "../sensors/GeigerSensor.h"
  1051. #endif
  1052. #if GUVAS12SD_SUPPORT
  1053. #include "../sensors/GUVAS12SDSensor.h"
  1054. #endif
  1055. #if HLW8012_SUPPORT
  1056. #include "../sensors/HLW8012Sensor.h"
  1057. #endif
  1058. #if LDR_SUPPORT
  1059. #include "../sensors/LDRSensor.h"
  1060. #endif
  1061. #if MAX6675_SUPPORT
  1062. #include "../sensors/MAX6675Sensor.h"
  1063. #endif
  1064. #if MICS2710_SUPPORT
  1065. #include "../sensors/MICS2710Sensor.h"
  1066. #endif
  1067. #if MICS5525_SUPPORT
  1068. #include "../sensors/MICS5525Sensor.h"
  1069. #endif
  1070. #if MHZ19_SUPPORT
  1071. #include "../sensors/MHZ19Sensor.h"
  1072. #endif
  1073. #if NTC_SUPPORT
  1074. #include "../sensors/NTCSensor.h"
  1075. #endif
  1076. #if SDS011_SUPPORT
  1077. #include "../sensors/SDS011Sensor.h"
  1078. #endif
  1079. #if SENSEAIR_SUPPORT
  1080. #include "../sensors/SenseAirSensor.h"
  1081. #endif
  1082. #if PMSX003_SUPPORT
  1083. #include "../sensors/PMSX003Sensor.h"
  1084. #endif
  1085. #if PULSEMETER_SUPPORT
  1086. #include "../sensors/PulseMeterSensor.h"
  1087. #endif
  1088. #if PZEM004T_SUPPORT
  1089. #include "../sensors/PZEM004TSensor.h"
  1090. #endif
  1091. #if SHT3X_I2C_SUPPORT
  1092. #include "../sensors/SHT3XI2CSensor.h"
  1093. #endif
  1094. #if SI7021_SUPPORT
  1095. #include "../sensors/SI7021Sensor.h"
  1096. #endif
  1097. #if SONAR_SUPPORT
  1098. #include "../sensors/SonarSensor.h"
  1099. #endif
  1100. #if T6613_SUPPORT
  1101. #include "../sensors/T6613Sensor.h"
  1102. #endif
  1103. #if TMP3X_SUPPORT
  1104. #include "../sensors/TMP3XSensor.h"
  1105. #endif
  1106. #if V9261F_SUPPORT
  1107. #include "../sensors/V9261FSensor.h"
  1108. #endif
  1109. #if VEML6075_SUPPORT
  1110. #include "../sensors/VEML6075Sensor.h"
  1111. #endif
  1112. #if VL53L1X_SUPPORT
  1113. #include "../sensors/VL53L1XSensor.h"
  1114. #endif
  1115. #if ADE7953_SUPPORT
  1116. #include "../sensors/ADE7953Sensor.h"
  1117. #endif
  1118. #endif // SENSOR_SUPPORT