My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Conditionals_post.h 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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. #if ENABLED(EMERGENCY_PARSER)
  29. #define EMERGENCY_PARSER_CAPABILITIES " EMERGENCY_CODES:M108,M112,M410"
  30. #else
  31. #define EMERGENCY_PARSER_CAPABILITIES ""
  32. #endif
  33. /**
  34. * Set ENDSTOPPULLUPS for unused endstop switches
  35. */
  36. #if ENABLED(ENDSTOPPULLUPS)
  37. #if ENABLED(USE_XMAX_PLUG)
  38. #define ENDSTOPPULLUP_XMAX
  39. #endif
  40. #if ENABLED(USE_YMAX_PLUG)
  41. #define ENDSTOPPULLUP_YMAX
  42. #endif
  43. #if ENABLED(USE_ZMAX_PLUG)
  44. #define ENDSTOPPULLUP_ZMAX
  45. #endif
  46. #if ENABLED(USE_XMIN_PLUG)
  47. #define ENDSTOPPULLUP_XMIN
  48. #endif
  49. #if ENABLED(USE_YMIN_PLUG)
  50. #define ENDSTOPPULLUP_YMIN
  51. #endif
  52. #if ENABLED(USE_ZMIN_PLUG)
  53. #define ENDSTOPPULLUP_ZMIN
  54. #endif
  55. #if DISABLED(DISABLE_Z_MIN_PROBE_ENDSTOP)
  56. #define ENDSTOPPULLUP_ZMIN_PROBE
  57. #endif
  58. #endif
  59. /**
  60. * Axis lengths
  61. */
  62. #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
  63. #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
  64. #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
  65. /**
  66. * CoreXY and CoreXZ
  67. */
  68. #if ENABLED(COREXY)
  69. #define CORE_AXIS_1 A_AXIS // XY from A + B
  70. #define CORE_AXIS_2 B_AXIS
  71. #define NORMAL_AXIS Z_AXIS
  72. #elif ENABLED(COREXZ)
  73. #define CORE_AXIS_1 A_AXIS // XZ from A + C
  74. #define CORE_AXIS_2 C_AXIS
  75. #define NORMAL_AXIS Y_AXIS
  76. #elif ENABLED(COREYZ)
  77. #define CORE_AXIS_1 B_AXIS // YZ from B + C
  78. #define CORE_AXIS_2 C_AXIS
  79. #define NORMAL_AXIS X_AXIS
  80. #endif
  81. /**
  82. * SCARA
  83. */
  84. #if ENABLED(SCARA)
  85. #undef SLOWDOWN
  86. #define QUICK_HOME //SCARA needs Quickhome
  87. #endif
  88. /**
  89. * Set the home position based on settings or manual overrides
  90. */
  91. #ifdef MANUAL_X_HOME_POS
  92. #define X_HOME_POS MANUAL_X_HOME_POS
  93. #elif ENABLED(BED_CENTER_AT_0_0)
  94. #if ENABLED(DELTA)
  95. #define X_HOME_POS 0
  96. #else
  97. #define X_HOME_POS ((X_MAX_LENGTH) * (X_HOME_DIR) * 0.5)
  98. #endif
  99. #else
  100. #if ENABLED(DELTA)
  101. #define X_HOME_POS ((X_MAX_LENGTH) * 0.5)
  102. #else
  103. #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
  104. #endif
  105. #endif
  106. #ifdef MANUAL_Y_HOME_POS
  107. #define Y_HOME_POS MANUAL_Y_HOME_POS
  108. #elif ENABLED(BED_CENTER_AT_0_0)
  109. #if ENABLED(DELTA)
  110. #define Y_HOME_POS 0
  111. #else
  112. #define Y_HOME_POS ((Y_MAX_LENGTH) * (Y_HOME_DIR) * 0.5)
  113. #endif
  114. #else
  115. #if ENABLED(DELTA)
  116. #define Y_HOME_POS ((Y_MAX_LENGTH) * 0.5)
  117. #else
  118. #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
  119. #endif
  120. #endif
  121. #ifdef MANUAL_Z_HOME_POS
  122. #define Z_HOME_POS MANUAL_Z_HOME_POS
  123. #else
  124. #define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
  125. #endif
  126. /**
  127. * The BLTouch Probe emulates a servo probe
  128. */
  129. #if ENABLED(BLTOUCH)
  130. #undef Z_ENDSTOP_SERVO_NR
  131. #undef Z_SERVO_ANGLES
  132. #define Z_ENDSTOP_SERVO_NR 0
  133. #define Z_SERVO_ANGLES {10,90} // For BLTouch 10=deploy, 90=retract
  134. #undef DEACTIVATE_SERVOS_AFTER_MOVE
  135. #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  136. #undef Z_MIN_ENDSTOP_INVERTING
  137. #define Z_MIN_ENDSTOP_INVERTING false
  138. #endif
  139. #endif
  140. /**
  141. * Auto Bed Leveling and Z Probe Repeatability Test
  142. */
  143. #define HAS_PROBING_PROCEDURE (ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
  144. // Boundaries for probing based on set limits
  145. #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
  146. #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
  147. #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
  148. #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
  149. #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
  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
  158. */
  159. #if ENABLED(DELTA)
  160. #undef Z_SAFE_HOMING
  161. #endif
  162. /**
  163. * Safe Homing Options
  164. */
  165. #if ENABLED(Z_SAFE_HOMING)
  166. #ifndef Z_SAFE_HOMING_X_POINT
  167. #define Z_SAFE_HOMING_X_POINT ((X_MIN_POS + X_MAX_POS) / 2)
  168. #endif
  169. #ifndef Z_SAFE_HOMING_Y_POINT
  170. #define Z_SAFE_HOMING_Y_POINT ((Y_MIN_POS + Y_MAX_POS) / 2)
  171. #endif
  172. #endif
  173. /**
  174. * Host keep alive
  175. */
  176. #ifndef DEFAULT_KEEPALIVE_INTERVAL
  177. #define DEFAULT_KEEPALIVE_INTERVAL 2
  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] / (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. #elif TEMP_SENSOR_0 == -2
  238. #define HEATER_0_USES_MAX6675
  239. #elif TEMP_SENSOR_0 == -1
  240. #define HEATER_0_USES_AD595
  241. #elif TEMP_SENSOR_0 == 0
  242. #undef HEATER_0_MINTEMP
  243. #undef HEATER_0_MAXTEMP
  244. #elif TEMP_SENSOR_0 > 0
  245. #define THERMISTORHEATER_0 TEMP_SENSOR_0
  246. #define HEATER_0_USES_THERMISTOR
  247. #endif
  248. #if TEMP_SENSOR_1 <= -2
  249. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_1"
  250. #elif TEMP_SENSOR_1 == -1
  251. #define HEATER_1_USES_AD595
  252. #elif TEMP_SENSOR_1 == 0
  253. #undef HEATER_1_MINTEMP
  254. #undef HEATER_1_MAXTEMP
  255. #elif TEMP_SENSOR_1 > 0
  256. #define THERMISTORHEATER_1 TEMP_SENSOR_1
  257. #define HEATER_1_USES_THERMISTOR
  258. #endif
  259. #if TEMP_SENSOR_2 <= -2
  260. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_2"
  261. #elif TEMP_SENSOR_2 == -1
  262. #define HEATER_2_USES_AD595
  263. #elif TEMP_SENSOR_2 == 0
  264. #undef HEATER_2_MINTEMP
  265. #undef HEATER_2_MAXTEMP
  266. #elif TEMP_SENSOR_2 > 0
  267. #define THERMISTORHEATER_2 TEMP_SENSOR_2
  268. #define HEATER_2_USES_THERMISTOR
  269. #endif
  270. #if TEMP_SENSOR_3 <= -2
  271. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_3"
  272. #elif TEMP_SENSOR_3 == -1
  273. #define HEATER_3_USES_AD595
  274. #elif TEMP_SENSOR_3 == 0
  275. #undef HEATER_3_MINTEMP
  276. #undef HEATER_3_MAXTEMP
  277. #elif TEMP_SENSOR_3 > 0
  278. #define THERMISTORHEATER_3 TEMP_SENSOR_3
  279. #define HEATER_3_USES_THERMISTOR
  280. #endif
  281. #if TEMP_SENSOR_BED <= -2
  282. #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_BED"
  283. #elif TEMP_SENSOR_BED == -1
  284. #define BED_USES_AD595
  285. #elif TEMP_SENSOR_BED == 0
  286. #undef BED_MINTEMP
  287. #undef BED_MAXTEMP
  288. #elif TEMP_SENSOR_BED > 0
  289. #define THERMISTORBED TEMP_SENSOR_BED
  290. #define BED_USES_THERMISTOR
  291. #endif
  292. /**
  293. * Flags for PID handling
  294. */
  295. #define HAS_PID_HEATING (ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED))
  296. #define HAS_PID_FOR_BOTH (ENABLED(PIDTEMP) && ENABLED(PIDTEMPBED))
  297. /**
  298. * Extruders have some combination of stepper motors and hotends
  299. * so we separate these concepts into the defines:
  300. *
  301. * EXTRUDERS - Number of Selectable Tools
  302. * HOTENDS - Number of hotends, whether connected or separate
  303. * E_STEPPERS - Number of actual E stepper motors
  304. * TOOL_E_INDEX - Index to use when getting/setting the tool state
  305. *
  306. */
  307. #if ENABLED(SINGLENOZZLE) // One hotend, multi-extruder
  308. #define HOTENDS 1
  309. #define E_STEPPERS EXTRUDERS
  310. #define E_MANUAL EXTRUDERS
  311. #define TOOL_E_INDEX current_block->active_extruder
  312. #undef TEMP_SENSOR_1_AS_REDUNDANT
  313. #undef HOTEND_OFFSET_X
  314. #undef HOTEND_OFFSET_Y
  315. #elif ENABLED(SWITCHING_EXTRUDER) // One E stepper, unified E axis, two hotends
  316. #define HOTENDS EXTRUDERS
  317. #define E_STEPPERS 1
  318. #define E_MANUAL 1
  319. #define TOOL_E_INDEX 0
  320. #ifndef HOTEND_OFFSET_Z
  321. #define HOTEND_OFFSET_Z { 0 }
  322. #endif
  323. #elif ENABLED(MIXING_EXTRUDER) // Multi-stepper, unified E axis, one hotend
  324. #define HOTENDS 1
  325. #define E_STEPPERS MIXING_STEPPERS
  326. #define E_MANUAL 1
  327. #define TOOL_E_INDEX 0
  328. #else // One stepper, E axis, and hotend per tool
  329. #define HOTENDS EXTRUDERS
  330. #define E_STEPPERS EXTRUDERS
  331. #define E_MANUAL EXTRUDERS
  332. #define TOOL_E_INDEX current_block->active_extruder
  333. #endif
  334. /**
  335. * Default hotend offsets, if not defined
  336. */
  337. #if HOTENDS > 1
  338. #ifndef HOTEND_OFFSET_X
  339. #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
  340. #endif
  341. #ifndef HOTEND_OFFSET_Y
  342. #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
  343. #endif
  344. #if !defined(HOTEND_OFFSET_Z) && (ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER))
  345. #define HOTEND_OFFSET_Z { 0 }
  346. #endif
  347. #endif
  348. /**
  349. * ARRAY_BY_EXTRUDERS based on EXTRUDERS
  350. */
  351. #define ARRAY_BY_EXTRUDERS(args...) ARRAY_N(EXTRUDERS, args)
  352. #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1)
  353. /**
  354. * ARRAY_BY_HOTENDS based on HOTENDS
  355. */
  356. #define ARRAY_BY_HOTENDS(args...) ARRAY_N(HOTENDS, args)
  357. #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
  358. /**
  359. * Z_DUAL_ENDSTOPS endstop reassignment
  360. */
  361. #if ENABLED(Z_DUAL_ENDSTOPS)
  362. #define _XMIN_ 100
  363. #define _YMIN_ 200
  364. #define _ZMIN_ 300
  365. #define _XMAX_ 101
  366. #define _YMAX_ 201
  367. #define _ZMAX_ 301
  368. #if Z2_USE_ENDSTOP == _XMAX_
  369. #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  370. #define Z2_MAX_PIN X_MAX_PIN
  371. #undef USE_XMAX_PLUG
  372. #elif Z2_USE_ENDSTOP == _YMAX_
  373. #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  374. #define Z2_MAX_PIN Y_MAX_PIN
  375. #undef USE_YMAX_PLUG
  376. #elif Z2_USE_ENDSTOP == _ZMAX_
  377. #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  378. #define Z2_MAX_PIN Z_MAX_PIN
  379. #undef USE_ZMAX_PLUG
  380. #elif Z2_USE_ENDSTOP == _XMIN_
  381. #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  382. #define Z2_MAX_PIN X_MIN_PIN
  383. #undef USE_XMIN_PLUG
  384. #elif Z2_USE_ENDSTOP == _YMIN_
  385. #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  386. #define Z2_MAX_PIN Y_MIN_PIN
  387. #undef USE_YMIN_PLUG
  388. #elif Z2_USE_ENDSTOP == _ZMIN_
  389. #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  390. #define Z2_MAX_PIN Z_MIN_PIN
  391. #undef USE_ZMIN_PLUG
  392. #else
  393. #define Z2_MAX_ENDSTOP_INVERTING false
  394. #endif
  395. #endif
  396. /**
  397. * Shorthand for pin tests, used wherever needed
  398. */
  399. #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2)
  400. #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2)
  401. #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2)
  402. #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2)
  403. #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
  404. #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
  405. #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
  406. #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
  407. #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
  408. #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
  409. #define HAS_AUTO_FAN_0 (PIN_EXISTS(EXTRUDER_0_AUTO_FAN))
  410. #define HAS_AUTO_FAN_1 (PIN_EXISTS(EXTRUDER_1_AUTO_FAN))
  411. #define HAS_AUTO_FAN_2 (PIN_EXISTS(EXTRUDER_2_AUTO_FAN))
  412. #define HAS_AUTO_FAN_3 (PIN_EXISTS(EXTRUDER_3_AUTO_FAN))
  413. #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3)
  414. #define HAS_FAN0 (PIN_EXISTS(FAN))
  415. #define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLERFAN_PIN != FAN1_PIN && EXTRUDER_0_AUTO_FAN_PIN != FAN1_PIN && EXTRUDER_1_AUTO_FAN_PIN != FAN1_PIN && EXTRUDER_2_AUTO_FAN_PIN != FAN1_PIN)
  416. #define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLERFAN_PIN != FAN2_PIN && EXTRUDER_0_AUTO_FAN_PIN != FAN2_PIN && EXTRUDER_1_AUTO_FAN_PIN != FAN2_PIN && EXTRUDER_2_AUTO_FAN_PIN != FAN2_PIN)
  417. #define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN))
  418. #define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0)
  419. #define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
  420. #define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
  421. #define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
  422. #define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
  423. #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
  424. #define HAS_FIL_RUNOUT (PIN_EXISTS(FIL_RUNOUT))
  425. #define HAS_HOME (PIN_EXISTS(HOME))
  426. #define HAS_KILL (PIN_EXISTS(KILL))
  427. #define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
  428. #define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
  429. #define HAS_X_MIN (PIN_EXISTS(X_MIN))
  430. #define HAS_X_MAX (PIN_EXISTS(X_MAX))
  431. #define HAS_Y_MIN (PIN_EXISTS(Y_MIN))
  432. #define HAS_Y_MAX (PIN_EXISTS(Y_MAX))
  433. #define HAS_Z_MIN (PIN_EXISTS(Z_MIN))
  434. #define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
  435. #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
  436. #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
  437. #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
  438. #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
  439. #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
  440. #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
  441. #define HAS_MICROSTEPS (PIN_EXISTS(X_MS1))
  442. #define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
  443. #define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
  444. #define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
  445. #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
  446. #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
  447. #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
  448. #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
  449. #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
  450. #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
  451. #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
  452. #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
  453. #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
  454. #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
  455. #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
  456. #define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE))
  457. #define HAS_X_DIR (PIN_EXISTS(X_DIR))
  458. #define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
  459. #define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
  460. #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
  461. #define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
  462. #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
  463. #define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
  464. #define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
  465. #define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
  466. #define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
  467. #define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
  468. #define HAS_X_STEP (PIN_EXISTS(X_STEP))
  469. #define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
  470. #define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
  471. #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
  472. #define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
  473. #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
  474. #define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
  475. #define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
  476. #define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
  477. #define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
  478. #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
  479. #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
  480. #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
  481. #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
  482. #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
  483. #define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED))
  484. /**
  485. * This value is used by M109 when trying to calculate a ballpark safe margin
  486. * to prevent wait-forever situation.
  487. */
  488. #ifndef EXTRUDE_MINTEMP
  489. #define EXTRUDE_MINTEMP 170
  490. #endif
  491. /**
  492. * Helper Macros for heaters and extruder fan
  493. */
  494. #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
  495. #if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
  496. #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
  497. #if HOTENDS > 2
  498. #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
  499. #if HOTENDS > 3
  500. #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
  501. #endif
  502. #endif
  503. #endif
  504. #if ENABLED(HEATERS_PARALLEL)
  505. #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
  506. #else
  507. #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
  508. #endif
  509. #if HAS_HEATER_BED
  510. #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, v)
  511. #endif
  512. /**
  513. * Up to 3 PWM fans
  514. */
  515. #if HAS_FAN2
  516. #define FAN_COUNT 3
  517. #elif HAS_FAN1
  518. #define FAN_COUNT 2
  519. #elif HAS_FAN0
  520. #define FAN_COUNT 1
  521. #else
  522. #define FAN_COUNT 0
  523. #endif
  524. #if HAS_FAN0
  525. #define WRITE_FAN(v) WRITE(FAN_PIN, v)
  526. #define WRITE_FAN0(v) WRITE_FAN(v)
  527. #endif
  528. #if HAS_FAN1
  529. #define WRITE_FAN1(v) WRITE(FAN1_PIN, v)
  530. #endif
  531. #if HAS_FAN2
  532. #define WRITE_FAN2(v) WRITE(FAN2_PIN, v)
  533. #endif
  534. #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
  535. /**
  536. * Servos and probes
  537. */
  538. #if HAS_SERVOS
  539. #ifndef Z_ENDSTOP_SERVO_NR
  540. #define Z_ENDSTOP_SERVO_NR -1
  541. #endif
  542. #endif
  543. #define PROBE_SELECTED (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))
  544. #define PROBE_PIN_CONFIGURED (HAS_Z_MIN_PROBE_PIN || (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)))
  545. #define HAS_BED_PROBE (PROBE_SELECTED && PROBE_PIN_CONFIGURED)
  546. #if ENABLED(Z_PROBE_ALLEN_KEY)
  547. #define PROBE_IS_TRIGGERED_WHEN_STOWED_TEST
  548. #endif
  549. /**
  550. * Bed Probe dependencies
  551. */
  552. #if HAS_BED_PROBE
  553. #ifndef Z_PROBE_OFFSET_RANGE_MIN
  554. #define Z_PROBE_OFFSET_RANGE_MIN -20
  555. #endif
  556. #ifndef Z_PROBE_OFFSET_RANGE_MAX
  557. #define Z_PROBE_OFFSET_RANGE_MAX 20
  558. #endif
  559. #ifndef XY_PROBE_SPEED
  560. #ifdef HOMING_FEEDRATE_XY
  561. #define XY_PROBE_SPEED HOMING_FEEDRATE_XY
  562. #else
  563. #define XY_PROBE_SPEED 4000
  564. #endif
  565. #endif
  566. #if Z_RAISE_BETWEEN_PROBINGS > Z_RAISE_PROBE_DEPLOY_STOW
  567. #define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_BETWEEN_PROBINGS
  568. #else
  569. #define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_PROBE_DEPLOY_STOW
  570. #endif
  571. #else
  572. #undef X_PROBE_OFFSET_FROM_EXTRUDER
  573. #undef Y_PROBE_OFFSET_FROM_EXTRUDER
  574. #undef Z_PROBE_OFFSET_FROM_EXTRUDER
  575. #define X_PROBE_OFFSET_FROM_EXTRUDER 0
  576. #define Y_PROBE_OFFSET_FROM_EXTRUDER 0
  577. #define Z_PROBE_OFFSET_FROM_EXTRUDER 0
  578. #endif
  579. /**
  580. * Delta radius/rod trimmers
  581. */
  582. #if ENABLED(DELTA)
  583. #ifndef DELTA_RADIUS_TRIM_TOWER_1
  584. #define DELTA_RADIUS_TRIM_TOWER_1 0.0
  585. #endif
  586. #ifndef DELTA_RADIUS_TRIM_TOWER_2
  587. #define DELTA_RADIUS_TRIM_TOWER_2 0.0
  588. #endif
  589. #ifndef DELTA_RADIUS_TRIM_TOWER_3
  590. #define DELTA_RADIUS_TRIM_TOWER_3 0.0
  591. #endif
  592. #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_1
  593. #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0
  594. #endif
  595. #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_2
  596. #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0
  597. #endif
  598. #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
  599. #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
  600. #endif
  601. #if ENABLED(AUTO_BED_LEVELING_GRID)
  602. #define DELTA_BED_LEVELING_GRID
  603. #endif
  604. #endif
  605. /**
  606. * When not using other bed leveling...
  607. */
  608. #if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(AUTO_BED_LEVELING_GRID) && DISABLED(DELTA_BED_LEVELING_GRID)
  609. #define AUTO_BED_LEVELING_3POINT
  610. #endif
  611. /**
  612. * Buzzer/Speaker
  613. */
  614. #if ENABLED(LCD_USE_I2C_BUZZER)
  615. #ifndef LCD_FEEDBACK_FREQUENCY_HZ
  616. #define LCD_FEEDBACK_FREQUENCY_HZ 1000
  617. #endif
  618. #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
  619. #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
  620. #endif
  621. #elif PIN_EXISTS(BEEPER)
  622. #ifndef LCD_FEEDBACK_FREQUENCY_HZ
  623. #define LCD_FEEDBACK_FREQUENCY_HZ 5000
  624. #endif
  625. #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
  626. #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
  627. #endif
  628. #else
  629. #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
  630. #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
  631. #endif
  632. #endif
  633. /**
  634. * MIN_Z_HEIGHT_FOR_HOMING / Z_RAISE_BETWEEN_PROBINGS
  635. */
  636. #ifndef MIN_Z_HEIGHT_FOR_HOMING
  637. #ifndef Z_RAISE_BETWEEN_PROBINGS
  638. #define MIN_Z_HEIGHT_FOR_HOMING 0
  639. #else
  640. #define MIN_Z_HEIGHT_FOR_HOMING Z_RAISE_BETWEEN_PROBINGS
  641. #endif
  642. #endif
  643. #ifndef Z_RAISE_BETWEEN_PROBINGS
  644. #define Z_RAISE_BETWEEN_PROBING MIN_Z_HEIGHT_FOR_HOMING
  645. #endif
  646. #endif // CONDITIONALS_POST_H