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 26KB

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