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.

96 lines
3.5 KiB

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. #define RF_PIN 14
  10. #define RF_CHANNEL 31
  11. #define RF_DEVICE 1
  12. //--------------------------------------------------------------------------------
  13. // DHTXX temperature/humidity sensor
  14. // Enable support by passing DHT_SUPPORT=1 build flag
  15. //--------------------------------------------------------------------------------
  16. #ifndef DHT_SUPPORT
  17. #define DHT_SUPPORT 0
  18. #endif
  19. #define DHT_PIN 14
  20. #define DHT_UPDATE_INTERVAL 60000
  21. #define DHT_TYPE DHT22
  22. #define DHT_TIMING 11
  23. #define DHT_TEMPERATURE_TOPIC "temperature"
  24. #define DHT_HUMIDITY_TOPIC "humidity"
  25. #define HUMIDITY_NORMAL 0
  26. #define HUMIDITY_COMFORTABLE 1
  27. #define HUMIDITY_DRY 2
  28. #define HUMIDITY_WET 3
  29. //--------------------------------------------------------------------------------
  30. // Analog sensor
  31. // Enable support by passing ANALOG_SUPPORT=1 build flag
  32. //--------------------------------------------------------------------------------
  33. #ifndef ANALOG_SUPPORT
  34. #define ANALOG_SUPPORT 0
  35. #endif
  36. #define ANALOG_PIN 0
  37. #define ANALOG_UPDATE_INTERVAL 60000
  38. #define ANALOG_TOPIC "analog"
  39. #if ANALOG_SUPPORT
  40. #undef ADC_VCC_ENABLED
  41. #define ADC_VCC_ENABLED 0
  42. #endif
  43. //--------------------------------------------------------------------------------
  44. // Counter sensor
  45. // Enable support by passing COUNTER_SUPPORT=1 build flag
  46. //--------------------------------------------------------------------------------
  47. #ifndef COUNTER_SUPPORT
  48. #define COUNTER_SUPPORT 0 // Do not build with counter support by default
  49. #endif
  50. #define COUNTER_PIN 2 // GPIO to monitor
  51. #define COUNTER_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  52. #define COUNTER_INTERRUPT_MODE RISING // RISING, FALLING, BOTH
  53. #define COUNTER_UPDATE_INTERVAL 5000 // Update counter every this millis
  54. #define COUNTER_REPORT_EVERY 12 // Report counter every this updates (1 minute)
  55. #define COUNTER_DEBOUNCE 10 // Do not register events within less than 10 millis
  56. #define COUNTER_TOPIC "counter" // Default topic for MQTT, API and InfluxDB
  57. //--------------------------------------------------------------------------------
  58. // DS18B20 temperature sensor
  59. // Enable support by passing DS18B20_SUPPORT=1 build flag
  60. //--------------------------------------------------------------------------------
  61. #ifndef DS18B20_SUPPORT
  62. #define DS18B20_SUPPORT 0
  63. #endif
  64. #define DS18B20_PIN 14
  65. #define DS18B20_UPDATE_INTERVAL 60000
  66. #define DS18B20_TEMPERATURE_TOPIC "temperature"
  67. //--------------------------------------------------------------------------------
  68. // Internal power montior
  69. // Enable support by passing ADC_VCC_ENABLED=1 build flag
  70. // Do not enable this if using the analog GPIO for any other thing
  71. //--------------------------------------------------------------------------------
  72. #ifndef ADC_VCC_ENABLED
  73. #define ADC_VCC_ENABLED 1
  74. #endif
  75. #if ADC_VCC_ENABLED
  76. ADC_MODE(ADC_VCC);
  77. #endif