support_features.ino 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. /*
  2. support_features.ino - feature support for Sonoff-Tasmota
  3. Copyright (C) 2018 Theo Arends
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. /*********************************************************************************************\
  16. * Fill feature list
  17. \*********************************************************************************************/
  18. void GetFeatures(void)
  19. {
  20. feature_drv1 = 0x00000000; // xdrv_01_mqtt.ino, xdrv_01_light.ino, xdrv_04_snfbridge.ino
  21. // feature_drv1 |= 0x00000001;
  22. // feature_drv1 |= 0x00000002;
  23. #ifdef USE_I2C
  24. feature_drv1 |= 0x00000004; // sonoff.ino
  25. #endif
  26. #ifdef USE_SPI
  27. feature_drv1 |= 0x00000008; // sonoff.ino
  28. #endif
  29. #ifdef USE_DISCOVERY
  30. feature_drv1 |= 0x00000010; // sonoff.ino
  31. #endif
  32. #ifdef USE_ARDUINO_OTA
  33. feature_drv1 |= 0x00000020; // sonoff.ino
  34. #endif
  35. #ifdef USE_MQTT_TLS
  36. feature_drv1 |= 0x00000040; // sonoff.ino
  37. #endif
  38. #ifdef USE_WEBSERVER
  39. feature_drv1 |= 0x00000080; // xdrv_02_webserver.ino
  40. #endif
  41. #ifdef WEBSERVER_ADVERTISE
  42. feature_drv1 |= 0x00000100; // xdrv_02_webserver.ino
  43. #endif
  44. #ifdef USE_EMULATION
  45. feature_drv1 |= 0x00000200; // xplg_wemohue.ino
  46. #endif
  47. #if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT)
  48. feature_drv1 |= 0x00000400; // xdrv_01_mqtt.ino
  49. #endif
  50. #if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
  51. feature_drv1 |= 0x00000800; // xdrv_01_mqtt.ino
  52. #endif
  53. #if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) // Obsolete since 6.2.1.11
  54. feature_drv1 |= 0x00001000; // xdrv_01_mqtt.ino
  55. #endif
  56. #ifdef MQTT_HOST_DISCOVERY
  57. feature_drv1 |= 0x00002000; // xdrv_01_mqtt.ino
  58. #endif
  59. #ifdef USE_ARILUX_RF
  60. feature_drv1 |= 0x00004000; // xdrv_04_light.ino
  61. #endif
  62. #ifdef USE_WS2812
  63. feature_drv1 |= 0x00008000; // xdrv_04_light.ino
  64. #endif
  65. #ifdef USE_WS2812_DMA
  66. feature_drv1 |= 0x00010000; // xdrv_04_light.ino
  67. #endif
  68. #ifdef USE_IR_REMOTE
  69. feature_drv1 |= 0x00020000; // xdrv_05_irremote.ino
  70. #endif
  71. #ifdef USE_IR_HVAC
  72. feature_drv1 |= 0x00040000; // xdrv_05_irremote.ino
  73. #endif
  74. #ifdef USE_IR_RECEIVE
  75. feature_drv1 |= 0x00080000; // xdrv_05_irremote.ino
  76. #endif
  77. #ifdef USE_DOMOTICZ
  78. feature_drv1 |= 0x00100000; // xdrv_07_domoticz.ino
  79. #endif
  80. #ifdef USE_DISPLAY
  81. feature_drv1 |= 0x00200000; // xdrv_13_display.ino
  82. #endif
  83. #ifdef USE_HOME_ASSISTANT
  84. feature_drv1 |= 0x00400000; // xdrv_12_home_assistant.ino
  85. #endif
  86. #ifdef USE_SERIAL_BRIDGE
  87. feature_drv1 |= 0x00800000; // xdrv_08_serial_bridge.ino
  88. #endif
  89. #ifdef USE_TIMERS
  90. feature_drv1 |= 0x01000000; // xdrv_09_timers.ino
  91. #endif
  92. #ifdef USE_SUNRISE
  93. feature_drv1 |= 0x02000000; // xdrv_09_timers.ino
  94. #endif
  95. #ifdef USE_TIMERS_WEB
  96. feature_drv1 |= 0x04000000; // xdrv_09_timers.ino
  97. #endif
  98. #ifdef USE_RULES
  99. feature_drv1 |= 0x08000000; // xdrv_10_rules.ino
  100. #endif
  101. #ifdef USE_KNX
  102. feature_drv1 |= 0x10000000; // xdrv_11_knx.ino
  103. #endif
  104. #ifdef USE_WPS
  105. feature_drv1 |= 0x20000000; // support.ino
  106. #endif
  107. #ifdef USE_SMARTCONFIG
  108. feature_drv1 |= 0x40000000; // support.ino
  109. #endif
  110. #if (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT)
  111. feature_drv1 |= 0x80000000; // xdrv_01_mqtt.ino
  112. #endif
  113. /*********************************************************************************************/
  114. feature_drv2 = 0x00000000;
  115. #ifdef USE_CONFIG_OVERRIDE
  116. feature_drv2 |= 0x00000001; // user_config(_override).h
  117. #endif
  118. #ifdef BE_MINIMAL
  119. feature_drv2 |= 0x00000002; // user_config(_override).h
  120. #endif
  121. #ifdef USE_SENSORS
  122. feature_drv2 |= 0x00000004; // user_config(_override).h
  123. #endif
  124. #ifdef USE_CLASSIC
  125. feature_drv2 |= 0x00000008; // user_config(_override).h
  126. #endif
  127. #ifdef USE_KNX_NO_EMULATION
  128. feature_drv2 |= 0x00000010; // user_config(_override).h
  129. #endif
  130. #ifdef USE_DISPLAY_MODES1TO5
  131. feature_drv2 |= 0x00000020; // xdrv_13_display.ino
  132. #endif
  133. #ifdef USE_DISPLAY_GRAPH
  134. feature_drv2 |= 0x00000040; // xdrv_13_display.ino
  135. #endif
  136. #ifdef USE_DISPLAY_LCD
  137. feature_drv2 |= 0x00000080; // xdsp_01_lcd.ino
  138. #endif
  139. #ifdef USE_DISPLAY_SSD1306
  140. feature_drv2 |= 0x00000100; // xdsp_02_ssd1306.ino
  141. #endif
  142. #ifdef USE_DISPLAY_MATRIX
  143. feature_drv2 |= 0x00000200; // xdsp_03_matrix.ino
  144. #endif
  145. #ifdef USE_DISPLAY_ILI9341
  146. feature_drv2 |= 0x00000400; // xdsp_04_ili9341.ino
  147. #endif
  148. #ifdef USE_DISPLAY_EPAPER_29
  149. feature_drv2 |= 0x00000800; // xdsp_05_epaper.ino
  150. #endif
  151. #ifdef USE_DISPLAY_SH1106
  152. feature_drv2 |= 0x00001000; // xdsp_06_sh1106.ino
  153. #endif
  154. #ifdef USE_MP3_PLAYER
  155. feature_drv2 |= 0x00002000; // xdrv_14_mp3.ino
  156. #endif
  157. #ifdef USE_PCA9685
  158. feature_drv2 |= 0x00004000; // xdrv_15_pca9685.ino
  159. #endif
  160. #ifdef USE_TUYA_DIMMER
  161. feature_drv2 |= 0x00008000; // xdrv_16_tuyadimmer.ino
  162. #endif
  163. #ifdef USE_RC_SWITCH
  164. feature_drv2 |= 0x00010000; // xdrv_17_rcswitch.ino
  165. #endif
  166. #ifdef USE_ARMTRONIX_DIMMERS
  167. feature_drv2 |= 0x00020000; // xdrv_18_armtronixdimmer.ino
  168. #endif
  169. // feature_drv2 |= 0x00040000;
  170. // feature_drv2 |= 0x00080000;
  171. // feature_drv2 |= 0x00100000;
  172. // feature_drv2 |= 0x00200000;
  173. // feature_drv2 |= 0x00400000;
  174. #ifdef NO_EXTRA_4K_HEAP
  175. feature_drv2 |= 0x00800000; // sonoff_post.h
  176. #endif
  177. #ifdef VTABLES_IN_IRAM
  178. feature_drv2 |= 0x01000000; // platformio.ini
  179. #endif
  180. #ifdef VTABLES_IN_DRAM
  181. feature_drv2 |= 0x02000000; // platformio.ini
  182. #endif
  183. #ifdef VTABLES_IN_FLASH
  184. feature_drv2 |= 0x04000000; // platformio.ini
  185. #endif
  186. #ifdef PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
  187. feature_drv2 |= 0x08000000; // platformio.ini
  188. #endif
  189. #ifdef PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
  190. feature_drv2 |= 0x10000000; // platformio.ini
  191. #endif
  192. #ifdef PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
  193. feature_drv2 |= 0x20000000; // platformio.ini
  194. #endif
  195. #ifdef DEBUG_THEO
  196. feature_drv2 |= 0x40000000; // xdrv_99_debug.ino
  197. #endif
  198. #ifdef USE_DEBUG_DRIVER
  199. feature_drv2 |= 0x80000000; // xdrv_99_debug.ino
  200. #endif
  201. /*********************************************************************************************/
  202. feature_sns1 = 0x00000000; // xsns_01_counter.ino, xsns_04_snfsc.ino
  203. // feature_sns1 |= 0x00000001;
  204. #ifdef USE_ADC_VCC
  205. feature_sns1 |= 0x00000002; // support.ino (ADC)
  206. #endif
  207. #ifdef USE_ENERGY_SENSOR
  208. feature_sns1 |= 0x00000004; // xdrv_03_energy.ino
  209. #endif
  210. #ifdef USE_PZEM004T
  211. feature_sns1 |= 0x00000008; // xnrg_03_pzem004t.ino
  212. #endif
  213. #ifdef USE_DS18B20
  214. feature_sns1 |= 0x00000010; // xsns_05_ds18b20.ino
  215. #endif
  216. #ifdef USE_DS18x20_LEGACY
  217. feature_sns1 |= 0x00000020; // xsns_05_ds18x20_legacy.ino
  218. #endif
  219. #ifdef USE_DS18x20
  220. feature_sns1 |= 0x00000040; // xsns_05_ds18x20.ino
  221. #endif
  222. #ifdef USE_DHT
  223. feature_sns1 |= 0x00000080; // xsns_06_dht.ino
  224. #endif
  225. #ifdef USE_SHT
  226. feature_sns1 |= 0x00000100; // xsns_07_sht1x.ino
  227. #endif
  228. #ifdef USE_HTU
  229. feature_sns1 |= 0x00000200; // xsns_08_htu21.ino
  230. #endif
  231. #ifdef USE_BMP
  232. feature_sns1 |= 0x00000400; // xsns_09_bmp.ino
  233. #endif
  234. #ifdef USE_BME680
  235. feature_sns1 |= 0x00000800; // xsns_09_bmp.ino - BME680
  236. #endif
  237. #ifdef USE_BH1750
  238. feature_sns1 |= 0x00001000; // xsns_10_bh1750.ino
  239. #endif
  240. #ifdef USE_VEML6070
  241. feature_sns1 |= 0x00002000; // xsns_11_veml6070.ino
  242. #endif
  243. #ifdef USE_ADS1115_I2CDEV
  244. feature_sns1 |= 0x00004000; // xsns_12_ads1115_i2cdev.ino
  245. #endif
  246. #ifdef USE_ADS1115
  247. feature_sns1 |= 0x00008000; // xsns_12_ads1115.ino
  248. #endif
  249. #ifdef USE_INA219
  250. feature_sns1 |= 0x00010000; // xsns_13_ina219.ino
  251. #endif
  252. #ifdef USE_SHT3X
  253. feature_sns1 |= 0x00020000; // xsns_14_sht3x.ino
  254. #endif
  255. #ifdef USE_MHZ19
  256. feature_sns1 |= 0x00040000; // xsns_15_mhz19.ino
  257. #endif
  258. #ifdef USE_TSL2561
  259. feature_sns1 |= 0x00080000; // xsns_16_tsl2561.ino
  260. #endif
  261. #ifdef USE_SENSEAIR
  262. feature_sns1 |= 0x00100000; // xsns_17_senseair.ino
  263. #endif
  264. #ifdef USE_PMS5003
  265. feature_sns1 |= 0x00200000; // xsns_18_pms5003.ino
  266. #endif
  267. #ifdef USE_MGS
  268. feature_sns1 |= 0x00400000; // xsns_19_mgs.ino
  269. #endif
  270. #ifdef USE_NOVA_SDS
  271. feature_sns1 |= 0x00800000; // xsns_20_novasds.ino
  272. #endif
  273. #ifdef USE_SGP30
  274. feature_sns1 |= 0x01000000; // xsns_21_sgp30.ino
  275. #endif
  276. #ifdef USE_SR04
  277. feature_sns1 |= 0x02000000; // xsns_22_sr04.ino
  278. #endif
  279. #ifdef USE_SDM120
  280. feature_sns1 |= 0x04000000; // xsns_23_sdm120.ino
  281. #endif
  282. #ifdef USE_SI1145
  283. feature_sns1 |= 0x08000000; // xsns_24_si1145.ino
  284. #endif
  285. #ifdef USE_SDM630
  286. feature_sns1 |= 0x10000000; // xsns_25_sdm630.ino
  287. #endif
  288. #ifdef USE_LM75AD
  289. feature_sns1 |= 0x20000000; // xsns_26_lm75ad.ino
  290. #endif
  291. #ifdef USE_APDS9960
  292. feature_sns1 |= 0x40000000; // xsns_27_apds9960.ino
  293. #endif
  294. #ifdef USE_TM1638
  295. feature_sns1 |= 0x80000000; // xsns_28_tm1638.ino
  296. #endif
  297. /*********************************************************************************************/
  298. feature_sns2 = 0x00000000;
  299. #ifdef USE_MCP230xx
  300. feature_sns2 |= 0x00000001; // xsns_29_mcp230xx.ino
  301. #endif
  302. #ifdef USE_MPR121
  303. feature_sns2 |= 0x00000002; // xsns_30_mpr121.ino
  304. #endif
  305. #ifdef USE_CCS811
  306. feature_sns2 |= 0x00000004; // xsns_31_ccs811.ino
  307. #endif
  308. #ifdef USE_MPU6050
  309. feature_sns2 |= 0x00000008; // xsns_32_mpu6050.ino
  310. #endif
  311. #ifdef USE_MCP230xx_OUTPUT
  312. feature_sns2 |= 0x00000010; // xsns_29_mcp230xx.ino
  313. #endif
  314. #ifdef USE_MCP230xx_DISPLAYOUTPUT
  315. feature_sns2 |= 0x00000020; // xsns_29_mcp230xx.ino
  316. #endif
  317. #ifdef USE_HLW8012
  318. feature_sns2 |= 0x00000040; // xnrg_01_hlw8012.ino
  319. #endif
  320. #ifdef USE_CSE7766
  321. feature_sns2 |= 0x00000080; // xnrg_02_cse7766.ino
  322. #endif
  323. #ifdef USE_MCP39F501
  324. feature_sns2 |= 0x00000100; // xnrg_04_mcp39f501.ino
  325. #endif
  326. #ifdef USE_PZEM_AC
  327. feature_sns2 |= 0x00000200; // xnrg_05_pzem_ac.ino
  328. #endif
  329. #ifdef USE_DS3231
  330. feature_sns2 |= 0x00000400; // xsns_33_ds3231.ino
  331. #endif
  332. #ifdef USE_HX711
  333. feature_sns2 |= 0x00000800; // xsns_34_hx711.ino
  334. #endif
  335. #ifdef USE_PZEM_DC
  336. feature_sns2 |= 0x00001000; // xnrg_06_pzem_dc.ino
  337. #endif
  338. #ifdef USE_TX20_WIND_SENSOR
  339. feature_sns2 |= 0x00002000; // xsns_35_tx20.ino
  340. #endif
  341. #ifdef USE_MGC3130
  342. feature_sns2 |= 0x00004000; // xsns_36_mgc3130.ino
  343. #endif
  344. #ifdef USE_RF_SENSOR
  345. feature_sns2 |= 0x00008000; // xsns_37_rfsensor.ino
  346. #endif
  347. #ifdef USE_THEO_V2
  348. feature_sns2 |= 0x00010000;
  349. #endif
  350. #ifdef USE_ALECTO_V2
  351. feature_sns2 |= 0x00020000;
  352. #endif
  353. #ifdef USE_AZ7798
  354. feature_sns2 |= 0x00040000;
  355. #endif
  356. // feature_sns2 |= 0x00080000;
  357. // feature_sns2 |= 0x00100000;
  358. // feature_sns2 |= 0x00200000;
  359. // feature_sns2 |= 0x00400000;
  360. // feature_sns2 |= 0x00800000;
  361. // feature_sns2 |= 0x01000000;
  362. // feature_sns2 |= 0x02000000;
  363. // feature_sns2 |= 0x04000000;
  364. // feature_sns2 |= 0x08000000;
  365. // feature_sns2 |= 0x10000000;
  366. // feature_sns2 |= 0x20000000;
  367. // feature_sns2 |= 0x40000000;
  368. // feature_sns2 |= 0x80000000;
  369. }