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.

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