My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

pinsDebug.h 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. // How many DIO pins are defined?
  23. #if defined(DIO85_PIN)
  24. #define DIO_COUNT 86
  25. #elif defined(DIO53_PIN)
  26. #define DIO_COUNT 54
  27. #elif defined(DIO47_PIN)
  28. #define DIO_COUNT 48
  29. #elif defined(DIO31_PIN)
  30. #define DIO_COUNT 32
  31. #elif defined(DIO21_PIN)
  32. #define DIO_COUNT 22
  33. #endif
  34. #define _PIN_SAY(NAME) { SERIAL_ECHOPGM(STRINGIFY(NAME)); return true; }
  35. #define PIN_SAY(NAME) if (pin == NAME) _PIN_SAY(_##NAME##_);
  36. #define ANALOG_PIN_SAY(NAME) if (pin == analogInputToDigitalPin(NAME)) _PIN_SAY(_##NAME##_);
  37. #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && ((P) <= analogInputToDigitalPin(15) || (P) <= analogInputToDigitalPin(5)))
  38. // Report pin name for a given fastio digital pin index
  39. static bool report_pin_name(int8_t pin) {
  40. SERIAL_ECHO((int)pin);
  41. SERIAL_CHAR(' ');
  42. if (IS_ANALOG(pin)) {
  43. SERIAL_CHAR('('); SERIAL_CHAR('A');
  44. SERIAL_ECHO(int(pin - analogInputToDigitalPin(0)));
  45. SERIAL_CHAR(')'); SERIAL_CHAR(' ');
  46. }
  47. #if defined(RXD) && RXD > -1
  48. if (pin == 0) { SERIAL_ECHOPGM("RXD"); return true; }
  49. #endif
  50. #if defined(TXD) && TXD > -1
  51. if (pin == 1) { SERIAL_ECHOPGM("TXD"); return true; }
  52. #endif
  53. #if PIN_EXISTS(SERVO0)
  54. PIN_SAY(SERVO0_PIN);
  55. #endif
  56. #if PIN_EXISTS(SERVO1)
  57. PIN_SAY(SERVO1_PIN);
  58. #endif
  59. #if PIN_EXISTS(SERVO2)
  60. PIN_SAY(SERVO2_PIN);
  61. #endif
  62. #if PIN_EXISTS(SERVO3)
  63. PIN_SAY(SERVO3_PIN);
  64. #endif
  65. #if PIN_EXISTS(X_MIN)
  66. PIN_SAY(X_MIN_PIN);
  67. #endif
  68. #if PIN_EXISTS(X_MAX)
  69. PIN_SAY(X_MAX_PIN);
  70. #endif
  71. #if PIN_EXISTS(Y_MIN)
  72. PIN_SAY(Y_MIN_PIN);
  73. #endif
  74. #if PIN_EXISTS(Y_MAX)
  75. PIN_SAY(Y_MAX_PIN);
  76. #endif
  77. #if PIN_EXISTS(Z_MIN)
  78. PIN_SAY(Z_MIN_PIN);
  79. #endif
  80. #if PIN_EXISTS(Z_MAX)
  81. PIN_SAY(Z_MAX_PIN);
  82. #endif
  83. #if PIN_EXISTS(Z_MIN_PROBE)
  84. PIN_SAY(Z_MIN_PROBE_PIN);
  85. #endif
  86. #if PIN_EXISTS(X_STEP)
  87. PIN_SAY(X_STEP_PIN);
  88. #endif
  89. #if PIN_EXISTS(X_DIR)
  90. PIN_SAY(X_DIR_PIN);
  91. #endif
  92. #if PIN_EXISTS(X_ENABLE)
  93. PIN_SAY(X_ENABLE_PIN);
  94. #endif
  95. #if PIN_EXISTS(X_MS1)
  96. PIN_SAY(X_MS1_PIN);
  97. #endif
  98. #if PIN_EXISTS(X_MS2)
  99. PIN_SAY(X_MS2_PIN);
  100. #endif
  101. #if PIN_EXISTS(X2_STEP)
  102. PIN_SAY(X2_STEP_PIN);
  103. #endif
  104. #if PIN_EXISTS(X2_DIR)
  105. PIN_SAY(X2_DIR_PIN);
  106. #endif
  107. #if PIN_EXISTS(X2_ENABLE)
  108. PIN_SAY(X2_ENABLE_PIN);
  109. #endif
  110. #if PIN_EXISTS(Y_STEP)
  111. PIN_SAY(Y_STEP_PIN);
  112. #endif
  113. #if PIN_EXISTS(Y_DIR)
  114. PIN_SAY(Y_DIR_PIN);
  115. #endif
  116. #if PIN_EXISTS(Y_ENABLE)
  117. PIN_SAY(Y_ENABLE_PIN);
  118. #endif
  119. #if PIN_EXISTS(Y_MS1)
  120. PIN_SAY(Y_MS1_PIN);
  121. #endif
  122. #if PIN_EXISTS(Y_MS2)
  123. PIN_SAY(Y_MS2_PIN);
  124. #endif
  125. #if PIN_EXISTS(Y2_STEP)
  126. PIN_SAY(Y2_STEP_PIN);
  127. #endif
  128. #if PIN_EXISTS(Y2_DIR)
  129. PIN_SAY(Y2_DIR_PIN);
  130. #endif
  131. #if PIN_EXISTS(Y2_ENABLE)
  132. PIN_SAY(Y2_ENABLE_PIN);
  133. #endif
  134. #if PIN_EXISTS(Z_STEP)
  135. PIN_SAY(Z_STEP_PIN);
  136. #endif
  137. #if PIN_EXISTS(Z_DIR)
  138. PIN_SAY(Z_DIR_PIN);
  139. #endif
  140. #if PIN_EXISTS(Z_ENABLE)
  141. PIN_SAY(Z_ENABLE_PIN);
  142. #endif
  143. #if PIN_EXISTS(Z_MS1)
  144. PIN_SAY(Z_MS1_PIN);
  145. #endif
  146. #if PIN_EXISTS(Z_MS2)
  147. PIN_SAY(Z_MS2_PIN);
  148. #endif
  149. #if PIN_EXISTS(Z2_STEP)
  150. PIN_SAY(Z2_STEP_PIN);
  151. #endif
  152. #if PIN_EXISTS(Z2_DIR)
  153. PIN_SAY(Z2_DIR_PIN);
  154. #endif
  155. #if PIN_EXISTS(Z2_ENABLE)
  156. PIN_SAY(Z2_ENABLE_PIN);
  157. #endif
  158. #if PIN_EXISTS(E0_STEP)
  159. PIN_SAY(E0_STEP_PIN);
  160. #endif
  161. #if PIN_EXISTS(E0_DIR)
  162. PIN_SAY(E0_DIR_PIN);
  163. #endif
  164. #if PIN_EXISTS(E0_ENABLE)
  165. PIN_SAY(E0_ENABLE_PIN);
  166. #endif
  167. #if PIN_EXISTS(E0_MS1)
  168. PIN_SAY(E0_MS1_PIN);
  169. #endif
  170. #if PIN_EXISTS(E0_MS2)
  171. PIN_SAY(E0_MS2_PIN);
  172. #endif
  173. #if PIN_EXISTS(E1_STEP)
  174. PIN_SAY(E1_STEP_PIN);
  175. #endif
  176. #if PIN_EXISTS(E1_DIR)
  177. PIN_SAY(E1_DIR_PIN);
  178. #endif
  179. #if PIN_EXISTS(E1_ENABLE)
  180. PIN_SAY(E1_ENABLE_PIN);
  181. #endif
  182. #if PIN_EXISTS(E1_MS1)
  183. PIN_SAY(E1_MS1_PIN);
  184. #endif
  185. #if PIN_EXISTS(E1_MS2)
  186. PIN_SAY(E1_MS2_PIN);
  187. #endif
  188. #if PIN_EXISTS(E2_STEP)
  189. PIN_SAY(E2_STEP_PIN);
  190. #endif
  191. #if PIN_EXISTS(E2_DIR)
  192. PIN_SAY(E2_DIR_PIN);
  193. #endif
  194. #if PIN_EXISTS(E2_ENABLE)
  195. PIN_SAY(E2_ENABLE_PIN);
  196. #endif
  197. #if PIN_EXISTS(E3_STEP)
  198. PIN_SAY(E3_STEP_PIN);
  199. #endif
  200. #if PIN_EXISTS(E3_DIR)
  201. PIN_SAY(E3_DIR_PIN);
  202. #endif
  203. #if PIN_EXISTS(E3_ENABLE)
  204. PIN_SAY(E3_ENABLE_PIN);
  205. #endif
  206. #if PIN_EXISTS(E4_STEP)
  207. PIN_SAY(E4_STEP_PIN);
  208. #endif
  209. #if PIN_EXISTS(E4_DIR)
  210. PIN_SAY(E4_DIR_PIN);
  211. #endif
  212. #if PIN_EXISTS(E4_ENABLE)
  213. PIN_SAY(E4_ENABLE_PIN);
  214. #endif
  215. #if PIN_EXISTS(FAN)
  216. PIN_SAY(FAN_PIN);
  217. #endif
  218. #if PIN_EXISTS(FAN1)
  219. PIN_SAY(FAN1_PIN);
  220. #endif
  221. #if PIN_EXISTS(FAN2)
  222. PIN_SAY(FAN2_PIN);
  223. #endif
  224. #if PIN_EXISTS(CONTROLLERFAN)
  225. PIN_SAY(CONTROLLERFAN_PIN);
  226. #endif
  227. #if PIN_EXISTS(EXTRUDER_0_AUTO_FAN)
  228. PIN_SAY(EXTRUDER_0_AUTO_FAN_PIN);
  229. #endif
  230. #if PIN_EXISTS(EXTRUDER_1_AUTO_FAN)
  231. PIN_SAY(EXTRUDER_1_AUTO_FAN_PIN);
  232. #endif
  233. #if PIN_EXISTS(EXTRUDER_2_AUTO_FAN)
  234. PIN_SAY(EXTRUDER_2_AUTO_FAN_PIN);
  235. #endif
  236. #if PIN_EXISTS(EXTRUDER_3_AUTO_FAN)
  237. PIN_SAY(EXTRUDER_3_AUTO_FAN_PIN);
  238. #endif
  239. #if PIN_EXISTS(HEATER_0)
  240. PIN_SAY(HEATER_0_PIN);
  241. #endif
  242. #if PIN_EXISTS(HEATER_1)
  243. PIN_SAY(HEATER_1_PIN);
  244. #endif
  245. #if PIN_EXISTS(HEATER_2)
  246. PIN_SAY(HEATER_2_PIN);
  247. #endif
  248. #if PIN_EXISTS(HEATER_3)
  249. PIN_SAY(HEATER_3_PIN);
  250. #endif
  251. #if PIN_EXISTS(HEATER_BED)
  252. PIN_SAY(HEATER_BED_PIN);
  253. #endif
  254. #if PIN_EXISTS(X_ATT)
  255. PIN_SAY(X_ATT_PIN);
  256. #endif
  257. #if PIN_EXISTS(Y_ATT)
  258. PIN_SAY(Y_ATT_PIN);
  259. #endif
  260. #if PIN_EXISTS(Z_ATT)
  261. PIN_SAY(Z_ATT_PIN);
  262. #endif
  263. #if PIN_EXISTS(E0_ATT)
  264. PIN_SAY(E0_ATT_PIN);
  265. #endif
  266. #if PIN_EXISTS(TEMP_0)
  267. ANALOG_PIN_SAY(TEMP_0_PIN);
  268. #endif
  269. #if PIN_EXISTS(TEMP_1)
  270. ANALOG_PIN_SAY(TEMP_1_PIN);
  271. #endif
  272. #if PIN_EXISTS(TEMP_2)
  273. ANALOG_PIN_SAY(TEMP_2_PIN);
  274. #endif
  275. #if PIN_EXISTS(TEMP_3)
  276. ANALOG_PIN_SAY(TEMP_3_PIN);
  277. #endif
  278. #if PIN_EXISTS(TEMP_BED)
  279. ANALOG_PIN_SAY(TEMP_BED_PIN);
  280. #endif
  281. #if PIN_EXISTS(FILWIDTH)
  282. ANALOG_PIN_SAY(FILWIDTH_PIN);
  283. #endif
  284. #if PIN_EXISTS(BEEPER)
  285. PIN_SAY(BEEPER_PIN);
  286. #endif
  287. #if PIN_EXISTS(SLED)
  288. PIN_SAY(SLED_PIN);
  289. #endif
  290. #if PIN_EXISTS(FIL_RUNOUT)
  291. PIN_SAY(FIL_RUNOUT_PIN);
  292. #endif
  293. #if PIN_EXISTS(LED)
  294. PIN_SAY(LED_PIN);
  295. #endif
  296. // #if defined(DEBUG_LED) && DEBUG_LED > -1
  297. // PIN_SAY(DEBUG_LED);
  298. // #endif
  299. #if PIN_EXISTS(STAT_LED_RED)
  300. PIN_SAY(STAT_LED_RED_PIN);
  301. #endif
  302. #if PIN_EXISTS(STAT_LED_BLUE)
  303. PIN_SAY(STAT_LED_BLUE_PIN);
  304. #endif
  305. #if PIN_EXISTS(DIGIPOTSS)
  306. PIN_SAY(DIGIPOTSS_PIN);
  307. #endif
  308. #if PIN_EXISTS(SCK)
  309. PIN_SAY(SCK_PIN);
  310. #endif
  311. #if PIN_EXISTS(MISO)
  312. PIN_SAY(MISO_PIN);
  313. #endif
  314. #if PIN_EXISTS(MOSI)
  315. PIN_SAY(MOSI_PIN);
  316. #endif
  317. #if PIN_EXISTS(SS)
  318. PIN_SAY(SS_PIN);
  319. #endif
  320. #if PIN_EXISTS(SD_DETECT)
  321. PIN_SAY(SD_DETECT_PIN);
  322. #endif
  323. #if defined(SDPOWER) && SDPOWER > -1
  324. PIN_SAY(SDPOWER);
  325. #endif
  326. #if defined(SDSS) && SDSS > -1
  327. PIN_SAY(SDSS);
  328. #endif
  329. #if defined(I2C_SCL) && I2C_SCL > -1
  330. PIN_SAY(I2C_SCL);
  331. #endif
  332. #if defined(I2C_SDA) && I2C_SDA > -1
  333. PIN_SAY(I2C_SDA);
  334. #endif
  335. #if defined(SCL) && SCL > -1
  336. PIN_SAY(SCL);
  337. #endif
  338. #if defined(SDA) && SDA > -1
  339. PIN_SAY(SDA);
  340. #endif
  341. #if PIN_EXISTS(PS_ON)
  342. PIN_SAY(PS_ON_PIN);
  343. #endif
  344. #if PIN_EXISTS(KILL)
  345. PIN_SAY(KILL_PIN);
  346. #endif
  347. #if PIN_EXISTS(SUICIDE)
  348. PIN_SAY(SUICIDE_PIN);
  349. #endif
  350. #if PIN_EXISTS(DEBUG)
  351. PIN_SAY(DEBUG_PIN);
  352. #endif
  353. #if PIN_EXISTS(PHOTOGRAPH)
  354. PIN_SAY(PHOTOGRAPH_PIN);
  355. #endif
  356. #if PIN_EXISTS(BEEPER)
  357. PIN_SAY(BEEPER_PIN);
  358. #endif
  359. #if defined(BTN_EN1) && BTN_EN1 > -1
  360. PIN_SAY(BTN_EN1);
  361. #endif
  362. #if defined(BTN_EN2) && BTN_EN2 > -1
  363. PIN_SAY(BTN_EN2);
  364. #endif
  365. #if defined(BTN_ENC) && BTN_ENC > -1
  366. PIN_SAY(BTN_ENC);
  367. #endif
  368. #if defined(LCD_PINS_RS) && LCD_PINS_RS > -1
  369. PIN_SAY(LCD_PINS_RS);
  370. #endif
  371. #if defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE > -1
  372. PIN_SAY(LCD_PINS_ENABLE);
  373. #endif
  374. #if defined(LCD_PINS_D4) && LCD_PINS_D4 > -1
  375. PIN_SAY(LCD_PINS_D4);
  376. #endif
  377. #if defined(LCD_PINS_D5) && LCD_PINS_D5 > -1
  378. PIN_SAY(LCD_PINS_D5);
  379. #endif
  380. #if defined(LCD_PINS_D6) && LCD_PINS_D6 > -1
  381. PIN_SAY(LCD_PINS_D6);
  382. #endif
  383. #if defined(LCD_PINS_D7) && LCD_PINS_D7 > -1
  384. PIN_SAY(LCD_PINS_D7);
  385. #endif
  386. #if PIN_EXISTS(RAMPS_D8)
  387. PIN_SAY(RAMPS_D8_PIN);
  388. #endif
  389. #if PIN_EXISTS(RAMPS_D9)
  390. PIN_SAY(RAMPS_D9_PIN);
  391. #endif
  392. #if PIN_EXISTS(RAMPS_D10)
  393. PIN_SAY(RAMPS_D10_PIN);
  394. #endif
  395. #if PIN_EXISTS(MOSFET_D)
  396. PIN_SAY(MOSFET_D_PIN);
  397. #endif
  398. #if PIN_EXISTS(TX_ENABLE)
  399. PIN_SAY(TX_ENABLE_PIN);
  400. #endif
  401. #if PIN_EXISTS(RX_ENABLE)
  402. PIN_SAY(RX_ENABLE_PIN);
  403. #endif
  404. SERIAL_ECHOPGM("<unused>");
  405. return false;
  406. }
  407. inline void report_pin_state(int8_t pin) {
  408. if (report_pin_name(pin)) {
  409. if (pin_is_protected(pin))
  410. SERIAL_ECHOPGM(" (protected)");
  411. else {
  412. SERIAL_ECHOPGM(" = ");
  413. pinMode(pin, INPUT_PULLUP);
  414. SERIAL_ECHO(digitalRead(pin));
  415. if (IS_ANALOG(pin)) {
  416. SERIAL_CHAR(' '); SERIAL_CHAR('(');
  417. SERIAL_ECHO(analogRead(pin - analogInputToDigitalPin(0)));
  418. SERIAL_CHAR(')');
  419. }
  420. }
  421. }
  422. SERIAL_EOL;
  423. }