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.

440 lines
10 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_TRIPLECLICK
  105. #define BUTTON1_TRIPLECLICK BUTTON_MODE_WPS
  106. #endif
  107. #ifndef BUTTON2_TRIPLECLICK
  108. #define BUTTON2_TRIPLECLICK BUTTON_MODE_NONE
  109. #endif
  110. #ifndef BUTTON3_TRIPLECLICK
  111. #define BUTTON3_TRIPLECLICK BUTTON_MODE_NONE
  112. #endif
  113. #ifndef BUTTON4_TRIPLECLICK
  114. #define BUTTON4_TRIPLECLICK BUTTON_MODE_NONE
  115. #endif
  116. #ifndef BUTTON5_TRIPLECLICK
  117. #define BUTTON5_TRIPLECLICK BUTTON_MODE_NONE
  118. #endif
  119. #ifndef BUTTON6_TRIPLECLICK
  120. #define BUTTON6_TRIPLECLICK BUTTON_MODE_NONE
  121. #endif
  122. #ifndef BUTTON7_TRIPLECLICK
  123. #define BUTTON7_TRIPLECLICK BUTTON_MODE_NONE
  124. #endif
  125. #ifndef BUTTON8_TRIPLECLICK
  126. #define BUTTON8_TRIPLECLICK BUTTON_MODE_NONE
  127. #endif
  128. #ifndef BUTTON1_LNGCLICK
  129. #define BUTTON1_LNGCLICK BUTTON_MODE_RESET
  130. #endif
  131. #ifndef BUTTON2_LNGCLICK
  132. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  133. #endif
  134. #ifndef BUTTON3_LNGCLICK
  135. #define BUTTON3_LNGCLICK BUTTON_MODE_NONE
  136. #endif
  137. #ifndef BUTTON4_LNGCLICK
  138. #define BUTTON4_LNGCLICK BUTTON_MODE_NONE
  139. #endif
  140. #ifndef BUTTON5_LNGCLICK
  141. #define BUTTON5_LNGCLICK BUTTON_MODE_NONE
  142. #endif
  143. #ifndef BUTTON6_LNGCLICK
  144. #define BUTTON6_LNGCLICK BUTTON_MODE_NONE
  145. #endif
  146. #ifndef BUTTON7_LNGCLICK
  147. #define BUTTON7_LNGCLICK BUTTON_MODE_NONE
  148. #endif
  149. #ifndef BUTTON8_LNGCLICK
  150. #define BUTTON8_LNGCLICK BUTTON_MODE_NONE
  151. #endif
  152. #ifndef BUTTON1_LNGLNGCLICK
  153. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_FACTORY
  154. #endif
  155. #ifndef BUTTON2_LNGLNGCLICK
  156. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
  157. #endif
  158. #ifndef BUTTON3_LNGLNGCLICK
  159. #define BUTTON3_LNGLNGCLICK BUTTON_MODE_NONE
  160. #endif
  161. #ifndef BUTTON4_LNGLNGCLICK
  162. #define BUTTON4_LNGLNGCLICK BUTTON_MODE_NONE
  163. #endif
  164. #ifndef BUTTON5_LNGLNGCLICK
  165. #define BUTTON5_LNGLNGCLICK BUTTON_MODE_NONE
  166. #endif
  167. #ifndef BUTTON6_LNGLNGCLICK
  168. #define BUTTON6_LNGLNGCLICK BUTTON_MODE_NONE
  169. #endif
  170. #ifndef BUTTON7_LNGLNGCLICK
  171. #define BUTTON7_LNGLNGCLICK BUTTON_MODE_NONE
  172. #endif
  173. #ifndef BUTTON8_LNGLNGCLICK
  174. #define BUTTON8_LNGLNGCLICK BUTTON_MODE_NONE
  175. #endif
  176. #ifndef BUTTON1_RELAY
  177. #define BUTTON1_RELAY 0
  178. #endif
  179. #ifndef BUTTON2_RELAY
  180. #define BUTTON2_RELAY 0
  181. #endif
  182. #ifndef BUTTON3_RELAY
  183. #define BUTTON3_RELAY 0
  184. #endif
  185. #ifndef BUTTON4_RELAY
  186. #define BUTTON4_RELAY 0
  187. #endif
  188. #ifndef BUTTON5_RELAY
  189. #define BUTTON5_RELAY 0
  190. #endif
  191. #ifndef BUTTON6_RELAY
  192. #define BUTTON6_RELAY 0
  193. #endif
  194. #ifndef BUTTON7_RELAY
  195. #define BUTTON7_RELAY 0
  196. #endif
  197. #ifndef BUTTON8_RELAY
  198. #define BUTTON8_RELAY 0
  199. #endif
  200. // -----------------------------------------------------------------------------
  201. // Relays
  202. // -----------------------------------------------------------------------------
  203. #ifndef DUMMY_RELAY_COUNT
  204. #define DUMMY_RELAY_COUNT 0
  205. #endif
  206. #ifndef RELAY1_PIN
  207. #define RELAY1_PIN GPIO_NONE
  208. #endif
  209. #ifndef RELAY2_PIN
  210. #define RELAY2_PIN GPIO_NONE
  211. #endif
  212. #ifndef RELAY3_PIN
  213. #define RELAY3_PIN GPIO_NONE
  214. #endif
  215. #ifndef RELAY4_PIN
  216. #define RELAY4_PIN GPIO_NONE
  217. #endif
  218. #ifndef RELAY5_PIN
  219. #define RELAY5_PIN GPIO_NONE
  220. #endif
  221. #ifndef RELAY6_PIN
  222. #define RELAY6_PIN GPIO_NONE
  223. #endif
  224. #ifndef RELAY7_PIN
  225. #define RELAY7_PIN GPIO_NONE
  226. #endif
  227. #ifndef RELAY8_PIN
  228. #define RELAY8_PIN GPIO_NONE
  229. #endif
  230. #ifndef RELAY1_TYPE
  231. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  232. #endif
  233. #ifndef RELAY2_TYPE
  234. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  235. #endif
  236. #ifndef RELAY3_TYPE
  237. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  238. #endif
  239. #ifndef RELAY4_TYPE
  240. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  241. #endif
  242. #ifndef RELAY5_TYPE
  243. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  244. #endif
  245. #ifndef RELAY6_TYPE
  246. #define RELAY6_TYPE RELAY_TYPE_NORMAL
  247. #endif
  248. #ifndef RELAY7_TYPE
  249. #define RELAY7_TYPE RELAY_TYPE_NORMAL
  250. #endif
  251. #ifndef RELAY8_TYPE
  252. #define RELAY8_TYPE RELAY_TYPE_NORMAL
  253. #endif
  254. #ifndef RELAY1_RESET_PIN
  255. #define RELAY1_RESET_PIN GPIO_NONE
  256. #endif
  257. #ifndef RELAY2_RESET_PIN
  258. #define RELAY2_RESET_PIN GPIO_NONE
  259. #endif
  260. #ifndef RELAY3_RESET_PIN
  261. #define RELAY3_RESET_PIN GPIO_NONE
  262. #endif
  263. #ifndef RELAY4_RESET_PIN
  264. #define RELAY4_RESET_PIN GPIO_NONE
  265. #endif
  266. #ifndef RELAY5_RESET_PIN
  267. #define RELAY5_RESET_PIN GPIO_NONE
  268. #endif
  269. #ifndef RELAY6_RESET_PIN
  270. #define RELAY6_RESET_PIN GPIO_NONE
  271. #endif
  272. #ifndef RELAY7_RESET_PIN
  273. #define RELAY7_RESET_PIN GPIO_NONE
  274. #endif
  275. #ifndef RELAY8_RESET_PIN
  276. #define RELAY8_RESET_PIN GPIO_NONE
  277. #endif
  278. #ifndef RELAY1_DELAY_ON
  279. #define RELAY1_DELAY_ON 0
  280. #endif
  281. #ifndef RELAY2_DELAY_ON
  282. #define RELAY2_DELAY_ON 0
  283. #endif
  284. #ifndef RELAY3_DELAY_ON
  285. #define RELAY3_DELAY_ON 0
  286. #endif
  287. #ifndef RELAY4_DELAY_ON
  288. #define RELAY4_DELAY_ON 0
  289. #endif
  290. #ifndef RELAY5_DELAY_ON
  291. #define RELAY5_DELAY_ON 0
  292. #endif
  293. #ifndef RELAY6_DELAY_ON
  294. #define RELAY6_DELAY_ON 0
  295. #endif
  296. #ifndef RELAY7_DELAY_ON
  297. #define RELAY7_DELAY_ON 0
  298. #endif
  299. #ifndef RELAY8_DELAY_ON
  300. #define RELAY8_DELAY_ON 0
  301. #endif
  302. #ifndef RELAY1_DELAY_OFF
  303. #define RELAY1_DELAY_OFF 0
  304. #endif
  305. #ifndef RELAY2_DELAY_OFF
  306. #define RELAY2_DELAY_OFF 0
  307. #endif
  308. #ifndef RELAY3_DELAY_OFF
  309. #define RELAY3_DELAY_OFF 0
  310. #endif
  311. #ifndef RELAY4_DELAY_OFF
  312. #define RELAY4_DELAY_OFF 0
  313. #endif
  314. #ifndef RELAY5_DELAY_OFF
  315. #define RELAY5_DELAY_OFF 0
  316. #endif
  317. #ifndef RELAY6_DELAY_OFF
  318. #define RELAY6_DELAY_OFF 0
  319. #endif
  320. #ifndef RELAY7_DELAY_OFF
  321. #define RELAY7_DELAY_OFF 0
  322. #endif
  323. #ifndef RELAY8_DELAY_OFF
  324. #define RELAY8_DELAY_OFF 0
  325. #endif
  326. // -----------------------------------------------------------------------------
  327. // LEDs
  328. // -----------------------------------------------------------------------------
  329. #ifndef LED1_PIN
  330. #define LED1_PIN GPIO_NONE
  331. #endif
  332. #ifndef LED2_PIN
  333. #define LED2_PIN GPIO_NONE
  334. #endif
  335. #ifndef LED3_PIN
  336. #define LED3_PIN GPIO_NONE
  337. #endif
  338. #ifndef LED4_PIN
  339. #define LED4_PIN GPIO_NONE
  340. #endif
  341. #ifndef LED5_PIN
  342. #define LED5_PIN GPIO_NONE
  343. #endif
  344. #ifndef LED6_PIN
  345. #define LED6_PIN GPIO_NONE
  346. #endif
  347. #ifndef LED7_PIN
  348. #define LED7_PIN GPIO_NONE
  349. #endif
  350. #ifndef LED8_PIN
  351. #define LED8_PIN GPIO_NONE
  352. #endif
  353. #ifndef LED1_MODE
  354. #define LED1_MODE LED_MODE_WIFI
  355. #endif
  356. #ifndef LED2_MODE
  357. #define LED2_MODE LED_MODE_MQTT
  358. #endif
  359. #ifndef LED3_MODE
  360. #define LED3_MODE LED_MODE_MQTT
  361. #endif
  362. #ifndef LED4_MODE
  363. #define LED4_MODE LED_MODE_MQTT
  364. #endif
  365. #ifndef LED5_MODE
  366. #define LED5_MODE LED_MODE_MQTT
  367. #endif
  368. #ifndef LED6_MODE
  369. #define LED6_MODE LED_MODE_MQTT
  370. #endif
  371. #ifndef LED7_MODE
  372. #define LED7_MODE LED_MODE_MQTT
  373. #endif
  374. #ifndef LED8_MODE
  375. #define LED8_MODE LED_MODE_MQTT
  376. #endif
  377. #ifndef LED1_RELAY
  378. #define LED1_RELAY 1
  379. #endif
  380. #ifndef LED2_RELAY
  381. #define LED2_RELAY 2
  382. #endif
  383. #ifndef LED3_RELAY
  384. #define LED3_RELAY 3
  385. #endif
  386. #ifndef LED4_RELAY
  387. #define LED4_RELAY 4
  388. #endif
  389. #ifndef LED5_RELAY
  390. #define LED5_RELAY 5
  391. #endif
  392. #ifndef LED6_RELAY
  393. #define LED6_RELAY 6
  394. #endif
  395. #ifndef LED7_RELAY
  396. #define LED7_RELAY 7
  397. #endif
  398. #ifndef LED8_RELAY
  399. #define LED8_RELAY 8
  400. #endif
  401. // -----------------------------------------------------------------------------
  402. // General
  403. // -----------------------------------------------------------------------------
  404. // Default hostname will be ESPURNA_XXXXXX, where XXXXXX is last 3 octets of chipID
  405. #ifndef HOSTNAME
  406. #define HOSTNAME ""
  407. #endif
  408. // Relay providers
  409. #ifndef RELAY_PROVIDER
  410. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  411. #endif
  412. // Light provider
  413. #ifndef LIGHT_PROVIDER
  414. #define LIGHT_PROVIDER LIGHT_PROVIDER_NONE
  415. #endif