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.

140 lines
4.1 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. //--------------------------------------------------------------------------------
  2. // Custom RF module
  3. // Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  4. // Enable support by passing RF_SUPPORT=1 build flag
  5. //--------------------------------------------------------------------------------
  6. #ifndef RF_SUPPORT
  7. #define RF_SUPPORT 0
  8. #endif
  9. #ifndef RF_PIN
  10. #define RF_PIN 14
  11. #endif
  12. #define RF_CHANNEL 31
  13. #define RF_DEVICE 1
  14. //--------------------------------------------------------------------------------
  15. // DHTXX temperature/humidity sensor
  16. // Enable support by passing DHT_SUPPORT=1 build flag
  17. //--------------------------------------------------------------------------------
  18. #ifndef DHT_SUPPORT
  19. #define DHT_SUPPORT 0
  20. #endif
  21. #ifndef DHT_PIN
  22. #define DHT_PIN 14
  23. #endif
  24. #ifndef DHT_TYPE
  25. #define DHT_TYPE DHT22
  26. #endif
  27. #ifndef DHT_UPDATE_INTERVAL
  28. #define DHT_UPDATE_INTERVAL 60000
  29. #endif
  30. #define DHT_TEMPERATURE_TOPIC "temperature"
  31. #define DHT_HUMIDITY_TOPIC "humidity"
  32. #define DHT_TEMPERATURE_DECIMALS 1 // Decimals for temperature values
  33. #define HUMIDITY_NORMAL 0
  34. #define HUMIDITY_COMFORTABLE 1
  35. #define HUMIDITY_DRY 2
  36. #define HUMIDITY_WET 3
  37. #define TEMPERATURE_CORRECTION 0.0 // This is both for DHT and DS18B20
  38. //--------------------------------------------------------------------------------
  39. // Analog sensor
  40. // Enable support by passing ANALOG_SUPPORT=1 build flag
  41. //--------------------------------------------------------------------------------
  42. #ifndef ANALOG_SUPPORT
  43. #define ANALOG_SUPPORT 0
  44. #endif
  45. #ifndef ANALOG_PIN
  46. #define ANALOG_PIN 0
  47. #endif
  48. #ifndef ANALOG_UPDATE_INTERVAL
  49. #define ANALOG_UPDATE_INTERVAL 60000
  50. #endif
  51. #define ANALOG_TOPIC "analog"
  52. #if ANALOG_SUPPORT
  53. #undef ADC_VCC_ENABLED
  54. #define ADC_VCC_ENABLED 0
  55. #endif
  56. //--------------------------------------------------------------------------------
  57. // Counter sensor
  58. // Enable support by passing COUNTER_SUPPORT=1 build flag
  59. //--------------------------------------------------------------------------------
  60. #ifndef COUNTER_SUPPORT
  61. #define COUNTER_SUPPORT 0 // Do not build with counter support by default
  62. #endif
  63. #ifndef COUNTER_PIN
  64. #define COUNTER_PIN 2 // GPIO to monitor
  65. #endif
  66. #ifndef COUNTER_PIN_MODE
  67. #define COUNTER_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  68. #endif
  69. #ifndef COUNTER_INTERRUPT_MODE
  70. #define COUNTER_INTERRUPT_MODE RISING // RISING, FALLING, BOTH
  71. #endif
  72. #ifndef COUNTER_UPDATE_INTERVAL
  73. #define COUNTER_UPDATE_INTERVAL 5000 // Update counter every this millis
  74. #endif
  75. #define COUNTER_REPORT_EVERY 12 // Report counter every this updates (1 minute)
  76. #define COUNTER_DEBOUNCE 10 // Do not register events within less than 10 millis
  77. #define COUNTER_TOPIC "counter" // Default topic for MQTT, API and InfluxDB
  78. //--------------------------------------------------------------------------------
  79. // DS18B20 temperature sensor
  80. // Enable support by passing DS18B20_SUPPORT=1 build flag
  81. //--------------------------------------------------------------------------------
  82. #ifndef DS18B20_SUPPORT
  83. #define DS18B20_SUPPORT 0
  84. #endif
  85. #ifndef DS18B20_PIN
  86. #define DS18B20_PIN 14
  87. #endif
  88. #ifndef DS18B20_UPDATE_INTERVAL
  89. #define DS18B20_UPDATE_INTERVAL 60000
  90. #endif
  91. #ifndef DS18B20_TEMPERATURE_TOPIC
  92. #define DS18B20_TEMPERATURE_TOPIC "temperature"
  93. #endif
  94. #ifndef DS18B20_UPDATE_ON_CHANGE
  95. #define DS18B20_UPDATE_ON_CHANGE 0.0
  96. #endif
  97. //--------------------------------------------------------------------------------
  98. // Internal power montior
  99. // Enable support by passing ADC_VCC_ENABLED=1 build flag
  100. // Do not enable this if using the analog GPIO for any other thing
  101. //--------------------------------------------------------------------------------
  102. #ifndef ADC_VCC_ENABLED
  103. #define ADC_VCC_ENABLED 1
  104. #endif
  105. #if ADC_VCC_ENABLED
  106. ADC_MODE(ADC_VCC);
  107. #endif