My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Conditionals_post.h 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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. /**
  23. * Conditionals_post.h
  24. * Defines that depend on configuration but are not editable.
  25. */
  26. #ifndef CONDITIONALS_POST_H
  27. #define CONDITIONALS_POST_H
  28. /**
  29. * Axis lengths and center
  30. */
  31. #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
  32. #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
  33. #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
  34. #define X_CENTER float((X_MIN_POS + X_MAX_POS) * 0.5)
  35. #define Y_CENTER float((Y_MIN_POS + Y_MAX_POS) * 0.5)
  36. #define Z_CENTER float((Z_MIN_POS + Z_MAX_POS) * 0.5)
  37. /**
  38. * CoreXY and CoreXZ
  39. */
  40. #if ENABLED(COREXY)
  41. #define CORE_AXIS_1 A_AXIS // XY from A + B
  42. #define CORE_AXIS_2 B_AXIS
  43. #define NORMAL_AXIS Z_AXIS
  44. #elif ENABLED(COREXZ)
  45. #define CORE_AXIS_1 A_AXIS // XZ from A + C
  46. #define CORE_AXIS_2 C_AXIS
  47. #define NORMAL_AXIS Y_AXIS
  48. #elif ENABLED(COREYZ)
  49. #define CORE_AXIS_1 B_AXIS // YZ from B + C
  50. #define CORE_AXIS_2 C_AXIS
  51. #define NORMAL_AXIS X_AXIS
  52. #endif
  53. #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
  54. #define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
  55. #define IS_CARTESIAN !IS_KINEMATIC
  56. /**
  57. * SCARA cannot use SLOWDOWN and requires QUICKHOME
  58. */
  59. #if IS_SCARA
  60. #undef SLOWDOWN
  61. #define QUICK_HOME
  62. #endif
  63. /**
  64. * Set the home position based on settings or manual overrides
  65. */
  66. #ifdef MANUAL_X_HOME_POS
  67. #define X_HOME_POS MANUAL_X_HOME_POS
  68. #elif ENABLED(BED_CENTER_AT_0_0)
  69. #if ENABLED(DELTA)
  70. #define X_HOME_POS 0
  71. #else
  72. #define X_HOME_POS ((X_MAX_LENGTH) * (X_HOME_DIR) * 0.5)
  73. #endif
  74. #else
  75. #if ENABLED(DELTA)
  76. #define X_HOME_POS (X_MIN_POS + (X_MAX_LENGTH) * 0.5)
  77. #else
  78. #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
  79. #endif
  80. #endif
  81. #ifdef MANUAL_Y_HOME_POS
  82. #define Y_HOME_POS MANUAL_Y_HOME_POS
  83. #elif ENABLED(BED_CENTER_AT_0_0)
  84. #if ENABLED(DELTA)
  85. #define Y_HOME_POS 0
  86. #else
  87. #define Y_HOME_POS ((Y_MAX_LENGTH) * (Y_HOME_DIR) * 0.5)
  88. #endif
  89. #else
  90. #if ENABLED(DELTA)
  91. #define Y_HOME_POS (Y_MIN_POS + (Y_MAX_LENGTH) * 0.5)
  92. #else
  93. #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
  94. #endif
  95. #endif
  96. #ifdef MANUAL_Z_HOME_POS
  97. #define Z_HOME_POS MANUAL_Z_HOME_POS
  98. #else
  99. #define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
  100. #endif
  101. /**
  102. * Auto Bed Leveling and Z Probe Repeatability Test
  103. */
  104. #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
  105. /**
  106. * Z Sled Probe requires Z_SAFE_HOMING
  107. */
  108. #if ENABLED(Z_PROBE_SLED)
  109. #define Z_SAFE_HOMING
  110. #endif
  111. /**
  112. * DELTA should ignore Z_SAFE_HOMING and SLOWDOWN
  113. */
  114. #if ENABLED(DELTA)
  115. #undef Z_SAFE_HOMING
  116. #undef SLOWDOWN
  117. #endif
  118. /**
  119. * Safe Homing Options
  120. */
  121. #if ENABLED(Z_SAFE_HOMING)
  122. #ifndef Z_SAFE_HOMING_X_POINT
  123. #define Z_SAFE_HOMING_X_POINT ((X_MIN_POS + X_MAX_POS) / 2)
  124. #endif
  125. #ifndef Z_SAFE_HOMING_Y_POINT
  126. #define Z_SAFE_HOMING_Y_POINT ((Y_MIN_POS + Y_MAX_POS) / 2)
  127. #endif
  128. #define X_TILT_FULCRUM Z_SAFE_HOMING_X_POINT
  129. #define Y_TILT_FULCRUM Z_SAFE_HOMING_Y_POINT
  130. #else
  131. #define X_TILT_FULCRUM X_HOME_POS
  132. #define Y_TILT_FULCRUM Y_HOME_POS
  133. #endif
  134. /**
  135. * Host keep alive
  136. */
  137. #ifndef DEFAULT_KEEPALIVE_INTERVAL
  138. #define DEFAULT_KEEPALIVE_INTERVAL 2
  139. #endif
  140. /**
  141. * MAX_STEP_FREQUENCY differs for TOSHIBA
  142. */
  143. #if ENABLED(CONFIG_STEPPERS_TOSHIBA)
  144. #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
  145. #else
  146. #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
  147. #endif
  148. // MS1 MS2 Stepper Driver Microstepping mode table
  149. #define MICROSTEP1 LOW,LOW
  150. #define MICROSTEP2 HIGH,LOW
  151. #define MICROSTEP4 LOW,HIGH
  152. #define MICROSTEP8 HIGH,HIGH
  153. #define MICROSTEP16 HIGH,HIGH
  154. /**
  155. * Advance calculated values
  156. */
  157. #if ENABLED(ADVANCE)
  158. #define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI)
  159. #define STEPS_PER_CUBIC_MM_E (axis_steps_per_mm[E_AXIS] / (EXTRUSION_AREA))
  160. #endif
  161. #if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER)
  162. #undef SD_DETECT_INVERTED
  163. #endif
  164. /**
  165. * Set defaults for missing (newer) options
  166. */
  167. #ifndef DISABLE_INACTIVE_X
  168. #define DISABLE_INACTIVE_X DISABLE_X
  169. #endif
  170. #ifndef DISABLE_INACTIVE_Y
  171. #define DISABLE_INACTIVE_Y DISABLE_Y
  172. #endif
  173. #ifndef DISABLE_INACTIVE_Z
  174. #define DISABLE_INACTIVE_Z DISABLE_Z
  175. #endif
  176. #ifndef DISABLE_INACTIVE_E
  177. #define DISABLE_INACTIVE_E DISABLE_E
  178. #endif
  179. // Power Signal Control Definitions
  180. // By default use ATX definition
  181. #ifndef POWER_SUPPLY
  182. #define POWER_SUPPLY 1
  183. #endif
  184. #if (POWER_SUPPLY == 1) // 1 = ATX
  185. #define PS_ON_AWAKE LOW
  186. #define PS_ON_ASLEEP HIGH
  187. #elif (POWER_SUPPLY == 2) // 2 = X-Box 360 203W
  188. #define PS_ON_AWAKE HIGH
  189. #define PS_ON_ASLEEP LOW
  190. #endif
  191. #define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && PIN_EXISTS(PS_ON))
  192. /**
  193. * Temp Sensor defines
  194. */
  195. #if TEMP_SENSOR_0 == -3
  196. #define HEATER_0_USES_MAX6675
  197. #define MAX6675_IS_MAX31855
  198. #define MAX6675_TMIN -270
  199. #define MAX6675_TMAX 1800
  200. #elif TEMP_SENSOR_0 == -2
  201. #define HEATER_0_USES_MAX6675
  202. #define MAX6675_TMIN 0
  203. #define MAX6675_TMAX 1024
  204. #elif TEMP_SENSOR_0 == -1
  205. #define HEATER_0_USES_AD595
  206. #elif TEMP_SENSOR_0 == 0
  207. #undef HEATER_0_MINTEMP
  208. #undef HEATER_0_MAXTEMP
  209. #elif TEMP_SENSOR_0 > 0
  210. #define THERMISTORHEATER_0 TEMP_SENSOR_0
  211. #define HEATER_0_USES_THERMISTOR
  212. #endif
  213. #if TEMP_SENSOR_1 <= -2
  214. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_1"
  215. #elif TEMP_SENSOR_1 == -1
  216. #define HEATER_1_USES_AD595
  217. #elif TEMP_SENSOR_1 == 0
  218. #undef HEATER_1_MINTEMP
  219. #undef HEATER_1_MAXTEMP
  220. #elif TEMP_SENSOR_1 > 0
  221. #define THERMISTORHEATER_1 TEMP_SENSOR_1
  222. #define HEATER_1_USES_THERMISTOR
  223. #endif
  224. #if TEMP_SENSOR_2 <= -2
  225. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_2"
  226. #elif TEMP_SENSOR_2 == -1
  227. #define HEATER_2_USES_AD595
  228. #elif TEMP_SENSOR_2 == 0
  229. #undef HEATER_2_MINTEMP
  230. #undef HEATER_2_MAXTEMP
  231. #elif TEMP_SENSOR_2 > 0
  232. #define THERMISTORHEATER_2 TEMP_SENSOR_2
  233. #define HEATER_2_USES_THERMISTOR
  234. #endif
  235. #if TEMP_SENSOR_3 <= -2
  236. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_3"
  237. #elif TEMP_SENSOR_3 == -1
  238. #define HEATER_3_USES_AD595
  239. #elif TEMP_SENSOR_3 == 0
  240. #undef HEATER_3_MINTEMP
  241. #undef HEATER_3_MAXTEMP
  242. #elif TEMP_SENSOR_3 > 0
  243. #define THERMISTORHEATER_3 TEMP_SENSOR_3
  244. #define HEATER_3_USES_THERMISTOR
  245. #endif
  246. #if TEMP_SENSOR_BED <= -2
  247. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_BED"
  248. #elif TEMP_SENSOR_BED == -1
  249. #define BED_USES_AD595
  250. #elif TEMP_SENSOR_BED == 0
  251. #undef BED_MINTEMP
  252. #undef BED_MAXTEMP
  253. #elif TEMP_SENSOR_BED > 0
  254. #define THERMISTORBED TEMP_SENSOR_BED
  255. #define BED_USES_THERMISTOR
  256. #endif
  257. /**
  258. * Flags for PID handling
  259. */
  260. #define HAS_PID_HEATING (ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED))
  261. #define HAS_PID_FOR_BOTH (ENABLED(PIDTEMP) && ENABLED(PIDTEMPBED))
  262. /**
  263. * Default hotend offsets, if not defined
  264. */
  265. #if HOTENDS > 1
  266. #ifndef HOTEND_OFFSET_X
  267. #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
  268. #endif
  269. #ifndef HOTEND_OFFSET_Y
  270. #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
  271. #endif
  272. #if !defined(HOTEND_OFFSET_Z) && (ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER))
  273. #define HOTEND_OFFSET_Z { 0 }
  274. #endif
  275. #endif
  276. /**
  277. * ARRAY_BY_EXTRUDERS based on EXTRUDERS
  278. */
  279. #define ARRAY_BY_EXTRUDERS(...) ARRAY_N(EXTRUDERS, __VA_ARGS__)
  280. #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1)
  281. /**
  282. * ARRAY_BY_HOTENDS based on HOTENDS
  283. */
  284. #define ARRAY_BY_HOTENDS(...) ARRAY_N(HOTENDS, __VA_ARGS__)
  285. #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
  286. /**
  287. * Z_DUAL_ENDSTOPS endstop reassignment
  288. */
  289. #if ENABLED(Z_DUAL_ENDSTOPS)
  290. #define _XMIN_ 100
  291. #define _YMIN_ 200
  292. #define _ZMIN_ 300
  293. #define _XMAX_ 101
  294. #define _YMAX_ 201
  295. #define _ZMAX_ 301
  296. #if Z2_USE_ENDSTOP == _XMIN_
  297. #define USE_XMIN_PLUG
  298. #elif Z2_USE_ENDSTOP == _XMAX_
  299. #define USE_XMAX_PLUG
  300. #elif Z2_USE_ENDSTOP == _YMIN_
  301. #define USE_YMIN_PLUG
  302. #elif Z2_USE_ENDSTOP == _YMAX_
  303. #define USE_YMAX_PLUG
  304. #elif Z2_USE_ENDSTOP == _ZMIN_
  305. #define USE_ZMIN_PLUG
  306. #elif Z2_USE_ENDSTOP == _ZMAX_
  307. #define USE_ZMAX_PLUG
  308. #endif
  309. #if Z_HOME_DIR > 0
  310. #if Z2_USE_ENDSTOP == _XMIN_
  311. #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  312. #define Z2_MAX_PIN X_MIN_PIN
  313. #elif Z2_USE_ENDSTOP == _XMAX_
  314. #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  315. #define Z2_MAX_PIN X_MAX_PIN
  316. #elif Z2_USE_ENDSTOP == _YMIN_
  317. #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  318. #define Z2_MAX_PIN Y_MIN_PIN
  319. #elif Z2_USE_ENDSTOP == _YMAX_
  320. #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  321. #define Z2_MAX_PIN Y_MAX_PIN
  322. #elif Z2_USE_ENDSTOP == _ZMIN_
  323. #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  324. #define Z2_MAX_PIN Z_MIN_PIN
  325. #elif Z2_USE_ENDSTOP == _ZMAX_
  326. #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  327. #define Z2_MAX_PIN Z_MAX_PIN
  328. #else
  329. #define Z2_MAX_ENDSTOP_INVERTING false
  330. #endif
  331. #else
  332. #if Z2_USE_ENDSTOP == _XMIN_
  333. #define Z2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  334. #define Z2_MIN_PIN X_MIN_PIN
  335. #elif Z2_USE_ENDSTOP == _XMAX_
  336. #define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  337. #define Z2_MIN_PIN X_MAX_PIN
  338. #elif Z2_USE_ENDSTOP == _YMIN_
  339. #define Z2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  340. #define Z2_MIN_PIN Y_MIN_PIN
  341. #elif Z2_USE_ENDSTOP == _YMAX_
  342. #define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  343. #define Z2_MIN_PIN Y_MAX_PIN
  344. #elif Z2_USE_ENDSTOP == _ZMIN_
  345. #define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  346. #define Z2_MIN_PIN Z_MIN_PIN
  347. #elif Z2_USE_ENDSTOP == _ZMAX_
  348. #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  349. #define Z2_MIN_PIN Z_MAX_PIN
  350. #else
  351. #define Z2_MIN_ENDSTOP_INVERTING false
  352. #endif
  353. #endif
  354. #endif
  355. #define IS_Z2_OR_PROBE(P) (P == Z2_MIN_PIN || P == Z2_MAX_PIN || P == Z_MIN_PROBE_PIN)
  356. /**
  357. * Set ENDSTOPPULLUPS for active endstop switches
  358. */
  359. #if ENABLED(ENDSTOPPULLUPS)
  360. #if ENABLED(USE_XMAX_PLUG)
  361. #define ENDSTOPPULLUP_XMAX
  362. #endif
  363. #if ENABLED(USE_YMAX_PLUG)
  364. #define ENDSTOPPULLUP_YMAX
  365. #endif
  366. #if ENABLED(USE_ZMAX_PLUG)
  367. #define ENDSTOPPULLUP_ZMAX
  368. #endif
  369. #if ENABLED(USE_XMIN_PLUG)
  370. #define ENDSTOPPULLUP_XMIN
  371. #endif
  372. #if ENABLED(USE_YMIN_PLUG)
  373. #define ENDSTOPPULLUP_YMIN
  374. #endif
  375. #if ENABLED(USE_ZMIN_PLUG)
  376. #define ENDSTOPPULLUP_ZMIN
  377. #endif
  378. #endif
  379. /**
  380. * Shorthand for pin tests, used wherever needed
  381. */
  382. #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2)
  383. #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2)
  384. #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2)
  385. #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2)
  386. #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
  387. #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
  388. #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
  389. #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
  390. #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
  391. #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
  392. #define HAS_AUTO_FAN_0 (PIN_EXISTS(E0_AUTO_FAN))
  393. #define HAS_AUTO_FAN_1 (HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN))
  394. #define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN))
  395. #define HAS_AUTO_FAN_3 (HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN))
  396. #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3)
  397. #define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
  398. #define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
  399. #define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
  400. #define AUTO_3_IS_0 (E3_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
  401. #define AUTO_3_IS_1 (E3_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
  402. #define AUTO_3_IS_2 (E3_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
  403. #define HAS_FAN0 (PIN_EXISTS(FAN))
  404. #define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLERFAN_PIN != FAN1_PIN && E0_AUTO_FAN_PIN != FAN1_PIN && E1_AUTO_FAN_PIN != FAN1_PIN && E2_AUTO_FAN_PIN != FAN1_PIN && E3_AUTO_FAN_PIN != FAN1_PIN)
  405. #define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLERFAN_PIN != FAN2_PIN && E0_AUTO_FAN_PIN != FAN2_PIN && E1_AUTO_FAN_PIN != FAN2_PIN && E2_AUTO_FAN_PIN != FAN2_PIN && E3_AUTO_FAN_PIN != FAN2_PIN)
  406. #define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN))
  407. #define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0)
  408. #define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
  409. #define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
  410. #define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
  411. #define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
  412. #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
  413. #define HAS_FIL_RUNOUT (PIN_EXISTS(FIL_RUNOUT))
  414. #define HAS_HOME (PIN_EXISTS(HOME))
  415. #define HAS_KILL (PIN_EXISTS(KILL))
  416. #define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
  417. #define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
  418. #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN))
  419. #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN))
  420. #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN))
  421. #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN))
  422. #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN))
  423. #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN))
  424. #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
  425. #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
  426. #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
  427. #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
  428. #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
  429. #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
  430. #define HAS_MICROSTEPS_X (PIN_EXISTS(X_MS1))
  431. #define HAS_MICROSTEPS_Y (PIN_EXISTS(Y_MS1))
  432. #define HAS_MICROSTEPS_Z (PIN_EXISTS(Z_MS1))
  433. #define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
  434. #define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
  435. #define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
  436. #define HAS_MICROSTEPS (HAS_MICROSTEPS_X || HAS_MICROSTEPS_Y || HAS_MICROSTEPS_Z || HAS_MICROSTEPS_E0 || HAS_MICROSTEPS_E1 || HAS_MICROSTEPS_E2)
  437. #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
  438. #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
  439. #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
  440. #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
  441. #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
  442. #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
  443. #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
  444. #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
  445. #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
  446. #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
  447. #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
  448. #define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE))
  449. #define HAS_X_DIR (PIN_EXISTS(X_DIR))
  450. #define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
  451. #define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
  452. #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
  453. #define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
  454. #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
  455. #define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
  456. #define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
  457. #define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
  458. #define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
  459. #define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
  460. #define HAS_X_STEP (PIN_EXISTS(X_STEP))
  461. #define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
  462. #define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
  463. #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
  464. #define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
  465. #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
  466. #define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
  467. #define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
  468. #define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
  469. #define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
  470. #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
  471. #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
  472. #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
  473. #define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT))
  474. #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
  475. #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
  476. #define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED))
  477. /**
  478. * This setting is also used by M109 when trying to calculate
  479. * a ballpark safe margin to prevent wait-forever situation.
  480. */
  481. #ifndef EXTRUDE_MINTEMP
  482. #define EXTRUDE_MINTEMP 170
  483. #endif
  484. /**
  485. * Helper Macros for heaters and extruder fan
  486. */
  487. #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
  488. #if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
  489. #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
  490. #if HOTENDS > 2
  491. #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
  492. #if HOTENDS > 3
  493. #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
  494. #endif
  495. #endif
  496. #endif
  497. #if ENABLED(HEATERS_PARALLEL)
  498. #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
  499. #else
  500. #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
  501. #endif
  502. #if HAS_HEATER_BED
  503. #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, v)
  504. #endif
  505. /**
  506. * Up to 3 PWM fans
  507. */
  508. #if HAS_FAN2
  509. #define FAN_COUNT 3
  510. #elif HAS_FAN1
  511. #define FAN_COUNT 2
  512. #elif HAS_FAN0
  513. #define FAN_COUNT 1
  514. #else
  515. #define FAN_COUNT 0
  516. #endif
  517. #if HAS_FAN0
  518. #define WRITE_FAN(v) WRITE(FAN_PIN, v)
  519. #define WRITE_FAN0(v) WRITE_FAN(v)
  520. #endif
  521. #if HAS_FAN1
  522. #define WRITE_FAN1(v) WRITE(FAN1_PIN, v)
  523. #endif
  524. #if HAS_FAN2
  525. #define WRITE_FAN2(v) WRITE(FAN2_PIN, v)
  526. #endif
  527. #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
  528. /**
  529. * Servos and probes
  530. */
  531. #if HAS_SERVOS
  532. #ifndef Z_ENDSTOP_SERVO_NR
  533. #define Z_ENDSTOP_SERVO_NR -1
  534. #endif
  535. #endif
  536. #define PROBE_PIN_CONFIGURED (HAS_Z_MIN_PROBE_PIN || (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)))
  537. #define HAS_BED_PROBE (PROBE_SELECTED && PROBE_PIN_CONFIGURED)
  538. #if ENABLED(Z_PROBE_ALLEN_KEY)
  539. #define PROBE_IS_TRIGGERED_WHEN_STOWED_TEST
  540. #endif
  541. /**
  542. * Bed Probe dependencies
  543. */
  544. #if HAS_BED_PROBE
  545. #if ENABLED(ENDSTOPPULLUPS) && HAS_Z_MIN_PROBE_PIN
  546. #define ENDSTOPPULLUP_ZMIN_PROBE
  547. #endif
  548. #ifndef Z_PROBE_OFFSET_RANGE_MIN
  549. #define Z_PROBE_OFFSET_RANGE_MIN -20
  550. #endif
  551. #ifndef Z_PROBE_OFFSET_RANGE_MAX
  552. #define Z_PROBE_OFFSET_RANGE_MAX 20
  553. #endif
  554. #ifndef XY_PROBE_SPEED
  555. #ifdef HOMING_FEEDRATE_XY
  556. #define XY_PROBE_SPEED HOMING_FEEDRATE_XY
  557. #else
  558. #define XY_PROBE_SPEED 4000
  559. #endif
  560. #endif
  561. #if Z_CLEARANCE_BETWEEN_PROBES > Z_CLEARANCE_DEPLOY_PROBE
  562. #define _Z_CLEARANCE_DEPLOY_PROBE Z_CLEARANCE_BETWEEN_PROBES
  563. #else
  564. #define _Z_CLEARANCE_DEPLOY_PROBE Z_CLEARANCE_DEPLOY_PROBE
  565. #endif
  566. #else
  567. #undef X_PROBE_OFFSET_FROM_EXTRUDER
  568. #undef Y_PROBE_OFFSET_FROM_EXTRUDER
  569. #undef Z_PROBE_OFFSET_FROM_EXTRUDER
  570. #define X_PROBE_OFFSET_FROM_EXTRUDER 0
  571. #define Y_PROBE_OFFSET_FROM_EXTRUDER 0
  572. #define Z_PROBE_OFFSET_FROM_EXTRUDER 0
  573. #endif
  574. /**
  575. * Delta radius/rod trimmers
  576. */
  577. #if ENABLED(DELTA)
  578. #ifndef DELTA_RADIUS_TRIM_TOWER_1
  579. #define DELTA_RADIUS_TRIM_TOWER_1 0.0
  580. #endif
  581. #ifndef DELTA_RADIUS_TRIM_TOWER_2
  582. #define DELTA_RADIUS_TRIM_TOWER_2 0.0
  583. #endif
  584. #ifndef DELTA_RADIUS_TRIM_TOWER_3
  585. #define DELTA_RADIUS_TRIM_TOWER_3 0.0
  586. #endif
  587. #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_1
  588. #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0
  589. #endif
  590. #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_2
  591. #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0
  592. #endif
  593. #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
  594. #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
  595. #endif
  596. #endif
  597. /**
  598. * Set ABL options based on the specific type of leveling
  599. */
  600. #define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
  601. #define ABL_GRID (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
  602. #define HAS_ABL (ABL_PLANAR || ABL_GRID)
  603. #define PLANNER_LEVELING (HAS_ABL || ENABLED(MESH_BED_LEVELING))
  604. #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
  605. #if HAS_PROBING_PROCEDURE
  606. #define PROBE_BED_WIDTH abs(RIGHT_PROBE_BED_POSITION - (LEFT_PROBE_BED_POSITION))
  607. #define PROBE_BED_HEIGHT abs(BACK_PROBE_BED_POSITION - (FRONT_PROBE_BED_POSITION))
  608. #endif
  609. /**
  610. * Buzzer/Speaker
  611. */
  612. #if ENABLED(LCD_USE_I2C_BUZZER)
  613. #ifndef LCD_FEEDBACK_FREQUENCY_HZ
  614. #define LCD_FEEDBACK_FREQUENCY_HZ 1000
  615. #endif
  616. #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
  617. #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
  618. #endif
  619. #else
  620. #ifndef LCD_FEEDBACK_FREQUENCY_HZ
  621. #define LCD_FEEDBACK_FREQUENCY_HZ 5000
  622. #endif
  623. #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
  624. #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
  625. #endif
  626. #endif
  627. /**
  628. * Z_HOMING_HEIGHT / Z_CLEARANCE_BETWEEN_PROBES
  629. */
  630. #ifndef Z_HOMING_HEIGHT
  631. #ifndef Z_CLEARANCE_BETWEEN_PROBES
  632. #define Z_HOMING_HEIGHT 0
  633. #else
  634. #define Z_HOMING_HEIGHT Z_CLEARANCE_BETWEEN_PROBES
  635. #endif
  636. #endif
  637. #ifndef Z_CLEARANCE_BETWEEN_PROBES
  638. #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT
  639. #endif
  640. #if IS_KINEMATIC
  641. // Check for this in the code instead
  642. #define MIN_PROBE_X X_MIN_POS
  643. #define MAX_PROBE_X X_MAX_POS
  644. #define MIN_PROBE_Y Y_MIN_POS
  645. #define MAX_PROBE_Y Y_MAX_POS
  646. #else
  647. // Boundaries for probing based on set limits
  648. #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
  649. #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
  650. #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
  651. #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
  652. #endif
  653. // Stepper pulse duration, in cycles
  654. #define STEP_PULSE_CYCLES ((MINIMUM_STEPPER_PULSE) * CYCLES_PER_MICROSECOND)
  655. #ifndef DELTA_ENDSTOP_ADJ
  656. #define DELTA_ENDSTOP_ADJ { 0 }
  657. #endif
  658. #endif // CONDITIONALS_POST_H