My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Conditionals_post.h 29KB

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