My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

Conditionals_post.h 30KB

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