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.

138 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. //--------------------------------------------------------------------------------
  38. // Analog sensor
  39. // Enable support by passing ANALOG_SUPPORT=1 build flag
  40. //--------------------------------------------------------------------------------
  41. #ifndef ANALOG_SUPPORT
  42. #define ANALOG_SUPPORT 0
  43. #endif
  44. #ifndef ANALOG_PIN
  45. #define ANALOG_PIN 0
  46. #endif
  47. #ifndef ANALOG_UPDATE_INTERVAL
  48. #define ANALOG_UPDATE_INTERVAL 60000
  49. #endif
  50. #define ANALOG_TOPIC "analog"
  51. #if ANALOG_SUPPORT
  52. #undef ADC_VCC_ENABLED
  53. #define ADC_VCC_ENABLED 0
  54. #endif
  55. //--------------------------------------------------------------------------------
  56. // Counter sensor
  57. // Enable support by passing COUNTER_SUPPORT=1 build flag
  58. //--------------------------------------------------------------------------------
  59. #ifndef COUNTER_SUPPORT
  60. #define COUNTER_SUPPORT 0 // Do not build with counter support by default
  61. #endif
  62. #ifndef COUNTER_PIN
  63. #define COUNTER_PIN 2 // GPIO to monitor
  64. #endif
  65. #ifndef COUNTER_PIN_MODE
  66. #define COUNTER_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  67. #endif
  68. #ifndef COUNTER_INTERRUPT_MODE
  69. #define COUNTER_INTERRUPT_MODE RISING // RISING, FALLING, BOTH
  70. #endif
  71. #ifndef COUNTER_UPDATE_INTERVAL
  72. #define COUNTER_UPDATE_INTERVAL 5000 // Update counter every this millis
  73. #endif
  74. #define COUNTER_REPORT_EVERY 12 // Report counter every this updates (1 minute)
  75. #define COUNTER_DEBOUNCE 10 // Do not register events within less than 10 millis
  76. #define COUNTER_TOPIC "counter" // Default topic for MQTT, API and InfluxDB
  77. //--------------------------------------------------------------------------------
  78. // DS18B20 temperature sensor
  79. // Enable support by passing DS18B20_SUPPORT=1 build flag
  80. //--------------------------------------------------------------------------------
  81. #ifndef DS18B20_SUPPORT
  82. #define DS18B20_SUPPORT 0
  83. #endif
  84. #ifndef DS18B20_PIN
  85. #define DS18B20_PIN 14
  86. #endif
  87. #ifndef DS18B20_UPDATE_INTERVAL
  88. #define DS18B20_UPDATE_INTERVAL 60000
  89. #endif
  90. #ifndef DS18B20_TEMPERATURE_TOPIC
  91. #define DS18B20_TEMPERATURE_TOPIC "temperature"
  92. #endif
  93. #ifndef DS18B20_UPDATE_ON_CHANGE
  94. #define DS18B20_UPDATE_ON_CHANGE 0.0
  95. #endif
  96. //--------------------------------------------------------------------------------
  97. // Internal power montior
  98. // Enable support by passing ADC_VCC_ENABLED=1 build flag
  99. // Do not enable this if using the analog GPIO for any other thing
  100. //--------------------------------------------------------------------------------
  101. #ifndef ADC_VCC_ENABLED
  102. #define ADC_VCC_ENABLED 1
  103. #endif
  104. #if ADC_VCC_ENABLED
  105. ADC_MODE(ADC_VCC);
  106. #endif