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.

415 lines
9.4 KiB

  1. // -----------------------------------------------------------------------------
  2. // Hardware default values
  3. // -----------------------------------------------------------------------------
  4. #define GPIO_NONE 0x99
  5. // -----------------------------------------------------------------------------
  6. // Buttons
  7. // -----------------------------------------------------------------------------
  8. #ifndef BUTTON1_PIN
  9. #define BUTTON1_PIN GPIO_NONE
  10. #endif
  11. #ifndef BUTTON2_PIN
  12. #define BUTTON2_PIN GPIO_NONE
  13. #endif
  14. #ifndef BUTTON3_PIN
  15. #define BUTTON3_PIN GPIO_NONE
  16. #endif
  17. #ifndef BUTTON4_PIN
  18. #define BUTTON4_PIN GPIO_NONE
  19. #endif
  20. #ifndef BUTTON5_PIN
  21. #define BUTTON5_PIN GPIO_NONE
  22. #endif
  23. #ifndef BUTTON6_PIN
  24. #define BUTTON6_PIN GPIO_NONE
  25. #endif
  26. #ifndef BUTTON7_PIN
  27. #define BUTTON7_PIN GPIO_NONE
  28. #endif
  29. #ifndef BUTTON8_PIN
  30. #define BUTTON8_PIN GPIO_NONE
  31. #endif
  32. #ifndef BUTTON1_PRESS
  33. #define BUTTON1_PRESS BUTTON_MODE_NONE
  34. #endif
  35. #ifndef BUTTON2_PRESS
  36. #define BUTTON2_PRESS BUTTON_MODE_NONE
  37. #endif
  38. #ifndef BUTTON3_PRESS
  39. #define BUTTON3_PRESS BUTTON_MODE_NONE
  40. #endif
  41. #ifndef BUTTON4_PRESS
  42. #define BUTTON4_PRESS BUTTON_MODE_NONE
  43. #endif
  44. #ifndef BUTTON5_PRESS
  45. #define BUTTON5_PRESS BUTTON_MODE_NONE
  46. #endif
  47. #ifndef BUTTON6_PRESS
  48. #define BUTTON6_PRESS BUTTON_MODE_NONE
  49. #endif
  50. #ifndef BUTTON7_PRESS
  51. #define BUTTON7_PRESS BUTTON_MODE_NONE
  52. #endif
  53. #ifndef BUTTON8_PRESS
  54. #define BUTTON8_PRESS BUTTON_MODE_NONE
  55. #endif
  56. #ifndef BUTTON1_CLICK
  57. #define BUTTON1_CLICK BUTTON_MODE_TOGGLE
  58. #endif
  59. #ifndef BUTTON2_CLICK
  60. #define BUTTON2_CLICK BUTTON_MODE_TOGGLE
  61. #endif
  62. #ifndef BUTTON3_CLICK
  63. #define BUTTON3_CLICK BUTTON_MODE_TOGGLE
  64. #endif
  65. #ifndef BUTTON4_CLICK
  66. #define BUTTON4_CLICK BUTTON_MODE_TOGGLE
  67. #endif
  68. #ifndef BUTTON5_CLICK
  69. #define BUTTON5_CLICK BUTTON_MODE_TOGGLE
  70. #endif
  71. #ifndef BUTTON6_CLICK
  72. #define BUTTON6_CLICK BUTTON_MODE_TOGGLE
  73. #endif
  74. #ifndef BUTTON7_CLICK
  75. #define BUTTON7_CLICK BUTTON_MODE_TOGGLE
  76. #endif
  77. #ifndef BUTTON8_CLICK
  78. #define BUTTON8_CLICK BUTTON_MODE_TOGGLE
  79. #endif
  80. #ifndef BUTTON1_DBLCLICK
  81. #define BUTTON1_DBLCLICK BUTTON_MODE_AP
  82. #endif
  83. #ifndef BUTTON2_DBLCLICK
  84. #define BUTTON2_DBLCLICK BUTTON_MODE_NONE
  85. #endif
  86. #ifndef BUTTON3_DBLCLICK
  87. #define BUTTON3_DBLCLICK BUTTON_MODE_NONE
  88. #endif
  89. #ifndef BUTTON4_DBLCLICK
  90. #define BUTTON4_DBLCLICK BUTTON_MODE_NONE
  91. #endif
  92. #ifndef BUTTON5_DBLCLICK
  93. #define BUTTON5_DBLCLICK BUTTON_MODE_NONE
  94. #endif
  95. #ifndef BUTTON6_DBLCLICK
  96. #define BUTTON6_DBLCLICK BUTTON_MODE_NONE
  97. #endif
  98. #ifndef BUTTON7_DBLCLICK
  99. #define BUTTON7_DBLCLICK BUTTON_MODE_NONE
  100. #endif
  101. #ifndef BUTTON8_DBLCLICK
  102. #define BUTTON8_DBLCLICK BUTTON_MODE_NONE
  103. #endif
  104. #ifndef BUTTON1_LNGCLICK
  105. #define BUTTON1_LNGCLICK BUTTON_MODE_RESET
  106. #endif
  107. #ifndef BUTTON2_LNGCLICK
  108. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  109. #endif
  110. #ifndef BUTTON3_LNGCLICK
  111. #define BUTTON3_LNGCLICK BUTTON_MODE_NONE
  112. #endif
  113. #ifndef BUTTON4_LNGCLICK
  114. #define BUTTON4_LNGCLICK BUTTON_MODE_NONE
  115. #endif
  116. #ifndef BUTTON5_LNGCLICK
  117. #define BUTTON5_LNGCLICK BUTTON_MODE_NONE
  118. #endif
  119. #ifndef BUTTON6_LNGCLICK
  120. #define BUTTON6_LNGCLICK BUTTON_MODE_NONE
  121. #endif
  122. #ifndef BUTTON7_LNGCLICK
  123. #define BUTTON7_LNGCLICK BUTTON_MODE_NONE
  124. #endif
  125. #ifndef BUTTON8_LNGCLICK
  126. #define BUTTON8_LNGCLICK BUTTON_MODE_NONE
  127. #endif
  128. #ifndef BUTTON1_LNGLNGCLICK
  129. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_FACTORY
  130. #endif
  131. #ifndef BUTTON2_LNGLNGCLICK
  132. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
  133. #endif
  134. #ifndef BUTTON3_LNGLNGCLICK
  135. #define BUTTON3_LNGLNGCLICK BUTTON_MODE_NONE
  136. #endif
  137. #ifndef BUTTON4_LNGLNGCLICK
  138. #define BUTTON4_LNGLNGCLICK BUTTON_MODE_NONE
  139. #endif
  140. #ifndef BUTTON5_LNGLNGCLICK
  141. #define BUTTON5_LNGLNGCLICK BUTTON_MODE_NONE
  142. #endif
  143. #ifndef BUTTON6_LNGLNGCLICK
  144. #define BUTTON6_LNGLNGCLICK BUTTON_MODE_NONE
  145. #endif
  146. #ifndef BUTTON7_LNGLNGCLICK
  147. #define BUTTON7_LNGLNGCLICK BUTTON_MODE_NONE
  148. #endif
  149. #ifndef BUTTON8_LNGLNGCLICK
  150. #define BUTTON8_LNGLNGCLICK BUTTON_MODE_NONE
  151. #endif
  152. #ifndef BUTTON1_RELAY
  153. #define BUTTON1_RELAY 0
  154. #endif
  155. #ifndef BUTTON2_RELAY
  156. #define BUTTON2_RELAY 0
  157. #endif
  158. #ifndef BUTTON3_RELAY
  159. #define BUTTON3_RELAY 0
  160. #endif
  161. #ifndef BUTTON4_RELAY
  162. #define BUTTON4_RELAY 0
  163. #endif
  164. #ifndef BUTTON5_RELAY
  165. #define BUTTON5_RELAY 0
  166. #endif
  167. #ifndef BUTTON6_RELAY
  168. #define BUTTON6_RELAY 0
  169. #endif
  170. #ifndef BUTTON7_RELAY
  171. #define BUTTON7_RELAY 0
  172. #endif
  173. #ifndef BUTTON8_RELAY
  174. #define BUTTON8_RELAY 0
  175. #endif
  176. // -----------------------------------------------------------------------------
  177. // Relays
  178. // -----------------------------------------------------------------------------
  179. #ifndef DUMMY_RELAY_COUNT
  180. #define DUMMY_RELAY_COUNT 0
  181. #endif
  182. #ifndef RELAY1_PIN
  183. #define RELAY1_PIN GPIO_NONE
  184. #endif
  185. #ifndef RELAY2_PIN
  186. #define RELAY2_PIN GPIO_NONE
  187. #endif
  188. #ifndef RELAY3_PIN
  189. #define RELAY3_PIN GPIO_NONE
  190. #endif
  191. #ifndef RELAY4_PIN
  192. #define RELAY4_PIN GPIO_NONE
  193. #endif
  194. #ifndef RELAY5_PIN
  195. #define RELAY5_PIN GPIO_NONE
  196. #endif
  197. #ifndef RELAY6_PIN
  198. #define RELAY6_PIN GPIO_NONE
  199. #endif
  200. #ifndef RELAY7_PIN
  201. #define RELAY7_PIN GPIO_NONE
  202. #endif
  203. #ifndef RELAY8_PIN
  204. #define RELAY8_PIN GPIO_NONE
  205. #endif
  206. #ifndef RELAY1_TYPE
  207. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  208. #endif
  209. #ifndef RELAY2_TYPE
  210. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  211. #endif
  212. #ifndef RELAY3_TYPE
  213. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  214. #endif
  215. #ifndef RELAY4_TYPE
  216. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  217. #endif
  218. #ifndef RELAY5_TYPE
  219. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  220. #endif
  221. #ifndef RELAY6_TYPE
  222. #define RELAY6_TYPE RELAY_TYPE_NORMAL
  223. #endif
  224. #ifndef RELAY7_TYPE
  225. #define RELAY7_TYPE RELAY_TYPE_NORMAL
  226. #endif
  227. #ifndef RELAY8_TYPE
  228. #define RELAY8_TYPE RELAY_TYPE_NORMAL
  229. #endif
  230. #ifndef RELAY1_RESET_PIN
  231. #define RELAY1_RESET_PIN GPIO_NONE
  232. #endif
  233. #ifndef RELAY2_RESET_PIN
  234. #define RELAY2_RESET_PIN GPIO_NONE
  235. #endif
  236. #ifndef RELAY3_RESET_PIN
  237. #define RELAY3_RESET_PIN GPIO_NONE
  238. #endif
  239. #ifndef RELAY4_RESET_PIN
  240. #define RELAY4_RESET_PIN GPIO_NONE
  241. #endif
  242. #ifndef RELAY5_RESET_PIN
  243. #define RELAY5_RESET_PIN GPIO_NONE
  244. #endif
  245. #ifndef RELAY6_RESET_PIN
  246. #define RELAY6_RESET_PIN GPIO_NONE
  247. #endif
  248. #ifndef RELAY7_RESET_PIN
  249. #define RELAY7_RESET_PIN GPIO_NONE
  250. #endif
  251. #ifndef RELAY8_RESET_PIN
  252. #define RELAY8_RESET_PIN GPIO_NONE
  253. #endif
  254. #ifndef RELAY1_DELAY_ON
  255. #define RELAY1_DELAY_ON 0
  256. #endif
  257. #ifndef RELAY2_DELAY_ON
  258. #define RELAY2_DELAY_ON 0
  259. #endif
  260. #ifndef RELAY3_DELAY_ON
  261. #define RELAY3_DELAY_ON 0
  262. #endif
  263. #ifndef RELAY4_DELAY_ON
  264. #define RELAY4_DELAY_ON 0
  265. #endif
  266. #ifndef RELAY5_DELAY_ON
  267. #define RELAY5_DELAY_ON 0
  268. #endif
  269. #ifndef RELAY6_DELAY_ON
  270. #define RELAY6_DELAY_ON 0
  271. #endif
  272. #ifndef RELAY7_DELAY_ON
  273. #define RELAY7_DELAY_ON 0
  274. #endif
  275. #ifndef RELAY8_DELAY_ON
  276. #define RELAY8_DELAY_ON 0
  277. #endif
  278. #ifndef RELAY1_DELAY_OFF
  279. #define RELAY1_DELAY_OFF 0
  280. #endif
  281. #ifndef RELAY2_DELAY_OFF
  282. #define RELAY2_DELAY_OFF 0
  283. #endif
  284. #ifndef RELAY3_DELAY_OFF
  285. #define RELAY3_DELAY_OFF 0
  286. #endif
  287. #ifndef RELAY4_DELAY_OFF
  288. #define RELAY4_DELAY_OFF 0
  289. #endif
  290. #ifndef RELAY5_DELAY_OFF
  291. #define RELAY5_DELAY_OFF 0
  292. #endif
  293. #ifndef RELAY6_DELAY_OFF
  294. #define RELAY6_DELAY_OFF 0
  295. #endif
  296. #ifndef RELAY7_DELAY_OFF
  297. #define RELAY7_DELAY_OFF 0
  298. #endif
  299. #ifndef RELAY8_DELAY_OFF
  300. #define RELAY8_DELAY_OFF 0
  301. #endif
  302. // -----------------------------------------------------------------------------
  303. // LEDs
  304. // -----------------------------------------------------------------------------
  305. #ifndef LED1_PIN
  306. #define LED1_PIN GPIO_NONE
  307. #endif
  308. #ifndef LED2_PIN
  309. #define LED2_PIN GPIO_NONE
  310. #endif
  311. #ifndef LED3_PIN
  312. #define LED3_PIN GPIO_NONE
  313. #endif
  314. #ifndef LED4_PIN
  315. #define LED4_PIN GPIO_NONE
  316. #endif
  317. #ifndef LED5_PIN
  318. #define LED5_PIN GPIO_NONE
  319. #endif
  320. #ifndef LED6_PIN
  321. #define LED6_PIN GPIO_NONE
  322. #endif
  323. #ifndef LED7_PIN
  324. #define LED7_PIN GPIO_NONE
  325. #endif
  326. #ifndef LED8_PIN
  327. #define LED8_PIN GPIO_NONE
  328. #endif
  329. #ifndef LED1_MODE
  330. #define LED1_MODE LED_MODE_WIFI
  331. #endif
  332. #ifndef LED2_MODE
  333. #define LED2_MODE LED_MODE_MQTT
  334. #endif
  335. #ifndef LED3_MODE
  336. #define LED3_MODE LED_MODE_MQTT
  337. #endif
  338. #ifndef LED4_MODE
  339. #define LED4_MODE LED_MODE_MQTT
  340. #endif
  341. #ifndef LED5_MODE
  342. #define LED5_MODE LED_MODE_MQTT
  343. #endif
  344. #ifndef LED6_MODE
  345. #define LED6_MODE LED_MODE_MQTT
  346. #endif
  347. #ifndef LED7_MODE
  348. #define LED7_MODE LED_MODE_MQTT
  349. #endif
  350. #ifndef LED8_MODE
  351. #define LED8_MODE LED_MODE_MQTT
  352. #endif
  353. #ifndef LED1_RELAY
  354. #define LED1_RELAY 1
  355. #endif
  356. #ifndef LED2_RELAY
  357. #define LED2_RELAY 2
  358. #endif
  359. #ifndef LED3_RELAY
  360. #define LED3_RELAY 3
  361. #endif
  362. #ifndef LED4_RELAY
  363. #define LED4_RELAY 4
  364. #endif
  365. #ifndef LED5_RELAY
  366. #define LED5_RELAY 5
  367. #endif
  368. #ifndef LED6_RELAY
  369. #define LED6_RELAY 6
  370. #endif
  371. #ifndef LED7_RELAY
  372. #define LED7_RELAY 7
  373. #endif
  374. #ifndef LED8_RELAY
  375. #define LED8_RELAY 8
  376. #endif
  377. // -----------------------------------------------------------------------------
  378. // General
  379. // -----------------------------------------------------------------------------
  380. // Default hostname will be ESPURNA_XXXXXX, where XXXXXX is last 3 octets of chipID
  381. #ifndef HOSTNAME
  382. #define HOSTNAME ""
  383. #endif
  384. // Relay providers
  385. #ifndef RELAY_PROVIDER
  386. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  387. #endif
  388. // Light provider
  389. #ifndef LIGHT_PROVIDER
  390. #define LIGHT_PROVIDER LIGHT_PROVIDER_NONE
  391. #endif