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_adv.h 32KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * Conditionals_adv.h
  25. * Conditionals set before pins.h and which depend on Configuration_adv.h.
  26. */
  27. #ifndef AXIS_RELATIVE_MODES
  28. #define AXIS_RELATIVE_MODES {}
  29. #endif
  30. #ifdef SWITCHING_NOZZLE_E1_SERVO_NR
  31. #define SWITCHING_NOZZLE_TWO_SERVOS 1
  32. #endif
  33. // Determine NUM_SERVOS if none was supplied
  34. #ifndef NUM_SERVOS
  35. #define NUM_SERVOS 0
  36. #if ANY(HAS_Z_SERVO_PROBE, CHAMBER_VENT, SWITCHING_TOOLHEAD, SWITCHING_EXTRUDER, SWITCHING_NOZZLE, SPINDLE_SERVO)
  37. #if NUM_SERVOS <= Z_PROBE_SERVO_NR
  38. #undef NUM_SERVOS
  39. #define NUM_SERVOS (Z_PROBE_SERVO_NR + 1)
  40. #endif
  41. #if NUM_SERVOS <= CHAMBER_VENT_SERVO_NR
  42. #undef NUM_SERVOS
  43. #define NUM_SERVOS (CHAMBER_VENT_SERVO_NR + 1)
  44. #endif
  45. #if NUM_SERVOS <= SWITCHING_TOOLHEAD_SERVO_NR
  46. #undef NUM_SERVOS
  47. #define NUM_SERVOS (SWITCHING_TOOLHEAD_SERVO_NR + 1)
  48. #endif
  49. #if NUM_SERVOS <= SWITCHING_NOZZLE_SERVO_NR
  50. #undef NUM_SERVOS
  51. #define NUM_SERVOS (SWITCHING_NOZZLE_SERVO_NR + 1)
  52. #endif
  53. #if NUM_SERVOS <= SWITCHING_NOZZLE_E1_SERVO_NR
  54. #undef NUM_SERVOS
  55. #define NUM_SERVOS (SWITCHING_NOZZLE_E1_SERVO_NR + 1)
  56. #endif
  57. #if NUM_SERVOS <= SWITCHING_EXTRUDER_SERVO_NR
  58. #undef NUM_SERVOS
  59. #define NUM_SERVOS (SWITCHING_EXTRUDER_SERVO_NR + 1)
  60. #endif
  61. #if NUM_SERVOS <= SWITCHING_EXTRUDER_E23_SERVO_NR
  62. #undef NUM_SERVOS
  63. #define NUM_SERVOS (SWITCHING_EXTRUDER_E23_SERVO_NR + 1)
  64. #endif
  65. #if NUM_SERVOS <= SPINDLE_SERVO_NR
  66. #undef NUM_SERVOS
  67. #define NUM_SERVOS (SPINDLE_SERVO_NR + 1)
  68. #endif
  69. #endif
  70. #endif
  71. // Convenience override for a BLTouch alone
  72. #if ENABLED(BLTOUCH) && NUM_SERVOS == 1
  73. #undef SERVO_DELAY
  74. #define SERVO_DELAY { 50 }
  75. #endif
  76. #if !HAS_STOWABLE_PROBE
  77. #undef PROBE_DEPLOY_STOW_MENU
  78. #endif
  79. #if !HAS_EXTRUDERS
  80. #define NO_VOLUMETRICS
  81. #undef TEMP_SENSOR_0
  82. #undef TEMP_SENSOR_1
  83. #undef TEMP_SENSOR_2
  84. #undef TEMP_SENSOR_3
  85. #undef TEMP_SENSOR_4
  86. #undef TEMP_SENSOR_5
  87. #undef TEMP_SENSOR_6
  88. #undef TEMP_SENSOR_7
  89. #undef FWRETRACT
  90. #undef PIDTEMP
  91. #undef AUTOTEMP
  92. #undef PID_EXTRUSION_SCALING
  93. #undef LIN_ADVANCE
  94. #undef FILAMENT_RUNOUT_SENSOR
  95. #undef ADVANCED_PAUSE_FEATURE
  96. #undef FILAMENT_RUNOUT_DISTANCE_MM
  97. #undef FILAMENT_LOAD_UNLOAD_GCODES
  98. #undef DISABLE_INACTIVE_EXTRUDER
  99. #undef FILAMENT_LOAD_UNLOAD_GCODES
  100. #undef EXTRUDER_RUNOUT_PREVENT
  101. #undef PREVENT_COLD_EXTRUSION
  102. #undef PREVENT_LENGTHY_EXTRUDE
  103. #undef THERMAL_PROTECTION_HOTENDS
  104. #undef THERMAL_PROTECTION_PERIOD
  105. #undef WATCH_TEMP_PERIOD
  106. #undef SHOW_TEMP_ADC_VALUES
  107. #undef LCD_SHOW_E_TOTAL
  108. #undef MANUAL_E_MOVES_RELATIVE
  109. #undef STEALTHCHOP_E
  110. #endif
  111. /**
  112. * Temperature Sensors; define what sensor(s) we have.
  113. */
  114. // Temperature sensor IDs
  115. #define HID_REDUNDANT -6
  116. #define HID_BOARD -5
  117. #define HID_COOLER -4
  118. #define HID_PROBE -3
  119. #define HID_CHAMBER -2
  120. #define HID_BED -1
  121. #define HID_E0 0
  122. #define HID_E1 1
  123. #define HID_E2 2
  124. #define HID_E3 3
  125. #define HID_E4 4
  126. #define HID_E5 5
  127. #define HID_E6 6
  128. #define HID_E7 7
  129. #define _SENSOR_IS(I,N) || (TEMP_SENSOR_##N == I)
  130. #define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I)
  131. #define ANY_THERMISTOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N) \
  132. _SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \
  133. _SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) )
  134. #if ANY_THERMISTOR_IS(1000)
  135. #define HAS_USER_THERMISTORS 1
  136. #endif
  137. #if TEMP_SENSOR_REDUNDANT
  138. #define _HEATER_ID(M) HID_##M
  139. #define HEATER_ID(M) _HEATER_ID(M)
  140. #define REDUNDANT_TEMP_MATCH(M,N) (HEATER_ID(TEMP_SENSOR_REDUNDANT_##M) == _HEATER_ID(N))
  141. #else
  142. #define REDUNDANT_TEMP_MATCH(...) 0
  143. #endif
  144. #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
  145. #define TEMP_SENSOR_0_IS_MAX_TC 1
  146. #if TEMP_SENSOR_0 == -5
  147. #define TEMP_SENSOR_0_IS_MAX31865 1
  148. #define TEMP_SENSOR_0_MAX_TC_TMIN 0
  149. #define TEMP_SENSOR_0_MAX_TC_TMAX 1024
  150. #ifndef MAX31865_SENSOR_WIRES_0
  151. #define MAX31865_SENSOR_WIRES_0 2
  152. #endif
  153. #ifndef MAX31865_WIRE_OHMS_0
  154. #define MAX31865_WIRE_OHMS_0 0.0f
  155. #endif
  156. #elif TEMP_SENSOR_0 == -3
  157. #define TEMP_SENSOR_0_IS_MAX31855 1
  158. #define TEMP_SENSOR_0_MAX_TC_TMIN -270
  159. #define TEMP_SENSOR_0_MAX_TC_TMAX 1800
  160. #elif TEMP_SENSOR_0 == -2
  161. #define TEMP_SENSOR_0_IS_MAX6675 1
  162. #define TEMP_SENSOR_0_MAX_TC_TMIN 0
  163. #define TEMP_SENSOR_0_MAX_TC_TMAX 1024
  164. #endif
  165. #elif TEMP_SENSOR_0 == -4
  166. #define TEMP_SENSOR_0_IS_AD8495 1
  167. #elif TEMP_SENSOR_0 == -1
  168. #define TEMP_SENSOR_0_IS_AD595 1
  169. #elif TEMP_SENSOR_0 > 0
  170. #define TEMP_SENSOR_0_IS_THERMISTOR 1
  171. #if TEMP_SENSOR_0 == 1000
  172. #define TEMP_SENSOR_0_IS_CUSTOM 1
  173. #elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
  174. #define TEMP_SENSOR_0_IS_DUMMY 1
  175. #endif
  176. #else
  177. #undef HEATER_0_MINTEMP
  178. #undef HEATER_0_MAXTEMP
  179. #endif
  180. #if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
  181. #define TEMP_SENSOR_1_IS_MAX_TC 1
  182. #if TEMP_SENSOR_1 == -5
  183. #define TEMP_SENSOR_1_IS_MAX31865 1
  184. #define TEMP_SENSOR_1_MAX_TC_TMIN 0
  185. #define TEMP_SENSOR_1_MAX_TC_TMAX 1024
  186. #ifndef MAX31865_SENSOR_WIRES_1
  187. #define MAX31865_SENSOR_WIRES_1 2
  188. #endif
  189. #ifndef MAX31865_WIRE_OHMS_1
  190. #define MAX31865_WIRE_OHMS_1 0.0f
  191. #endif
  192. #elif TEMP_SENSOR_1 == -3
  193. #define TEMP_SENSOR_1_IS_MAX31855 1
  194. #define TEMP_SENSOR_1_MAX_TC_TMIN -270
  195. #define TEMP_SENSOR_1_MAX_TC_TMAX 1800
  196. #elif TEMP_SENSOR_1 == -2
  197. #define TEMP_SENSOR_1_IS_MAX6675 1
  198. #define TEMP_SENSOR_1_MAX_TC_TMIN 0
  199. #define TEMP_SENSOR_1_MAX_TC_TMAX 1024
  200. #endif
  201. #if TEMP_SENSOR_1 != TEMP_SENSOR_0
  202. #if TEMP_SENSOR_1 == -5
  203. #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
  204. #elif TEMP_SENSOR_1 == -3
  205. #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
  206. #elif TEMP_SENSOR_1 == -2
  207. #error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
  208. #endif
  209. #endif
  210. #elif TEMP_SENSOR_1 == -4
  211. #define TEMP_SENSOR_1_IS_AD8495 1
  212. #elif TEMP_SENSOR_1 == -1
  213. #define TEMP_SENSOR_1_IS_AD595 1
  214. #elif TEMP_SENSOR_1 > 0
  215. #define TEMP_SENSOR_1_IS_THERMISTOR 1
  216. #if TEMP_SENSOR_1 == 1000
  217. #define TEMP_SENSOR_1_IS_CUSTOM 1
  218. #elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
  219. #define TEMP_SENSOR_1_IS_DUMMY 1
  220. #endif
  221. #else
  222. #undef HEATER_1_MINTEMP
  223. #undef HEATER_1_MAXTEMP
  224. #endif
  225. #if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
  226. #define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
  227. #if TEMP_SENSOR_REDUNDANT == -5
  228. #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
  229. #error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
  230. #endif
  231. #define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
  232. #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
  233. #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
  234. #elif TEMP_SENSOR_REDUNDANT == -3
  235. #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
  236. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
  237. #endif
  238. #define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
  239. #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
  240. #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
  241. #elif TEMP_SENSOR_REDUNDANT == -2
  242. #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
  243. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
  244. #endif
  245. #define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
  246. #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
  247. #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
  248. #endif
  249. // mimic setting up the source TEMP_SENSOR
  250. #if REDUNDANT_TEMP_MATCH(SOURCE, E0)
  251. #define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
  252. #define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
  253. #ifndef MAX31865_SENSOR_WIRES_0
  254. #define MAX31865_SENSOR_WIRES_0 2
  255. #endif
  256. #elif REDUNDANT_TEMP_MATCH(SOURCE, E1)
  257. #define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
  258. #define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
  259. #ifndef MAX31865_SENSOR_WIRES_1
  260. #define MAX31865_SENSOR_WIRES_1 2
  261. #endif
  262. #endif
  263. #if (TEMP_SENSOR_0_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_1_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
  264. #if TEMP_SENSOR_REDUNDANT == -5
  265. #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
  266. #elif TEMP_SENSOR_REDUNDANT == -3
  267. #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
  268. #elif TEMP_SENSOR_REDUNDANT == -2
  269. #error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
  270. #endif
  271. #endif
  272. #elif TEMP_SENSOR_REDUNDANT == -4
  273. #define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
  274. #elif TEMP_SENSOR_REDUNDANT == -1
  275. #define TEMP_SENSOR_REDUNDANT_IS_AD595 1
  276. #elif TEMP_SENSOR_REDUNDANT > 0
  277. #define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
  278. #if TEMP_SENSOR_REDUNDANT == 1000
  279. #define TEMP_SENSOR_REDUNDANT_IS_CUSTOM 1
  280. #elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999
  281. #error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT."
  282. #endif
  283. #endif
  284. #if TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC
  285. #define HAS_MAX_TC 1
  286. #endif
  287. #if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
  288. #define HAS_MAX6675 1
  289. #endif
  290. #if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
  291. #define HAS_MAX31855 1
  292. #endif
  293. #if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
  294. #define HAS_MAX31865 1
  295. #endif
  296. #if TEMP_SENSOR_2 == -4
  297. #define TEMP_SENSOR_2_IS_AD8495 1
  298. #elif TEMP_SENSOR_2 == -3
  299. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
  300. #elif TEMP_SENSOR_2 == -2
  301. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
  302. #elif TEMP_SENSOR_2 == -1
  303. #define TEMP_SENSOR_2_IS_AD595 1
  304. #elif TEMP_SENSOR_2 > 0
  305. #define TEMP_SENSOR_2_IS_THERMISTOR 1
  306. #if TEMP_SENSOR_2 == 1000
  307. #define TEMP_SENSOR_2_IS_CUSTOM 1
  308. #elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
  309. #define TEMP_SENSOR_2_IS_DUMMY 1
  310. #endif
  311. #else
  312. #undef HEATER_2_MINTEMP
  313. #undef HEATER_2_MAXTEMP
  314. #endif
  315. #if TEMP_SENSOR_3 == -4
  316. #define TEMP_SENSOR_3_IS_AD8495 1
  317. #elif TEMP_SENSOR_3 == -3
  318. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
  319. #elif TEMP_SENSOR_3 == -2
  320. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
  321. #elif TEMP_SENSOR_3 == -1
  322. #define TEMP_SENSOR_3_IS_AD595 1
  323. #elif TEMP_SENSOR_3 > 0
  324. #define TEMP_SENSOR_3_IS_THERMISTOR 1
  325. #if TEMP_SENSOR_3 == 1000
  326. #define TEMP_SENSOR_3_IS_CUSTOM 1
  327. #elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999
  328. #define TEMP_SENSOR_3_IS_DUMMY 1
  329. #endif
  330. #else
  331. #undef HEATER_3_MINTEMP
  332. #undef HEATER_3_MAXTEMP
  333. #endif
  334. #if TEMP_SENSOR_4 == -4
  335. #define TEMP_SENSOR_4_IS_AD8495 1
  336. #elif TEMP_SENSOR_4 == -3
  337. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
  338. #elif TEMP_SENSOR_4 == -2
  339. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
  340. #elif TEMP_SENSOR_4 == -1
  341. #define TEMP_SENSOR_4_IS_AD595 1
  342. #elif TEMP_SENSOR_4 > 0
  343. #define TEMP_SENSOR_4_IS_THERMISTOR 1
  344. #if TEMP_SENSOR_4 == 1000
  345. #define TEMP_SENSOR_4_IS_CUSTOM 1
  346. #elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999
  347. #define TEMP_SENSOR_4_IS_DUMMY 1
  348. #endif
  349. #else
  350. #undef HEATER_4_MINTEMP
  351. #undef HEATER_4_MAXTEMP
  352. #endif
  353. #if TEMP_SENSOR_5 == -4
  354. #define TEMP_SENSOR_5_IS_AD8495 1
  355. #elif TEMP_SENSOR_5 == -3
  356. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
  357. #elif TEMP_SENSOR_5 == -2
  358. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
  359. #elif TEMP_SENSOR_5 == -1
  360. #define TEMP_SENSOR_5_IS_AD595 1
  361. #elif TEMP_SENSOR_5 > 0
  362. #define TEMP_SENSOR_5_IS_THERMISTOR 1
  363. #if TEMP_SENSOR_5 == 1000
  364. #define TEMP_SENSOR_5_IS_CUSTOM 1
  365. #elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999
  366. #define TEMP_SENSOR_5_IS_DUMMY 1
  367. #endif
  368. #else
  369. #undef HEATER_5_MINTEMP
  370. #undef HEATER_5_MAXTEMP
  371. #endif
  372. #if TEMP_SENSOR_6 == -4
  373. #define TEMP_SENSOR_6_IS_AD8495 1
  374. #elif TEMP_SENSOR_6 == -3
  375. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
  376. #elif TEMP_SENSOR_6 == -2
  377. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
  378. #elif TEMP_SENSOR_6 == -1
  379. #define TEMP_SENSOR_6_IS_AD595 1
  380. #elif TEMP_SENSOR_6 > 0
  381. #define TEMP_SENSOR_6_IS_THERMISTOR 1
  382. #if TEMP_SENSOR_6 == 1000
  383. #define TEMP_SENSOR_6_IS_CUSTOM 1
  384. #elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999
  385. #define TEMP_SENSOR_6_IS_DUMMY 1
  386. #endif
  387. #else
  388. #undef HEATER_6_MINTEMP
  389. #undef HEATER_6_MAXTEMP
  390. #endif
  391. #if TEMP_SENSOR_7 == -4
  392. #define TEMP_SENSOR_7_IS_AD8495 1
  393. #elif TEMP_SENSOR_7 == -3
  394. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
  395. #elif TEMP_SENSOR_7 == -2
  396. #error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
  397. #elif TEMP_SENSOR_7 == -1
  398. #define TEMP_SENSOR_7_IS_AD595 1
  399. #elif TEMP_SENSOR_7 > 0
  400. #define TEMP_SENSOR_7_IS_THERMISTOR 1
  401. #if TEMP_SENSOR_7 == 1000
  402. #define TEMP_SENSOR_7_IS_CUSTOM 1
  403. #elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999
  404. #define TEMP_SENSOR_7_IS_DUMMY 1
  405. #endif
  406. #else
  407. #undef HEATER_7_MINTEMP
  408. #undef HEATER_7_MAXTEMP
  409. #endif
  410. #if TEMP_SENSOR_BED == -4
  411. #define TEMP_SENSOR_BED_IS_AD8495 1
  412. #elif TEMP_SENSOR_BED == -3
  413. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
  414. #elif TEMP_SENSOR_BED == -2
  415. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
  416. #elif TEMP_SENSOR_BED == -1
  417. #define TEMP_SENSOR_BED_IS_AD595 1
  418. #elif TEMP_SENSOR_BED > 0
  419. #define TEMP_SENSOR_BED_IS_THERMISTOR 1
  420. #if TEMP_SENSOR_BED == 1000
  421. #define TEMP_SENSOR_BED_IS_CUSTOM 1
  422. #elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999
  423. #define TEMP_SENSOR_BED_IS_DUMMY 1
  424. #endif
  425. #else
  426. #undef THERMAL_PROTECTION_BED
  427. #undef THERMAL_PROTECTION_BED_PERIOD
  428. #undef BED_MINTEMP
  429. #undef BED_MAXTEMP
  430. #endif
  431. #if TEMP_SENSOR_CHAMBER == -4
  432. #define TEMP_SENSOR_CHAMBER_IS_AD8495 1
  433. #elif TEMP_SENSOR_CHAMBER == -3
  434. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
  435. #elif TEMP_SENSOR_CHAMBER == -2
  436. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
  437. #elif TEMP_SENSOR_CHAMBER == -1
  438. #define TEMP_SENSOR_CHAMBER_IS_AD595 1
  439. #elif TEMP_SENSOR_CHAMBER > 0
  440. #define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
  441. #if TEMP_SENSOR_CHAMBER == 1000
  442. #define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
  443. #elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999
  444. #define TEMP_SENSOR_CHAMBER_IS_DUMMY 1
  445. #endif
  446. #else
  447. #undef THERMAL_PROTECTION_CHAMBER
  448. #undef CHAMBER_MINTEMP
  449. #undef CHAMBER_MAXTEMP
  450. #endif
  451. #if TEMP_SENSOR_COOLER == -4
  452. #define TEMP_SENSOR_COOLER_IS_AD8495 1
  453. #elif TEMP_SENSOR_COOLER == -3
  454. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
  455. #elif TEMP_SENSOR_COOLER == -2
  456. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
  457. #elif TEMP_SENSOR_COOLER == -1
  458. #define TEMP_SENSOR_COOLER_IS_AD595 1
  459. #elif TEMP_SENSOR_COOLER > 0
  460. #define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
  461. #if TEMP_SENSOR_COOLER == 1000
  462. #define TEMP_SENSOR_COOLER_IS_CUSTOM 1
  463. #elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
  464. #define TEMP_SENSOR_COOLER_IS_DUMMY 1
  465. #endif
  466. #else
  467. #undef THERMAL_PROTECTION_COOLER
  468. #undef COOLER_MINTEMP
  469. #undef COOLER_MAXTEMP
  470. #endif
  471. #if TEMP_SENSOR_PROBE == -4
  472. #define TEMP_SENSOR_PROBE_IS_AD8495 1
  473. #elif TEMP_SENSOR_PROBE == -3
  474. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
  475. #elif TEMP_SENSOR_PROBE == -2
  476. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
  477. #elif TEMP_SENSOR_PROBE == -1
  478. #define TEMP_SENSOR_PROBE_IS_AD595 1
  479. #elif TEMP_SENSOR_PROBE > 0
  480. #define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
  481. #if TEMP_SENSOR_PROBE == 1000
  482. #define TEMP_SENSOR_PROBE_IS_CUSTOM 1
  483. #elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999
  484. #define TEMP_SENSOR_PROBE_IS_DUMMY 1
  485. #endif
  486. #endif
  487. #if TEMP_SENSOR_BOARD == -4
  488. #define TEMP_SENSOR_BOARD_IS_AD8495 1
  489. #elif TEMP_SENSOR_BOARD == -3
  490. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BOARD."
  491. #elif TEMP_SENSOR_BOARD == -2
  492. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BOARD."
  493. #elif TEMP_SENSOR_BOARD == -1
  494. #define TEMP_SENSOR_BOARD_IS_AD595 1
  495. #elif TEMP_SENSOR_BOARD > 0
  496. #define TEMP_SENSOR_BOARD_IS_THERMISTOR 1
  497. #if TEMP_SENSOR_BOARD == 1000
  498. #define TEMP_SENSOR_BOARD_IS_CUSTOM 1
  499. #elif TEMP_SENSOR_BOARD == 998 || TEMP_SENSOR_BOARD == 999
  500. #define TEMP_SENSOR_BOARD_IS_DUMMY 1
  501. #endif
  502. #endif
  503. #if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || BOTH(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS))
  504. #define HAS_MIXER_SYNC_CHANNEL 1
  505. #endif
  506. #if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
  507. #define HAS_DUPLICATION_MODE 1
  508. #endif
  509. #if ENABLED(PRINTCOUNTER) && (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0)
  510. #define HAS_SERVICE_INTERVALS 1
  511. #endif
  512. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  513. #define HAS_FILAMENT_SENSOR 1
  514. #if NUM_RUNOUT_SENSORS > 1
  515. #define MULTI_FILAMENT_SENSOR 1
  516. #endif
  517. #ifdef FILAMENT_RUNOUT_DISTANCE_MM
  518. #define HAS_FILAMENT_RUNOUT_DISTANCE 1
  519. #endif
  520. #if ENABLED(MIXING_EXTRUDER)
  521. #define WATCH_ALL_RUNOUT_SENSORS
  522. #endif
  523. #endif
  524. // Probe Temperature Compensation
  525. #if !TEMP_SENSOR_PROBE
  526. #undef PTC_PROBE
  527. #endif
  528. #if !TEMP_SENSOR_BED
  529. #undef PTC_BED
  530. #endif
  531. #if !HAS_EXTRUDERS
  532. #undef PTC_HOTEND
  533. #endif
  534. #if ANY(PTC_PROBE, PTC_BED, PTC_HOTEND)
  535. #define HAS_PTC 1
  536. #endif
  537. // Let SD_FINISHED_RELEASECOMMAND stand in for SD_FINISHED_STEPPERRELEASE
  538. #if ENABLED(SD_FINISHED_STEPPERRELEASE)
  539. #ifndef SD_FINISHED_RELEASECOMMAND
  540. #define SD_FINISHED_RELEASECOMMAND "M84" // planner.finish_and_disable()
  541. #endif
  542. #else
  543. #undef SD_FINISHED_RELEASECOMMAND
  544. #endif
  545. #if ENABLED(NO_SD_AUTOSTART)
  546. #undef MENU_ADDAUTOSTART
  547. #endif
  548. #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
  549. #define HAS_PRINT_PROGRESS 1
  550. #endif
  551. #if STATUS_MESSAGE_TIMEOUT_SEC > 0
  552. #define HAS_STATUS_MESSAGE_TIMEOUT 1
  553. #endif
  554. #if ENABLED(SDSUPPORT) && SD_PROCEDURE_DEPTH
  555. #define HAS_MEDIA_SUBCALLS 1
  556. #endif
  557. #if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME)
  558. #define HAS_PRINT_PROGRESS_PERMYRIAD 1
  559. #endif
  560. #if ANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE)
  561. #define HAS_GAMES 1
  562. #if MANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE)
  563. #define HAS_GAME_MENU 1
  564. #endif
  565. #endif
  566. #if ANY(FWRETRACT, HAS_LEVELING, SKEW_CORRECTION)
  567. #define HAS_POSITION_MODIFIERS 1
  568. #endif
  569. #if ANY(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS, Z_MULTI_ENDSTOPS)
  570. #define HAS_EXTRA_ENDSTOPS 1
  571. #endif
  572. #if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
  573. #define HAS_SOFTWARE_ENDSTOPS 1
  574. #endif
  575. #if ANY(EXTENSIBLE_UI, IS_NEWPANEL, EMERGENCY_PARSER, HAS_ADC_BUTTONS, HAS_DWIN_E3V2)
  576. #define HAS_RESUME_CONTINUE 1
  577. #endif
  578. #if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
  579. #define HAS_COLOR_LEDS 1
  580. #else
  581. #undef LED_POWEROFF_TIMEOUT
  582. #endif
  583. #if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, SDSUPPORT)
  584. #define HAS_LEDS_OFF_FLAG 1
  585. #endif
  586. #ifdef DISPLAY_SLEEP_MINUTES
  587. #define HAS_DISPLAY_SLEEP 1
  588. #endif
  589. #if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT
  590. #define HAS_GCODE_M255 1
  591. #endif
  592. #if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
  593. #define HAS_MOTOR_CURRENT_I2C 1
  594. #endif
  595. #if ENABLED(Z_STEPPER_AUTO_ALIGN)
  596. #ifdef Z_STEPPER_ALIGN_STEPPER_XY
  597. #define HAS_Z_STEPPER_ALIGN_STEPPER_XY 1
  598. #undef Z_STEPPER_ALIGN_AMP
  599. #endif
  600. #ifndef Z_STEPPER_ALIGN_AMP
  601. #define Z_STEPPER_ALIGN_AMP 1.0
  602. #endif
  603. #endif
  604. // Multiple Z steppers
  605. #if NUM_Z_STEPPERS < 4
  606. #undef INVERT_Z4_VS_Z_DIR
  607. #if NUM_Z_STEPPERS < 3
  608. #undef INVERT_Z3_VS_Z_DIR
  609. #if NUM_Z_STEPPERS < 2
  610. #undef INVERT_Z2_VS_Z_DIR
  611. #endif
  612. #endif
  613. #endif
  614. #if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE)
  615. #define HAS_DUAL_X_STEPPERS 1
  616. #endif
  617. //
  618. // Spindle/Laser power display types
  619. // Defined here so sanity checks can use them
  620. //
  621. #if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
  622. #define HAS_CUTTER 1
  623. #define _CUTTER_POWER_PWM255 1
  624. #define _CUTTER_POWER_PERCENT 2
  625. #define _CUTTER_POWER_RPM 3
  626. #define _CUTTER_POWER(V) _CAT(_CUTTER_POWER_, V)
  627. #define CUTTER_UNIT_IS(V) (_CUTTER_POWER(CUTTER_POWER_UNIT) == _CUTTER_POWER(V))
  628. #endif
  629. #if !defined(__AVR__) || !defined(USBCON)
  630. // Define constants and variables for buffering serial data.
  631. // Use only 0 or powers of 2 greater than 1
  632. // : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
  633. #ifndef RX_BUFFER_SIZE
  634. #define RX_BUFFER_SIZE 128
  635. #endif
  636. // 256 is the max TX buffer limit due to uint8_t head and tail
  637. // : [0, 4, 8, 16, 32, 64, 128, 256]
  638. #ifndef TX_BUFFER_SIZE
  639. #define TX_BUFFER_SIZE 32
  640. #endif
  641. #else
  642. // SERIAL_XON_XOFF not supported on USB-native devices
  643. #undef SERIAL_XON_XOFF
  644. #endif
  645. #if ENABLED(HOST_PROMPT_SUPPORT) && DISABLED(EMERGENCY_PARSER)
  646. #define HAS_GCODE_M876 1
  647. #endif
  648. #if ENABLED(HOST_ACTION_COMMANDS)
  649. #ifndef ACTION_ON_PAUSE
  650. #define ACTION_ON_PAUSE "pause"
  651. #endif
  652. #ifndef ACTION_ON_PAUSED
  653. #define ACTION_ON_PAUSED "paused"
  654. #endif
  655. #ifndef ACTION_ON_RESUME
  656. #define ACTION_ON_RESUME "resume"
  657. #endif
  658. #ifndef ACTION_ON_RESUMED
  659. #define ACTION_ON_RESUMED "resumed"
  660. #endif
  661. #ifndef ACTION_ON_CANCEL
  662. #define ACTION_ON_CANCEL "cancel"
  663. #endif
  664. #ifndef ACTION_ON_START
  665. #define ACTION_ON_START "start"
  666. #endif
  667. #ifndef ACTION_ON_KILL
  668. #define ACTION_ON_KILL "poweroff"
  669. #endif
  670. #ifndef SHUTDOWN_ACTION
  671. #define SHUTDOWN_ACTION "shutdown"
  672. #endif
  673. #if HAS_FILAMENT_SENSOR
  674. #ifndef ACTION_ON_FILAMENT_RUNOUT
  675. #define ACTION_ON_FILAMENT_RUNOUT "filament_runout"
  676. #endif
  677. #ifndef ACTION_REASON_ON_FILAMENT_RUNOUT
  678. #define ACTION_REASON_ON_FILAMENT_RUNOUT "filament_runout"
  679. #endif
  680. #endif
  681. #if ENABLED(G29_RETRY_AND_RECOVER)
  682. #ifndef ACTION_ON_G29_RECOVER
  683. #define ACTION_ON_G29_RECOVER "probe_rewipe"
  684. #endif
  685. #ifndef ACTION_ON_G29_FAILURE
  686. #define ACTION_ON_G29_FAILURE "probe_failed"
  687. #endif
  688. #endif
  689. #endif
  690. #if EITHER(FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864)
  691. #ifndef LED_USER_PRESET_GREEN
  692. #define LED_USER_PRESET_GREEN 128
  693. #endif
  694. #ifndef LED_USER_PRESET_BLUE
  695. #define LED_USER_PRESET_BLUE 0
  696. #endif
  697. #ifndef LED_USER_PRESET_BRIGHTNESS
  698. #define LED_USER_PRESET_BRIGHTNESS 255
  699. #endif
  700. #endif
  701. // Set defaults for unspecified LED user colors
  702. #if ENABLED(LED_CONTROL_MENU)
  703. #ifndef LED_USER_PRESET_RED
  704. #define LED_USER_PRESET_RED 255
  705. #endif
  706. #ifndef LED_USER_PRESET_GREEN
  707. #define LED_USER_PRESET_GREEN 255
  708. #endif
  709. #ifndef LED_USER_PRESET_BLUE
  710. #define LED_USER_PRESET_BLUE 255
  711. #endif
  712. #ifndef LED_USER_PRESET_WHITE
  713. #define LED_USER_PRESET_WHITE 0
  714. #endif
  715. #ifndef LED_USER_PRESET_BRIGHTNESS
  716. #ifdef NEOPIXEL_BRIGHTNESS
  717. #define LED_USER_PRESET_BRIGHTNESS NEOPIXEL_BRIGHTNESS
  718. #else
  719. #define LED_USER_PRESET_BRIGHTNESS 255
  720. #endif
  721. #endif
  722. #endif
  723. #if BOTH(LED_CONTROL_MENU, NEOPIXEL2_SEPARATE)
  724. #ifndef LED2_USER_PRESET_RED
  725. #define LED2_USER_PRESET_RED 255
  726. #endif
  727. #ifndef LED2_USER_PRESET_GREEN
  728. #define LED2_USER_PRESET_GREEN 255
  729. #endif
  730. #ifndef LED2_USER_PRESET_BLUE
  731. #define LED2_USER_PRESET_BLUE 255
  732. #endif
  733. #ifndef LED2_USER_PRESET_WHITE
  734. #define LED2_USER_PRESET_WHITE 0
  735. #endif
  736. #ifndef LED2_USER_PRESET_BRIGHTNESS
  737. #ifdef NEOPIXEL2_BRIGHTNESS
  738. #define LED2_USER_PRESET_BRIGHTNESS NEOPIXEL2_BRIGHTNESS
  739. #else
  740. #define LED2_USER_PRESET_BRIGHTNESS 255
  741. #endif
  742. #endif
  743. #endif
  744. // Full Touch Screen needs 'tft/xpt2046'
  745. #if EITHER(TFT_TOUCH_DEVICE_XPT2046, HAS_TFT_LVGL_UI)
  746. #define HAS_TFT_XPT2046 1
  747. #endif
  748. // Touch Screen or "Touch Buttons" need XPT2046 pins
  749. // but they use different components
  750. #if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
  751. #define NEED_TOUCH_PINS 1
  752. #endif
  753. // Extensible UI pin mapping for RepRapDiscount
  754. #if ENABLED(TOUCH_UI_FTDI_EVE) && ANY(AO_EXP1_PINMAP, AO_EXP2_PINMAP, CR10_TFT_PINMAP)
  755. #define TOUCH_UI_ULTIPANEL 1
  756. #endif
  757. // Poll-based jogging for joystick and other devices
  758. #if ENABLED(JOYSTICK)
  759. #define POLL_JOG
  760. #endif
  761. #if X2_HOME_DIR > 0
  762. #define X2_HOME_TO_MAX 1
  763. #elif X2_HOME_DIR < 0
  764. #define X2_HOME_TO_MIN 1
  765. #endif
  766. #ifndef HOMING_BUMP_MM
  767. #define HOMING_BUMP_MM { 0, 0, 0 }
  768. #endif
  769. #if ENABLED(USB_FLASH_DRIVE_SUPPORT) && NONE(USE_OTG_USB_HOST, USE_UHS3_USB)
  770. #define USE_UHS2_USB
  771. #endif
  772. /**
  773. * Driver Timings (in nanoseconds)
  774. * NOTE: Driver timing order is longest-to-shortest duration.
  775. * Preserve this ordering when adding new drivers.
  776. */
  777. #ifndef MINIMUM_STEPPER_POST_DIR_DELAY
  778. #if HAS_DRIVER(TB6560)
  779. #define MINIMUM_STEPPER_POST_DIR_DELAY 15000
  780. #elif HAS_DRIVER(TB6600)
  781. #define MINIMUM_STEPPER_POST_DIR_DELAY 1500
  782. #elif HAS_DRIVER(DRV8825)
  783. #define MINIMUM_STEPPER_POST_DIR_DELAY 650
  784. #elif HAS_DRIVER(LV8729)
  785. #define MINIMUM_STEPPER_POST_DIR_DELAY 500
  786. #elif HAS_DRIVER(A5984)
  787. #define MINIMUM_STEPPER_POST_DIR_DELAY 400
  788. #elif HAS_DRIVER(A4988)
  789. #define MINIMUM_STEPPER_POST_DIR_DELAY 200
  790. #elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
  791. #define MINIMUM_STEPPER_POST_DIR_DELAY 60
  792. #else
  793. #define MINIMUM_STEPPER_POST_DIR_DELAY 0 // Expect at least 10µS since one Stepper ISR must transpire
  794. #endif
  795. #endif
  796. #ifndef MINIMUM_STEPPER_PRE_DIR_DELAY
  797. #define MINIMUM_STEPPER_PRE_DIR_DELAY MINIMUM_STEPPER_POST_DIR_DELAY
  798. #endif
  799. #ifndef MINIMUM_STEPPER_PULSE
  800. #if HAS_DRIVER(TB6560)
  801. #define MINIMUM_STEPPER_PULSE 30
  802. #elif HAS_DRIVER(TB6600)
  803. #define MINIMUM_STEPPER_PULSE 3
  804. #elif HAS_DRIVER(DRV8825)
  805. #define MINIMUM_STEPPER_PULSE 2
  806. #elif HAS_DRIVER(A4988) || HAS_DRIVER(A5984)
  807. #define MINIMUM_STEPPER_PULSE 1
  808. #elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
  809. #define MINIMUM_STEPPER_PULSE 0
  810. #elif HAS_DRIVER(LV8729)
  811. #define MINIMUM_STEPPER_PULSE 0
  812. #else
  813. #define MINIMUM_STEPPER_PULSE 2
  814. #endif
  815. #endif
  816. #ifndef MAXIMUM_STEPPER_RATE
  817. #if HAS_DRIVER(TB6560)
  818. #define MAXIMUM_STEPPER_RATE 15000
  819. #elif HAS_DRIVER(TB6600)
  820. #define MAXIMUM_STEPPER_RATE 150000
  821. #elif HAS_DRIVER(DRV8825)
  822. #define MAXIMUM_STEPPER_RATE 250000
  823. #elif HAS_DRIVER(A4988)
  824. #define MAXIMUM_STEPPER_RATE 500000
  825. #elif HAS_DRIVER(LV8729)
  826. #define MAXIMUM_STEPPER_RATE 1000000
  827. #elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
  828. #define MAXIMUM_STEPPER_RATE 5000000
  829. #else
  830. #define MAXIMUM_STEPPER_RATE 250000
  831. #endif
  832. #endif
  833. #if ENABLED(DIRECT_STEPPING)
  834. #ifndef STEPPER_PAGES
  835. #define STEPPER_PAGES 16
  836. #endif
  837. #ifndef STEPPER_PAGE_FORMAT
  838. #define STEPPER_PAGE_FORMAT SP_4x2_256
  839. #endif
  840. #ifndef PAGE_MANAGER
  841. #define PAGE_MANAGER SerialPageManager
  842. #endif
  843. #endif
  844. // Remove unused STEALTHCHOP flags
  845. #if NUM_AXES < 9
  846. #undef STEALTHCHOP_W
  847. #undef CALIBRATION_MEASURE_WMIN
  848. #undef CALIBRATION_MEASURE_WMAX
  849. #if NUM_AXES < 8
  850. #undef STEALTHCHOP_V
  851. #undef CALIBRATION_MEASURE_VMIN
  852. #undef CALIBRATION_MEASURE_VMAX
  853. #if NUM_AXES < 7
  854. #undef STEALTHCHOP_U
  855. #undef CALIBRATION_MEASURE_UMIN
  856. #undef CALIBRATION_MEASURE_UMAX
  857. #if NUM_AXES < 6
  858. #undef STEALTHCHOP_K
  859. #undef CALIBRATION_MEASURE_KMIN
  860. #undef CALIBRATION_MEASURE_KMAX
  861. #if NUM_AXES < 5
  862. #undef STEALTHCHOP_J
  863. #undef CALIBRATION_MEASURE_JMIN
  864. #undef CALIBRATION_MEASURE_JMAX
  865. #if NUM_AXES < 4
  866. #undef STEALTHCHOP_I
  867. #undef CALIBRATION_MEASURE_IMIN
  868. #undef CALIBRATION_MEASURE_IMAX
  869. #if NUM_AXES < 3
  870. #undef Z_IDLE_HEIGHT
  871. #undef STEALTHCHOP_Z
  872. #undef Z_PROBE_SLED
  873. #undef Z_SAFE_HOMING
  874. #undef HOME_Z_FIRST
  875. #undef HOMING_Z_WITH_PROBE
  876. #undef ENABLE_LEVELING_FADE_HEIGHT
  877. #undef NUM_Z_STEPPERS
  878. #undef CNC_WORKSPACE_PLANES
  879. #if NUM_AXES < 2
  880. #undef STEALTHCHOP_Y
  881. #endif
  882. #endif
  883. #endif
  884. #endif
  885. #endif
  886. #endif
  887. #endif
  888. #endif
  889. //
  890. // SD Card connection methods
  891. // Defined here so pins and sanity checks can use them
  892. //
  893. #if ENABLED(SDSUPPORT)
  894. #define _SDCARD_LCD 1
  895. #define _SDCARD_ONBOARD 2
  896. #define _SDCARD_CUSTOM_CABLE 3
  897. #define _SDCARD_ID(V) _CAT(_SDCARD_, V)
  898. #define SD_CONNECTION_IS(V) (_SDCARD_ID(SDCARD_CONNECTION) == _SDCARD_ID(V))
  899. #else
  900. #define SD_CONNECTION_IS(...) 0
  901. #endif
  902. // Power Monitor sensors
  903. #if EITHER(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE)
  904. #define HAS_POWER_MONITOR 1
  905. #if ENABLED(POWER_MONITOR_CURRENT) && (ENABLED(POWER_MONITOR_VOLTAGE) || defined(POWER_MONITOR_FIXED_VOLTAGE))
  906. #define HAS_POWER_MONITOR_WATTS 1
  907. #endif
  908. #endif
  909. // Flag if an EEPROM type is pre-selected
  910. #if ENABLED(EEPROM_SETTINGS) && NONE(I2C_EEPROM, SPI_EEPROM, QSPI_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION)
  911. #define NO_EEPROM_SELECTED 1
  912. #endif
  913. // Flag whether hex_print.cpp is used
  914. #if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE, DEBUG_CARDREADER)
  915. #define NEED_HEX_PRINT 1
  916. #endif
  917. // Flags for Case Light having a color property or a single pin
  918. #if ENABLED(CASE_LIGHT_ENABLE)
  919. #if EITHER(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_USE_RGB_LED)
  920. #define CASE_LIGHT_IS_COLOR_LED 1
  921. #else
  922. #define NEED_CASE_LIGHT_PIN 1
  923. #endif
  924. #endif
  925. // Flags for Case Light having a brightness property
  926. #if ENABLED(CASE_LIGHT_ENABLE) && (NONE(CASE_LIGHT_NO_BRIGHTNESS, CASE_LIGHT_IS_COLOR_LED) || ENABLED(CASE_LIGHT_USE_NEOPIXEL))
  927. #define CASELIGHT_USES_BRIGHTNESS 1
  928. #endif
  929. // Flag whether least_squares_fit.cpp is used
  930. #if ANY(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_LINEAR, HAS_Z_STEPPER_ALIGN_STEPPER_XY)
  931. #define NEED_LSF 1
  932. #endif
  933. #if BOTH(HAS_TFT_LVGL_UI, CUSTOM_MENU_MAIN)
  934. #define _HAS_1(N) (defined(MAIN_MENU_ITEM_##N##_DESC) && defined(MAIN_MENU_ITEM_##N##_GCODE))
  935. #define HAS_USER_ITEM(V...) DO(HAS,||,V)
  936. #else
  937. #define HAS_USER_ITEM(N) 0
  938. #endif
  939. /**
  940. * LCD_SERIAL_PORT must be defined ahead of HAL.h
  941. */
  942. #ifndef LCD_SERIAL_PORT
  943. #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI || HAS_DGUS_LCD
  944. #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO)
  945. #define LCD_SERIAL_PORT 1
  946. #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_V423, MKS_ROBIN)
  947. #define LCD_SERIAL_PORT 2 // Creality Ender3S1, MKS Robin
  948. #else
  949. #define LCD_SERIAL_PORT 3 // Other boards
  950. #endif
  951. #endif
  952. #ifdef LCD_SERIAL_PORT
  953. #define AUTO_ASSIGNED_LCD_SERIAL 1
  954. #endif
  955. #endif
  956. #if !HAS_MULTI_SERIAL
  957. #undef MEATPACK_ON_SERIAL_PORT_2
  958. #endif
  959. #if EITHER(MEATPACK_ON_SERIAL_PORT_1, MEATPACK_ON_SERIAL_PORT_2)
  960. #define HAS_MEATPACK 1
  961. #endif
  962. // AVR are (usually) too limited in resources to store the configuration into the binary
  963. #if ENABLED(CONFIGURATION_EMBEDDING) && !defined(FORCE_CONFIG_EMBED) && (defined(__AVR__) || DISABLED(SDSUPPORT) || EITHER(SDCARD_READONLY, DISABLE_M503))
  964. #undef CONFIGURATION_EMBEDDING
  965. #define CANNOT_EMBED_CONFIGURATION defined(__AVR__)
  966. #endif
  967. #if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E)
  968. #define HAS_DISABLE_INACTIVE_AXIS 1
  969. #endif