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.

572 lines
13 KiB

  1. // -----------------------------------------------------------------------------
  2. // Hardware default values
  3. // -----------------------------------------------------------------------------
  4. #define GPIO_NONE 0xFF
  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_SMART_CONFIG
  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. // Encoders
  202. // -----------------------------------------------------------------------------
  203. #ifndef ENCODER1_PIN1
  204. #define ENCODER1_PIN1 GPIO_NONE
  205. #endif
  206. #ifndef ENCODER2_PIN1
  207. #define ENCODER2_PIN1 GPIO_NONE
  208. #endif
  209. #ifndef ENCODER3_PIN1
  210. #define ENCODER3_PIN1 GPIO_NONE
  211. #endif
  212. #ifndef ENCODER4_PIN1
  213. #define ENCODER4_PIN1 GPIO_NONE
  214. #endif
  215. #ifndef ENCODER5_PIN1
  216. #define ENCODER5_PIN1 GPIO_NONE
  217. #endif
  218. #ifndef ENCODER1_PIN2
  219. #define ENCODER1_PIN2 GPIO_NONE
  220. #endif
  221. #ifndef ENCODER2_PIN2
  222. #define ENCODER2_PIN2 GPIO_NONE
  223. #endif
  224. #ifndef ENCODER3_PIN2
  225. #define ENCODER3_PIN2 GPIO_NONE
  226. #endif
  227. #ifndef ENCODER4_PIN2
  228. #define ENCODER4_PIN2 GPIO_NONE
  229. #endif
  230. #ifndef ENCODER5_PIN2
  231. #define ENCODER5_PIN2 GPIO_NONE
  232. #endif
  233. #ifndef ENCODER1_BUTTON_PIN
  234. #define ENCODER1_BUTTON_PIN GPIO_NONE
  235. #endif
  236. #ifndef ENCODER2_BUTTON_PIN
  237. #define ENCODER2_BUTTON_PIN GPIO_NONE
  238. #endif
  239. #ifndef ENCODER3_BUTTON_PIN
  240. #define ENCODER3_BUTTON_PIN GPIO_NONE
  241. #endif
  242. #ifndef ENCODER4_BUTTON_PIN
  243. #define ENCODER4_BUTTON_PIN GPIO_NONE
  244. #endif
  245. #ifndef ENCODER5_BUTTON_PIN
  246. #define ENCODER5_BUTTON_PIN GPIO_NONE
  247. #endif
  248. #ifndef ENCODER1_BUTTON_LOGIC
  249. #define ENCODER1_BUTTON_LOGIC HIGH
  250. #endif
  251. #ifndef ENCODER2_BUTTON_LOGIC
  252. #define ENCODER2_BUTTON_LOGIC HIGH
  253. #endif
  254. #ifndef ENCODER3_BUTTON_LOGIC
  255. #define ENCODER3_BUTTON_LOGIC HIGH
  256. #endif
  257. #ifndef ENCODER4_BUTTON_LOGIC
  258. #define ENCODER4_BUTTON_LOGIC HIGH
  259. #endif
  260. #ifndef ENCODER5_BUTTON_LOGIC
  261. #define ENCODER5_BUTTON_LOGIC HIGH
  262. #endif
  263. #ifndef ENCODER1_BUTTON_MODE
  264. #define ENCODER1_BUTTON_MODE INPUT_PULLUP
  265. #endif
  266. #ifndef ENCODER2_BUTTON_MODE
  267. #define ENCODER2_BUTTON_MODE INPUT_PULLUP
  268. #endif
  269. #ifndef ENCODER3_BUTTON_MODE
  270. #define ENCODER3_BUTTON_MODE INPUT_PULLUP
  271. #endif
  272. #ifndef ENCODER4_BUTTON_MODE
  273. #define ENCODER4_BUTTON_MODE INPUT_PULLUP
  274. #endif
  275. #ifndef ENCODER5_BUTTON_MODE
  276. #define ENCODER5_BUTTON_MODE INPUT_PULLUP
  277. #endif
  278. #ifndef ENCODER1_MODE
  279. #define ENCODER1_MODE 1
  280. #endif
  281. #ifndef ENCODER2_MODE
  282. #define ENCODER2_MODE 1
  283. #endif
  284. #ifndef ENCODER3_MODE
  285. #define ENCODER3_MODE 1
  286. #endif
  287. #ifndef ENCODER4_MODE
  288. #define ENCODER4_MODE 1
  289. #endif
  290. #ifndef ENCODER5_MODE
  291. #define ENCODER5_MODE 1
  292. #endif
  293. #ifndef ENCODER1_CHANNEL1
  294. #define ENCODER1_CHANNEL1 0
  295. #endif
  296. #ifndef ENCODER2_CHANNEL1
  297. #define ENCODER2_CHANNEL1 0
  298. #endif
  299. #ifndef ENCODER3_CHANNEL1
  300. #define ENCODER3_CHANNEL1 0
  301. #endif
  302. #ifndef ENCODER4_CHANNEL1
  303. #define ENCODER4_CHANNEL1 0
  304. #endif
  305. #ifndef ENCODER5_CHANNEL1
  306. #define ENCODER5_CHANNEL1 0
  307. #endif
  308. #ifndef ENCODER1_CHANNEL2
  309. #define ENCODER1_CHANNEL2 1
  310. #endif
  311. #ifndef ENCODER2_CHANNEL2
  312. #define ENCODER2_CHANNEL2 1
  313. #endif
  314. #ifndef ENCODER3_CHANNEL2
  315. #define ENCODER3_CHANNEL2 1
  316. #endif
  317. #ifndef ENCODER4_CHANNEL2
  318. #define ENCODER4_CHANNEL2 1
  319. #endif
  320. #ifndef ENCODER5_CHANNEL2
  321. #define ENCODER5_CHANNEL2 1
  322. #endif
  323. // -----------------------------------------------------------------------------
  324. // Relays
  325. // -----------------------------------------------------------------------------
  326. #ifndef RELAY1_PIN
  327. #define RELAY1_PIN GPIO_NONE
  328. #endif
  329. #ifndef RELAY2_PIN
  330. #define RELAY2_PIN GPIO_NONE
  331. #endif
  332. #ifndef RELAY3_PIN
  333. #define RELAY3_PIN GPIO_NONE
  334. #endif
  335. #ifndef RELAY4_PIN
  336. #define RELAY4_PIN GPIO_NONE
  337. #endif
  338. #ifndef RELAY5_PIN
  339. #define RELAY5_PIN GPIO_NONE
  340. #endif
  341. #ifndef RELAY6_PIN
  342. #define RELAY6_PIN GPIO_NONE
  343. #endif
  344. #ifndef RELAY7_PIN
  345. #define RELAY7_PIN GPIO_NONE
  346. #endif
  347. #ifndef RELAY8_PIN
  348. #define RELAY8_PIN GPIO_NONE
  349. #endif
  350. #ifndef RELAY1_TYPE
  351. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  352. #endif
  353. #ifndef RELAY2_TYPE
  354. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  355. #endif
  356. #ifndef RELAY3_TYPE
  357. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  358. #endif
  359. #ifndef RELAY4_TYPE
  360. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  361. #endif
  362. #ifndef RELAY5_TYPE
  363. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  364. #endif
  365. #ifndef RELAY6_TYPE
  366. #define RELAY6_TYPE RELAY_TYPE_NORMAL
  367. #endif
  368. #ifndef RELAY7_TYPE
  369. #define RELAY7_TYPE RELAY_TYPE_NORMAL
  370. #endif
  371. #ifndef RELAY8_TYPE
  372. #define RELAY8_TYPE RELAY_TYPE_NORMAL
  373. #endif
  374. #ifndef RELAY1_RESET_PIN
  375. #define RELAY1_RESET_PIN GPIO_NONE
  376. #endif
  377. #ifndef RELAY2_RESET_PIN
  378. #define RELAY2_RESET_PIN GPIO_NONE
  379. #endif
  380. #ifndef RELAY3_RESET_PIN
  381. #define RELAY3_RESET_PIN GPIO_NONE
  382. #endif
  383. #ifndef RELAY4_RESET_PIN
  384. #define RELAY4_RESET_PIN GPIO_NONE
  385. #endif
  386. #ifndef RELAY5_RESET_PIN
  387. #define RELAY5_RESET_PIN GPIO_NONE
  388. #endif
  389. #ifndef RELAY6_RESET_PIN
  390. #define RELAY6_RESET_PIN GPIO_NONE
  391. #endif
  392. #ifndef RELAY7_RESET_PIN
  393. #define RELAY7_RESET_PIN GPIO_NONE
  394. #endif
  395. #ifndef RELAY8_RESET_PIN
  396. #define RELAY8_RESET_PIN GPIO_NONE
  397. #endif
  398. #ifndef RELAY1_DELAY_ON
  399. #define RELAY1_DELAY_ON 0
  400. #endif
  401. #ifndef RELAY2_DELAY_ON
  402. #define RELAY2_DELAY_ON 0
  403. #endif
  404. #ifndef RELAY3_DELAY_ON
  405. #define RELAY3_DELAY_ON 0
  406. #endif
  407. #ifndef RELAY4_DELAY_ON
  408. #define RELAY4_DELAY_ON 0
  409. #endif
  410. #ifndef RELAY5_DELAY_ON
  411. #define RELAY5_DELAY_ON 0
  412. #endif
  413. #ifndef RELAY6_DELAY_ON
  414. #define RELAY6_DELAY_ON 0
  415. #endif
  416. #ifndef RELAY7_DELAY_ON
  417. #define RELAY7_DELAY_ON 0
  418. #endif
  419. #ifndef RELAY8_DELAY_ON
  420. #define RELAY8_DELAY_ON 0
  421. #endif
  422. #ifndef RELAY1_DELAY_OFF
  423. #define RELAY1_DELAY_OFF 0
  424. #endif
  425. #ifndef RELAY2_DELAY_OFF
  426. #define RELAY2_DELAY_OFF 0
  427. #endif
  428. #ifndef RELAY3_DELAY_OFF
  429. #define RELAY3_DELAY_OFF 0
  430. #endif
  431. #ifndef RELAY4_DELAY_OFF
  432. #define RELAY4_DELAY_OFF 0
  433. #endif
  434. #ifndef RELAY5_DELAY_OFF
  435. #define RELAY5_DELAY_OFF 0
  436. #endif
  437. #ifndef RELAY6_DELAY_OFF
  438. #define RELAY6_DELAY_OFF 0
  439. #endif
  440. #ifndef RELAY7_DELAY_OFF
  441. #define RELAY7_DELAY_OFF 0
  442. #endif
  443. #ifndef RELAY8_DELAY_OFF
  444. #define RELAY8_DELAY_OFF 0
  445. #endif
  446. // -----------------------------------------------------------------------------
  447. // LEDs
  448. // -----------------------------------------------------------------------------
  449. #ifndef LED1_PIN
  450. #define LED1_PIN GPIO_NONE
  451. #endif
  452. #ifndef LED2_PIN
  453. #define LED2_PIN GPIO_NONE
  454. #endif
  455. #ifndef LED3_PIN
  456. #define LED3_PIN GPIO_NONE
  457. #endif
  458. #ifndef LED4_PIN
  459. #define LED4_PIN GPIO_NONE
  460. #endif
  461. #ifndef LED5_PIN
  462. #define LED5_PIN GPIO_NONE
  463. #endif
  464. #ifndef LED6_PIN
  465. #define LED6_PIN GPIO_NONE
  466. #endif
  467. #ifndef LED7_PIN
  468. #define LED7_PIN GPIO_NONE
  469. #endif
  470. #ifndef LED8_PIN
  471. #define LED8_PIN GPIO_NONE
  472. #endif
  473. #ifndef LED1_MODE
  474. #define LED1_MODE LED_MODE_WIFI
  475. #endif
  476. #ifndef LED2_MODE
  477. #define LED2_MODE LED_MODE_MQTT
  478. #endif
  479. #ifndef LED3_MODE
  480. #define LED3_MODE LED_MODE_MQTT
  481. #endif
  482. #ifndef LED4_MODE
  483. #define LED4_MODE LED_MODE_MQTT
  484. #endif
  485. #ifndef LED5_MODE
  486. #define LED5_MODE LED_MODE_MQTT
  487. #endif
  488. #ifndef LED6_MODE
  489. #define LED6_MODE LED_MODE_MQTT
  490. #endif
  491. #ifndef LED7_MODE
  492. #define LED7_MODE LED_MODE_MQTT
  493. #endif
  494. #ifndef LED8_MODE
  495. #define LED8_MODE LED_MODE_MQTT
  496. #endif
  497. #ifndef LED1_RELAY
  498. #define LED1_RELAY 1
  499. #endif
  500. #ifndef LED2_RELAY
  501. #define LED2_RELAY 2
  502. #endif
  503. #ifndef LED3_RELAY
  504. #define LED3_RELAY 3
  505. #endif
  506. #ifndef LED4_RELAY
  507. #define LED4_RELAY 4
  508. #endif
  509. #ifndef LED5_RELAY
  510. #define LED5_RELAY 5
  511. #endif
  512. #ifndef LED6_RELAY
  513. #define LED6_RELAY 6
  514. #endif
  515. #ifndef LED7_RELAY
  516. #define LED7_RELAY 7
  517. #endif
  518. #ifndef LED8_RELAY
  519. #define LED8_RELAY 8
  520. #endif
  521. // -----------------------------------------------------------------------------
  522. // General
  523. // -----------------------------------------------------------------------------
  524. // Device name (DNS, SoftAP SSID, ALEXA etc.)
  525. // If empty, default will be ESPURNA-XXXXXX, where XXXXXX is last 3 octets of chipID
  526. // When set, must be 1..31 characters. See:
  527. // https://github.com/xoseperez/espurna/issues/921
  528. // https://github.com/xoseperez/espurna/issues/1151
  529. #ifndef HOSTNAME
  530. #define HOSTNAME ""
  531. #endif
  532. // Relay providers
  533. #ifndef RELAY_PROVIDER
  534. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  535. #endif
  536. // Light provider
  537. #ifndef LIGHT_PROVIDER
  538. #define LIGHT_PROVIDER LIGHT_PROVIDER_NONE
  539. #endif