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

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