My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Conditionals_post.h 68KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090
  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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * Conditionals_post.h
  25. * Defines that depend on configuration but are not editable.
  26. */
  27. #ifdef GITHUB_ACTIONS
  28. // Extras for CI testing
  29. #endif
  30. #ifdef TEENSYDUINO
  31. #undef max
  32. #define max(a,b) ((a)>(b)?(a):(b))
  33. #undef min
  34. #define min(a,b) ((a)<(b)?(a):(b))
  35. #undef NOT_A_PIN // Override Teensyduino legacy CapSense define work-around
  36. #define NOT_A_PIN 0 // For PINS_DEBUGGING
  37. #endif
  38. /**
  39. * Axis lengths and center
  40. */
  41. #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
  42. #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
  43. #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
  44. // Defined only if the sanity-check is bypassed
  45. #ifndef X_BED_SIZE
  46. #define X_BED_SIZE X_MAX_LENGTH
  47. #endif
  48. #ifndef Y_BED_SIZE
  49. #define Y_BED_SIZE Y_MAX_LENGTH
  50. #endif
  51. // Require 0,0 bed center for Delta and SCARA
  52. #if IS_KINEMATIC
  53. #define BED_CENTER_AT_0_0
  54. #endif
  55. // Define center values for future use
  56. #define _X_HALF_BED ((X_BED_SIZE) / 2)
  57. #define _Y_HALF_BED ((Y_BED_SIZE) / 2)
  58. #if ENABLED(BED_CENTER_AT_0_0)
  59. #define X_CENTER 0
  60. #define Y_CENTER 0
  61. #else
  62. #define X_CENTER _X_HALF_BED
  63. #define Y_CENTER _Y_HALF_BED
  64. #endif
  65. // Get the linear boundaries of the bed
  66. #define X_MIN_BED (X_CENTER - _X_HALF_BED)
  67. #define X_MAX_BED (X_MIN_BED + X_BED_SIZE)
  68. #define Y_MIN_BED (Y_CENTER - _Y_HALF_BED)
  69. #define Y_MAX_BED (Y_MIN_BED + Y_BED_SIZE)
  70. /**
  71. * Dual X Carriage
  72. */
  73. #if ENABLED(DUAL_X_CARRIAGE)
  74. #ifndef X1_MIN_POS
  75. #define X1_MIN_POS X_MIN_POS
  76. #endif
  77. #ifndef X1_MAX_POS
  78. #define X1_MAX_POS X_BED_SIZE
  79. #endif
  80. #endif
  81. /**
  82. * CoreXY, CoreXZ, and CoreYZ - and their reverse
  83. */
  84. #define CORE_IS_XY EITHER(COREXY, COREYX)
  85. #define CORE_IS_XZ EITHER(COREXZ, COREZX)
  86. #define CORE_IS_YZ EITHER(COREYZ, COREZY)
  87. #define IS_CORE (CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ)
  88. #if IS_CORE
  89. #if CORE_IS_XY
  90. #define CORE_AXIS_1 A_AXIS
  91. #define CORE_AXIS_2 B_AXIS
  92. #define NORMAL_AXIS Z_AXIS
  93. #elif CORE_IS_XZ
  94. #define CORE_AXIS_1 A_AXIS
  95. #define NORMAL_AXIS Y_AXIS
  96. #define CORE_AXIS_2 C_AXIS
  97. #elif CORE_IS_YZ
  98. #define NORMAL_AXIS X_AXIS
  99. #define CORE_AXIS_1 B_AXIS
  100. #define CORE_AXIS_2 C_AXIS
  101. #endif
  102. #if ANY(COREYX, COREZX, COREZY)
  103. #define CORESIGN(n) (-(n))
  104. #else
  105. #define CORESIGN(n) (n)
  106. #endif
  107. #endif
  108. /**
  109. * No adjustable bed on non-cartesians
  110. */
  111. #if IS_KINEMATIC
  112. #undef LEVEL_BED_CORNERS
  113. #endif
  114. /**
  115. * SCARA cannot use SLOWDOWN and requires QUICKHOME
  116. * Printable radius assumes joints can fully extend
  117. */
  118. #if IS_SCARA
  119. #undef SLOWDOWN
  120. #define QUICK_HOME
  121. #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
  122. #endif
  123. /**
  124. * Set the home position based on settings or manual overrides
  125. */
  126. #ifdef MANUAL_X_HOME_POS
  127. #define X_HOME_POS MANUAL_X_HOME_POS
  128. #elif ENABLED(BED_CENTER_AT_0_0)
  129. #if ENABLED(DELTA)
  130. #define X_HOME_POS 0
  131. #else
  132. #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
  133. #endif
  134. #else
  135. #if ENABLED(DELTA)
  136. #define X_HOME_POS (X_MIN_POS + (X_BED_SIZE) * 0.5)
  137. #else
  138. #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
  139. #endif
  140. #endif
  141. #ifdef MANUAL_Y_HOME_POS
  142. #define Y_HOME_POS MANUAL_Y_HOME_POS
  143. #elif ENABLED(BED_CENTER_AT_0_0)
  144. #if ENABLED(DELTA)
  145. #define Y_HOME_POS 0
  146. #else
  147. #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
  148. #endif
  149. #else
  150. #if ENABLED(DELTA)
  151. #define Y_HOME_POS (Y_MIN_POS + (Y_BED_SIZE) * 0.5)
  152. #else
  153. #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
  154. #endif
  155. #endif
  156. #ifdef MANUAL_Z_HOME_POS
  157. #define Z_HOME_POS MANUAL_Z_HOME_POS
  158. #else
  159. #define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
  160. #endif
  161. /**
  162. * If DELTA_HEIGHT isn't defined use the old setting
  163. */
  164. #if ENABLED(DELTA) && !defined(DELTA_HEIGHT)
  165. #define DELTA_HEIGHT Z_HOME_POS
  166. #endif
  167. /**
  168. * Z Sled Probe requires Z_SAFE_HOMING
  169. */
  170. #if ENABLED(Z_PROBE_SLED)
  171. #define Z_SAFE_HOMING
  172. #endif
  173. /**
  174. * DELTA should ignore Z_SAFE_HOMING and SLOWDOWN
  175. */
  176. #if ENABLED(DELTA)
  177. #undef Z_SAFE_HOMING
  178. #undef SLOWDOWN
  179. #endif
  180. #ifndef MESH_INSET
  181. #define MESH_INSET 0
  182. #endif
  183. /**
  184. * Safe Homing Options
  185. */
  186. #if ENABLED(Z_SAFE_HOMING)
  187. #if ENABLED(AUTO_BED_LEVELING_UBL)
  188. // Home close to center so grid points have z heights very close to 0
  189. #define _SAFE_POINT(A) (((GRID_MAX_POINTS_##A) / 2) * (A##_BED_SIZE - 2 * (MESH_INSET)) / (GRID_MAX_POINTS_##A - 1) + MESH_INSET)
  190. #else
  191. #define _SAFE_POINT(A) A##_CENTER
  192. #endif
  193. #ifndef Z_SAFE_HOMING_X_POINT
  194. #define Z_SAFE_HOMING_X_POINT _SAFE_POINT(X)
  195. #endif
  196. #ifndef Z_SAFE_HOMING_Y_POINT
  197. #define Z_SAFE_HOMING_Y_POINT _SAFE_POINT(Y)
  198. #endif
  199. #endif
  200. /**
  201. * Host keep alive
  202. */
  203. #ifndef DEFAULT_KEEPALIVE_INTERVAL
  204. #define DEFAULT_KEEPALIVE_INTERVAL 2
  205. #endif
  206. /**
  207. * Provide a MAX_AUTORETRACT for older configs
  208. */
  209. #if ENABLED(FWRETRACT) && !defined(MAX_AUTORETRACT)
  210. #define MAX_AUTORETRACT 99
  211. #endif
  212. /**
  213. * LCD Contrast for Graphical Displays
  214. */
  215. #if ENABLED(CARTESIO_UI)
  216. #define _LCD_CONTRAST_MIN 60
  217. #define _LCD_CONTRAST_INIT 90
  218. #define _LCD_CONTRAST_MAX 140
  219. #elif ENABLED(miniVIKI)
  220. #define _LCD_CONTRAST_MIN 75
  221. #define _LCD_CONTRAST_INIT 95
  222. #define _LCD_CONTRAST_MAX 115
  223. #elif ENABLED(VIKI2)
  224. #define _LCD_CONTRAST_INIT 140
  225. #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
  226. #define _LCD_CONTRAST_MIN 90
  227. #define _LCD_CONTRAST_INIT 110
  228. #define _LCD_CONTRAST_MAX 130
  229. #elif ENABLED(AZSMZ_12864)
  230. #define _LCD_CONTRAST_MIN 120
  231. #define _LCD_CONTRAST_INIT 190
  232. #elif ENABLED(MKS_LCD12864B)
  233. #define _LCD_CONTRAST_MIN 120
  234. #define _LCD_CONTRAST_INIT 205
  235. #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
  236. #define _LCD_CONTRAST_MIN 120
  237. #define _LCD_CONTRAST_INIT 195
  238. #elif ENABLED(FYSETC_MINI_12864)
  239. #define _LCD_CONTRAST_INIT 220
  240. #elif ENABLED(ULTI_CONTROLLER)
  241. #define _LCD_CONTRAST_INIT 127
  242. #define _LCD_CONTRAST_MAX 254
  243. #elif EITHER(MAKRPANEL, MINIPANEL)
  244. #define _LCD_CONTRAST_INIT 17
  245. #endif
  246. #define HAS_LCD_CONTRAST defined(_LCD_CONTRAST_INIT)
  247. #if HAS_LCD_CONTRAST
  248. #ifndef LCD_CONTRAST_MIN
  249. #ifdef _LCD_CONTRAST_MIN
  250. #define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
  251. #else
  252. #define LCD_CONTRAST_MIN 0
  253. #endif
  254. #endif
  255. #ifndef LCD_CONTRAST_INIT
  256. #define LCD_CONTRAST_INIT _LCD_CONTRAST_INIT
  257. #endif
  258. #ifndef LCD_CONTRAST_MAX
  259. #ifdef _LCD_CONTRAST_MAX
  260. #define LCD_CONTRAST_MAX _LCD_CONTRAST_MAX
  261. #elif _LCD_CONTRAST_INIT > 63
  262. #define LCD_CONTRAST_MAX 255
  263. #else
  264. #define LCD_CONTRAST_MAX 63 // ST7567 6-bits contrast
  265. #endif
  266. #endif
  267. #ifndef DEFAULT_LCD_CONTRAST
  268. #define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
  269. #endif
  270. #endif
  271. /**
  272. * Override here because this is set in Configuration_adv.h
  273. */
  274. #if HAS_LCD_MENU && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) && !(defined(ARDUINO_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(ONBOARD))
  275. #undef SD_DETECT_INVERTED
  276. #endif
  277. /**
  278. * Set defaults for missing (newer) options
  279. */
  280. #ifndef DISABLE_INACTIVE_X
  281. #define DISABLE_INACTIVE_X DISABLE_X
  282. #endif
  283. #ifndef DISABLE_INACTIVE_Y
  284. #define DISABLE_INACTIVE_Y DISABLE_Y
  285. #endif
  286. #ifndef DISABLE_INACTIVE_Z
  287. #define DISABLE_INACTIVE_Z DISABLE_Z
  288. #endif
  289. #ifndef DISABLE_INACTIVE_E
  290. #define DISABLE_INACTIVE_E DISABLE_E
  291. #endif
  292. /**
  293. * Power Supply
  294. */
  295. #ifndef PSU_NAME
  296. #if DISABLED(PSU_CONTROL)
  297. #define PSU_NAME "Generic" // No control
  298. #elif PSU_ACTIVE_HIGH
  299. #define PSU_NAME "XBox" // X-Box 360 (203W)
  300. #else
  301. #define PSU_NAME "ATX" // ATX style
  302. #endif
  303. #endif
  304. #if !defined(PSU_POWERUP_DELAY) && ENABLED(PSU_CONTROL)
  305. #define PSU_POWERUP_DELAY 100
  306. #endif
  307. /**
  308. * Temp Sensor defines
  309. */
  310. #define ANY_TEMP_SENSOR_IS(n) (TEMP_SENSOR_0 == (n) || TEMP_SENSOR_1 == (n) || TEMP_SENSOR_2 == (n) || TEMP_SENSOR_3 == (n) || TEMP_SENSOR_4 == (n) || TEMP_SENSOR_5 == (n) || TEMP_SENSOR_6 == (n) || TEMP_SENSOR_7 == (n) || TEMP_SENSOR_BED == (n) || TEMP_SENSOR_PROBE == (n) || TEMP_SENSOR_CHAMBER == (n))
  311. #define HAS_USER_THERMISTORS ANY_TEMP_SENSOR_IS(1000)
  312. #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
  313. #define HEATER_0_USES_MAX6675
  314. #if TEMP_SENSOR_0 == -3
  315. #define HEATER_0_MAX6675_TMIN -270
  316. #define HEATER_0_MAX6675_TMAX 1800
  317. #else
  318. #define HEATER_0_MAX6675_TMIN 0
  319. #define HEATER_0_MAX6675_TMAX 1024
  320. #endif
  321. #if TEMP_SENSOR_0 == -5
  322. #define MAX6675_IS_MAX31865
  323. #elif TEMP_SENSOR_0 == -3
  324. #define MAX6675_IS_MAX31855
  325. #endif
  326. #elif TEMP_SENSOR_0 == -4
  327. #define HEATER_0_USES_AD8495
  328. #elif TEMP_SENSOR_0 == -1
  329. #define HEATER_0_USES_AD595
  330. #elif TEMP_SENSOR_0 > 0
  331. #define THERMISTOR_HEATER_0 TEMP_SENSOR_0
  332. #define HEATER_0_USES_THERMISTOR
  333. #if TEMP_SENSOR_0 == 1000
  334. #define HEATER_0_USER_THERMISTOR
  335. #endif
  336. #else
  337. #undef HEATER_0_MINTEMP
  338. #undef HEATER_0_MAXTEMP
  339. #endif
  340. #if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
  341. #define HEATER_1_USES_MAX6675
  342. #if TEMP_SENSOR_1 == -3
  343. #define HEATER_1_MAX6675_TMIN -270
  344. #define HEATER_1_MAX6675_TMAX 1800
  345. #else
  346. #define HEATER_1_MAX6675_TMIN 0
  347. #define HEATER_1_MAX6675_TMAX 1024
  348. #endif
  349. #if TEMP_SENSOR_1 != TEMP_SENSOR_0
  350. #if TEMP_SENSOR_1 == -5
  351. #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
  352. #elif TEMP_SENSOR_1 == -3
  353. #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
  354. #elif TEMP_SENSOR_1 == -2
  355. #error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
  356. #endif
  357. #endif
  358. #elif TEMP_SENSOR_1 == -4
  359. #define HEATER_1_USES_AD8495
  360. #elif TEMP_SENSOR_1 == -1
  361. #define HEATER_1_USES_AD595
  362. #elif TEMP_SENSOR_1 > 0
  363. #define THERMISTOR_HEATER_1 TEMP_SENSOR_1
  364. #define HEATER_1_USES_THERMISTOR
  365. #if TEMP_SENSOR_1 == 1000
  366. #define HEATER_1_USER_THERMISTOR
  367. #endif
  368. #else
  369. #undef HEATER_1_MINTEMP
  370. #undef HEATER_1_MAXTEMP
  371. #endif
  372. #if TEMP_SENSOR_2 == -4
  373. #define HEATER_2_USES_AD8495
  374. #elif TEMP_SENSOR_2 == -3
  375. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
  376. #elif TEMP_SENSOR_2 == -2
  377. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
  378. #elif TEMP_SENSOR_2 == -1
  379. #define HEATER_2_USES_AD595
  380. #elif TEMP_SENSOR_2 > 0
  381. #define THERMISTOR_HEATER_2 TEMP_SENSOR_2
  382. #define HEATER_2_USES_THERMISTOR
  383. #if TEMP_SENSOR_2 == 1000
  384. #define HEATER_2_USER_THERMISTOR
  385. #endif
  386. #else
  387. #undef HEATER_2_MINTEMP
  388. #undef HEATER_2_MAXTEMP
  389. #endif
  390. #if TEMP_SENSOR_3 == -4
  391. #define HEATER_3_USES_AD8495
  392. #elif TEMP_SENSOR_3 == -3
  393. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
  394. #elif TEMP_SENSOR_3 == -2
  395. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
  396. #elif TEMP_SENSOR_3 == -1
  397. #define HEATER_3_USES_AD595
  398. #elif TEMP_SENSOR_3 > 0
  399. #define THERMISTOR_HEATER_3 TEMP_SENSOR_3
  400. #define HEATER_3_USES_THERMISTOR
  401. #if TEMP_SENSOR_3 == 1000
  402. #define HEATER_3_USER_THERMISTOR
  403. #endif
  404. #else
  405. #undef HEATER_3_MINTEMP
  406. #undef HEATER_3_MAXTEMP
  407. #endif
  408. #if TEMP_SENSOR_4 == -4
  409. #define HEATER_4_USES_AD8495
  410. #elif TEMP_SENSOR_4 == -3
  411. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
  412. #elif TEMP_SENSOR_4 == -2
  413. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
  414. #elif TEMP_SENSOR_4 == -1
  415. #define HEATER_4_USES_AD595
  416. #elif TEMP_SENSOR_4 > 0
  417. #define THERMISTOR_HEATER_4 TEMP_SENSOR_4
  418. #define HEATER_4_USES_THERMISTOR
  419. #if TEMP_SENSOR_4 == 1000
  420. #define HEATER_4_USER_THERMISTOR
  421. #endif
  422. #else
  423. #undef HEATER_4_MINTEMP
  424. #undef HEATER_4_MAXTEMP
  425. #endif
  426. #if TEMP_SENSOR_5 == -4
  427. #define HEATER_5_USES_AD8495
  428. #elif TEMP_SENSOR_5 == -3
  429. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
  430. #elif TEMP_SENSOR_5 == -2
  431. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
  432. #elif TEMP_SENSOR_5 == -1
  433. #define HEATER_5_USES_AD595
  434. #elif TEMP_SENSOR_5 > 0
  435. #define THERMISTOR_HEATER_5 TEMP_SENSOR_5
  436. #define HEATER_5_USES_THERMISTOR
  437. #if TEMP_SENSOR_5 == 1000
  438. #define HEATER_5_USER_THERMISTOR
  439. #endif
  440. #else
  441. #undef HEATER_5_MINTEMP
  442. #undef HEATER_5_MAXTEMP
  443. #endif
  444. #if TEMP_SENSOR_6 == -4
  445. #define HEATER_6_USES_AD8495
  446. #elif TEMP_SENSOR_6 == -3
  447. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
  448. #elif TEMP_SENSOR_6 == -2
  449. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
  450. #elif TEMP_SENSOR_6 == -1
  451. #define HEATER_6_USES_AD595
  452. #elif TEMP_SENSOR_6 > 0
  453. #define THERMISTOR_HEATER_6 TEMP_SENSOR_6
  454. #define HEATER_6_USES_THERMISTOR
  455. #if TEMP_SENSOR_6 == 1000
  456. #define HEATER_6_USER_THERMISTOR
  457. #endif
  458. #else
  459. #undef HEATER_6_MINTEMP
  460. #undef HEATER_6_MAXTEMP
  461. #endif
  462. #if TEMP_SENSOR_7 == -4
  463. #define HEATER_7_USES_AD8495
  464. #elif TEMP_SENSOR_7 == -3
  465. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
  466. #elif TEMP_SENSOR_7 == -2
  467. #error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
  468. #elif TEMP_SENSOR_7 == -1
  469. #define HEATER_7_USES_AD595
  470. #elif TEMP_SENSOR_7 > 0
  471. #define THERMISTOR_HEATER_7 TEMP_SENSOR_7
  472. #define HEATER_7_USES_THERMISTOR
  473. #if TEMP_SENSOR_7 == 1000
  474. #define HEATER_7_USER_THERMISTOR
  475. #endif
  476. #else
  477. #undef HEATER_7_MINTEMP
  478. #undef HEATER_7_MAXTEMP
  479. #endif
  480. #if TEMP_SENSOR_BED == -4
  481. #define HEATER_BED_USES_AD8495
  482. #elif TEMP_SENSOR_BED == -3
  483. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
  484. #elif TEMP_SENSOR_BED == -2
  485. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
  486. #elif TEMP_SENSOR_BED == -1
  487. #define HEATER_BED_USES_AD595
  488. #elif TEMP_SENSOR_BED > 0
  489. #define THERMISTORBED TEMP_SENSOR_BED
  490. #define HEATER_BED_USES_THERMISTOR
  491. #if TEMP_SENSOR_BED == 1000
  492. #define HEATER_BED_USER_THERMISTOR
  493. #endif
  494. #else
  495. #undef BED_MINTEMP
  496. #undef BED_MAXTEMP
  497. #endif
  498. #if TEMP_SENSOR_CHAMBER == -4
  499. #define HEATER_CHAMBER_USES_AD8495
  500. #elif TEMP_SENSOR_CHAMBER == -3
  501. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
  502. #elif TEMP_SENSOR_CHAMBER == -2
  503. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
  504. #elif TEMP_SENSOR_CHAMBER == -1
  505. #define HEATER_CHAMBER_USES_AD595
  506. #elif TEMP_SENSOR_CHAMBER > 0
  507. #define THERMISTORCHAMBER TEMP_SENSOR_CHAMBER
  508. #define HEATER_CHAMBER_USES_THERMISTOR
  509. #if TEMP_SENSOR_CHAMBER == 1000
  510. #define HEATER_CHAMBER_USER_THERMISTOR
  511. #endif
  512. #else
  513. #undef CHAMBER_MINTEMP
  514. #undef CHAMBER_MAXTEMP
  515. #endif
  516. #if TEMP_SENSOR_PROBE == -4
  517. #define HEATER_PROBE_USES_AD8495
  518. #elif TEMP_SENSOR_PROBE == -3
  519. #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
  520. #elif TEMP_SENSOR_PROBE == -2
  521. #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
  522. #elif TEMP_SENSOR_PROBE == -1
  523. #define HEATER_PROBE_USES_AD595
  524. #elif TEMP_SENSOR_PROBE > 0
  525. #define THERMISTORPROBE TEMP_SENSOR_PROBE
  526. #define PROBE_USES_THERMISTOR
  527. #if TEMP_SENSOR_PROBE == 1000
  528. #define PROBE_USER_THERMISTOR
  529. #endif
  530. #endif
  531. #define HOTEND_USES_THERMISTOR ANY( \
  532. HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, \
  533. HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR, HEATER_6_USES_THERMISTOR, HEATER_7_USES_THERMISTOR )
  534. /**
  535. * X_DUAL_ENDSTOPS endstop reassignment
  536. */
  537. #if ENABLED(X_DUAL_ENDSTOPS)
  538. #if X_HOME_DIR > 0
  539. #if X2_USE_ENDSTOP == _XMIN_
  540. #define X2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  541. #elif X2_USE_ENDSTOP == _XMAX_
  542. #define X2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  543. #elif X2_USE_ENDSTOP == _YMIN_
  544. #define X2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  545. #elif X2_USE_ENDSTOP == _YMAX_
  546. #define X2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  547. #elif X2_USE_ENDSTOP == _ZMIN_
  548. #define X2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  549. #elif X2_USE_ENDSTOP == _ZMAX_
  550. #define X2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  551. #else
  552. #define X2_MAX_ENDSTOP_INVERTING false
  553. #endif
  554. #ifndef X2_MAX_PIN
  555. #if X2_USE_ENDSTOP == _XMIN_
  556. #define X2_MAX_PIN X_MIN_PIN
  557. #elif X2_USE_ENDSTOP == _XMAX_
  558. #define X2_MAX_PIN X_MAX_PIN
  559. #elif X2_USE_ENDSTOP == _YMIN_
  560. #define X2_MAX_PIN Y_MIN_PIN
  561. #elif X2_USE_ENDSTOP == _YMAX_
  562. #define X2_MAX_PIN Y_MAX_PIN
  563. #elif X2_USE_ENDSTOP == _ZMIN_
  564. #define X2_MAX_PIN Z_MIN_PIN
  565. #elif X2_USE_ENDSTOP == _ZMAX_
  566. #define X2_MAX_PIN Z_MAX_PIN
  567. #elif X2_USE_ENDSTOP == _XDIAG_
  568. #define X2_MAX_PIN X_DIAG_PIN
  569. #elif X2_USE_ENDSTOP == _YDIAG_
  570. #define X2_MAX_PIN Y_DIAG_PIN
  571. #elif X2_USE_ENDSTOP == _ZDIAG_
  572. #define X2_MAX_PIN Z_DIAG_PIN
  573. #elif X2_USE_ENDSTOP == _E0DIAG_
  574. #define X2_MAX_PIN E0_DIAG_PIN
  575. #elif X2_USE_ENDSTOP == _E1DIAG_
  576. #define X2_MAX_PIN E1_DIAG_PIN
  577. #elif X2_USE_ENDSTOP == _E2DIAG_
  578. #define X2_MAX_PIN E2_DIAG_PIN
  579. #elif X2_USE_ENDSTOP == _E3DIAG_
  580. #define X2_MAX_PIN E3_DIAG_PIN
  581. #elif X2_USE_ENDSTOP == _E4DIAG_
  582. #define X2_MAX_PIN E4_DIAG_PIN
  583. #elif X2_USE_ENDSTOP == _E5DIAG_
  584. #define X2_MAX_PIN E5_DIAG_PIN
  585. #elif X2_USE_ENDSTOP == _E6DIAG_
  586. #define X2_MAX_PIN E6_DIAG_PIN
  587. #elif X2_USE_ENDSTOP == _E7DIAG_
  588. #define X2_MAX_PIN E7_DIAG_PIN
  589. #endif
  590. #endif
  591. #define X2_MIN_ENDSTOP_INVERTING false
  592. #else
  593. #if X2_USE_ENDSTOP == _XMIN_
  594. #define X2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  595. #elif X2_USE_ENDSTOP == _XMAX_
  596. #define X2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  597. #elif X2_USE_ENDSTOP == _YMIN_
  598. #define X2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  599. #elif X2_USE_ENDSTOP == _YMAX_
  600. #define X2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  601. #elif X2_USE_ENDSTOP == _ZMIN_
  602. #define X2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  603. #elif X2_USE_ENDSTOP == _ZMAX_
  604. #define X2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  605. #else
  606. #define X2_MIN_ENDSTOP_INVERTING false
  607. #endif
  608. #ifndef X2_MIN_PIN
  609. #if X2_USE_ENDSTOP == _XMIN_
  610. #define X2_MIN_PIN X_MIN_PIN
  611. #elif X2_USE_ENDSTOP == _XMAX_
  612. #define X2_MIN_PIN X_MAX_PIN
  613. #elif X2_USE_ENDSTOP == _YMIN_
  614. #define X2_MIN_PIN Y_MIN_PIN
  615. #elif X2_USE_ENDSTOP == _YMAX_
  616. #define X2_MIN_PIN Y_MAX_PIN
  617. #elif X2_USE_ENDSTOP == _ZMIN_
  618. #define X2_MIN_PIN Z_MIN_PIN
  619. #elif X2_USE_ENDSTOP == _ZMAX_
  620. #define X2_MIN_PIN Z_MAX_PIN
  621. #elif X2_USE_ENDSTOP == _XDIAG_
  622. #define X2_MIN_PIN X_DIAG_PIN
  623. #elif X2_USE_ENDSTOP == _YDIAG_
  624. #define X2_MIN_PIN Y_DIAG_PIN
  625. #elif X2_USE_ENDSTOP == _ZDIAG_
  626. #define X2_MIN_PIN Z_DIAG_PIN
  627. #elif X2_USE_ENDSTOP == _E0DIAG_
  628. #define X2_MIN_PIN E0_DIAG_PIN
  629. #elif X2_USE_ENDSTOP == _E1DIAG_
  630. #define X2_MIN_PIN E1_DIAG_PIN
  631. #elif X2_USE_ENDSTOP == _E2DIAG_
  632. #define X2_MIN_PIN E2_DIAG_PIN
  633. #elif X2_USE_ENDSTOP == _E3DIAG_
  634. #define X2_MIN_PIN E3_DIAG_PIN
  635. #elif X2_USE_ENDSTOP == _E4DIAG_
  636. #define X2_MIN_PIN E4_DIAG_PIN
  637. #elif X2_USE_ENDSTOP == _E5DIAG_
  638. #define X2_MIN_PIN E5_DIAG_PIN
  639. #elif X2_USE_ENDSTOP == _E6DIAG_
  640. #define X2_MIN_PIN E6_DIAG_PIN
  641. #elif X2_USE_ENDSTOP == _E7DIAG_
  642. #define X2_MIN_PIN E7_DIAG_PIN
  643. #endif
  644. #endif
  645. #define X2_MAX_ENDSTOP_INVERTING false
  646. #endif
  647. #endif
  648. /**
  649. * Y_DUAL_ENDSTOPS endstop reassignment
  650. */
  651. #if ENABLED(Y_DUAL_ENDSTOPS)
  652. #if Y_HOME_DIR > 0
  653. #if Y2_USE_ENDSTOP == _XMIN_
  654. #define Y2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  655. #elif Y2_USE_ENDSTOP == _XMAX_
  656. #define Y2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  657. #elif Y2_USE_ENDSTOP == _YMIN_
  658. #define Y2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  659. #elif Y2_USE_ENDSTOP == _YMAX_
  660. #define Y2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  661. #elif Y2_USE_ENDSTOP == _ZMIN_
  662. #define Y2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  663. #elif Y2_USE_ENDSTOP == _ZMAX_
  664. #define Y2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  665. #else
  666. #define Y2_MAX_ENDSTOP_INVERTING false
  667. #endif
  668. #ifndef Y2_MAX_PIN
  669. #if Y2_USE_ENDSTOP == _XMIN_
  670. #define Y2_MAX_PIN X_MIN_PIN
  671. #elif Y2_USE_ENDSTOP == _XMAX_
  672. #define Y2_MAX_PIN X_MAX_PIN
  673. #elif Y2_USE_ENDSTOP == _YMIN_
  674. #define Y2_MAX_PIN Y_MIN_PIN
  675. #elif Y2_USE_ENDSTOP == _YMAX_
  676. #define Y2_MAX_PIN Y_MAX_PIN
  677. #elif Y2_USE_ENDSTOP == _ZMIN_
  678. #define Y2_MAX_PIN Z_MIN_PIN
  679. #elif Y2_USE_ENDSTOP == _ZMAX_
  680. #define Y2_MAX_PIN Z_MAX_PIN
  681. #elif Y2_USE_ENDSTOP == _XDIAG_
  682. #define Y2_MAX_PIN X_DIAG_PIN
  683. #elif Y2_USE_ENDSTOP == _YDIAG_
  684. #define Y2_MAX_PIN Y_DIAG_PIN
  685. #elif Y2_USE_ENDSTOP == _ZDIAG_
  686. #define Y2_MAX_PIN Z_DIAG_PIN
  687. #elif Y2_USE_ENDSTOP == _E0DIAG_
  688. #define Y2_MAX_PIN E0_DIAG_PIN
  689. #elif Y2_USE_ENDSTOP == _E1DIAG_
  690. #define Y2_MAX_PIN E1_DIAG_PIN
  691. #elif Y2_USE_ENDSTOP == _E2DIAG_
  692. #define Y2_MAX_PIN E2_DIAG_PIN
  693. #elif Y2_USE_ENDSTOP == _E3DIAG_
  694. #define Y2_MAX_PIN E3_DIAG_PIN
  695. #elif Y2_USE_ENDSTOP == _E4DIAG_
  696. #define Y2_MAX_PIN E4_DIAG_PIN
  697. #elif Y2_USE_ENDSTOP == _E5DIAG_
  698. #define Y2_MAX_PIN E5_DIAG_PIN
  699. #elif Y2_USE_ENDSTOP == _E6DIAG_
  700. #define Y2_MAX_PIN E6_DIAG_PIN
  701. #elif Y2_USE_ENDSTOP == _E7DIAG_
  702. #define Y2_MAX_PIN E7_DIAG_PIN
  703. #endif
  704. #endif
  705. #define Y2_MIN_ENDSTOP_INVERTING false
  706. #else
  707. #if Y2_USE_ENDSTOP == _XMIN_
  708. #define Y2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  709. #elif Y2_USE_ENDSTOP == _XMAX_
  710. #define Y2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  711. #elif Y2_USE_ENDSTOP == _YMIN_
  712. #define Y2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  713. #elif Y2_USE_ENDSTOP == _YMAX_
  714. #define Y2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  715. #elif Y2_USE_ENDSTOP == _ZMIN_
  716. #define Y2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  717. #elif Y2_USE_ENDSTOP == _ZMAX_
  718. #define Y2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  719. #else
  720. #define Y2_MIN_ENDSTOP_INVERTING false
  721. #endif
  722. #ifndef Y2_MIN_PIN
  723. #if Y2_USE_ENDSTOP == _XMIN_
  724. #define Y2_MIN_PIN X_MIN_PIN
  725. #elif Y2_USE_ENDSTOP == _XMAX_
  726. #define Y2_MIN_PIN X_MAX_PIN
  727. #elif Y2_USE_ENDSTOP == _YMIN_
  728. #define Y2_MIN_PIN Y_MIN_PIN
  729. #elif Y2_USE_ENDSTOP == _YMAX_
  730. #define Y2_MIN_PIN Y_MAX_PIN
  731. #elif Y2_USE_ENDSTOP == _ZMIN_
  732. #define Y2_MIN_PIN Z_MIN_PIN
  733. #elif Y2_USE_ENDSTOP == _ZMAX_
  734. #define Y2_MIN_PIN Z_MAX_PIN
  735. #elif Y2_USE_ENDSTOP == _XDIAG_
  736. #define Y2_MIN_PIN X_DIAG_PIN
  737. #elif Y2_USE_ENDSTOP == _YDIAG_
  738. #define Y2_MIN_PIN Y_DIAG_PIN
  739. #elif Y2_USE_ENDSTOP == _ZDIAG_
  740. #define Y2_MIN_PIN Z_DIAG_PIN
  741. #elif Y2_USE_ENDSTOP == _E0DIAG_
  742. #define Y2_MIN_PIN E0_DIAG_PIN
  743. #elif Y2_USE_ENDSTOP == _E1DIAG_
  744. #define Y2_MIN_PIN E1_DIAG_PIN
  745. #elif Y2_USE_ENDSTOP == _E2DIAG_
  746. #define Y2_MIN_PIN E2_DIAG_PIN
  747. #elif Y2_USE_ENDSTOP == _E3DIAG_
  748. #define Y2_MIN_PIN E3_DIAG_PIN
  749. #elif Y2_USE_ENDSTOP == _E4DIAG_
  750. #define Y2_MIN_PIN E4_DIAG_PIN
  751. #elif Y2_USE_ENDSTOP == _E5DIAG_
  752. #define Y2_MIN_PIN E5_DIAG_PIN
  753. #elif Y2_USE_ENDSTOP == _E6DIAG_
  754. #define Y2_MIN_PIN E6_DIAG_PIN
  755. #elif Y2_USE_ENDSTOP == _E7DIAG_
  756. #define Y2_MIN_PIN E7_DIAG_PIN
  757. #endif
  758. #endif
  759. #define Y2_MAX_ENDSTOP_INVERTING false
  760. #endif
  761. #endif
  762. /**
  763. * Z_MULTI_ENDSTOPS endstop reassignment
  764. */
  765. #if ENABLED(Z_MULTI_ENDSTOPS)
  766. #if Z_HOME_DIR > 0
  767. #if Z2_USE_ENDSTOP == _XMIN_
  768. #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  769. #elif Z2_USE_ENDSTOP == _XMAX_
  770. #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  771. #elif Z2_USE_ENDSTOP == _YMIN_
  772. #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  773. #elif Z2_USE_ENDSTOP == _YMAX_
  774. #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  775. #elif Z2_USE_ENDSTOP == _ZMIN_
  776. #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  777. #elif Z2_USE_ENDSTOP == _ZMAX_
  778. #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  779. #else
  780. #define Z2_MAX_ENDSTOP_INVERTING false
  781. #endif
  782. #ifndef Z2_MAX_PIN
  783. #if Z2_USE_ENDSTOP == _XMIN_
  784. #define Z2_MAX_PIN X_MIN_PIN
  785. #elif Z2_USE_ENDSTOP == _XMAX_
  786. #define Z2_MAX_PIN X_MAX_PIN
  787. #elif Z2_USE_ENDSTOP == _YMIN_
  788. #define Z2_MAX_PIN Y_MIN_PIN
  789. #elif Z2_USE_ENDSTOP == _YMAX_
  790. #define Z2_MAX_PIN Y_MAX_PIN
  791. #elif Z2_USE_ENDSTOP == _ZMIN_
  792. #define Z2_MAX_PIN Z_MIN_PIN
  793. #elif Z2_USE_ENDSTOP == _ZMAX_
  794. #define Z2_MAX_PIN Z_MAX_PIN
  795. #elif Z2_USE_ENDSTOP == _XDIAG_
  796. #define Z2_MAX_PIN X_DIAG_PIN
  797. #elif Z2_USE_ENDSTOP == _YDIAG_
  798. #define Z2_MAX_PIN Y_DIAG_PIN
  799. #elif Z2_USE_ENDSTOP == _ZDIAG_
  800. #define Z2_MAX_PIN Z_DIAG_PIN
  801. #elif Z2_USE_ENDSTOP == _E0DIAG_
  802. #define Z2_MAX_PIN E0_DIAG_PIN
  803. #elif Z2_USE_ENDSTOP == _E1DIAG_
  804. #define Z2_MAX_PIN E1_DIAG_PIN
  805. #elif Z2_USE_ENDSTOP == _E2DIAG_
  806. #define Z2_MAX_PIN E2_DIAG_PIN
  807. #elif Z2_USE_ENDSTOP == _E3DIAG_
  808. #define Z2_MAX_PIN E3_DIAG_PIN
  809. #elif Z2_USE_ENDSTOP == _E4DIAG_
  810. #define Z2_MAX_PIN E4_DIAG_PIN
  811. #elif Z2_USE_ENDSTOP == _E5DIAG_
  812. #define Z2_MAX_PIN E5_DIAG_PIN
  813. #elif Z2_USE_ENDSTOP == _E6DIAG_
  814. #define Z2_MAX_PIN E6_DIAG_PIN
  815. #elif Z2_USE_ENDSTOP == _E7DIAG_
  816. #define Z2_MAX_PIN E7_DIAG_PIN
  817. #endif
  818. #endif
  819. #define Z2_MIN_ENDSTOP_INVERTING false
  820. #else
  821. #if Z2_USE_ENDSTOP == _XMIN_
  822. #define Z2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  823. #elif Z2_USE_ENDSTOP == _XMAX_
  824. #define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  825. #elif Z2_USE_ENDSTOP == _YMIN_
  826. #define Z2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  827. #elif Z2_USE_ENDSTOP == _YMAX_
  828. #define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  829. #elif Z2_USE_ENDSTOP == _ZMIN_
  830. #define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  831. #elif Z2_USE_ENDSTOP == _ZMAX_
  832. #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  833. #else
  834. #define Z2_MIN_ENDSTOP_INVERTING false
  835. #endif
  836. #ifndef Z2_MIN_PIN
  837. #if Z2_USE_ENDSTOP == _XMIN_
  838. #define Z2_MIN_PIN X_MIN_PIN
  839. #elif Z2_USE_ENDSTOP == _XMAX_
  840. #define Z2_MIN_PIN X_MAX_PIN
  841. #elif Z2_USE_ENDSTOP == _YMIN_
  842. #define Z2_MIN_PIN Y_MIN_PIN
  843. #elif Z2_USE_ENDSTOP == _YMAX_
  844. #define Z2_MIN_PIN Y_MAX_PIN
  845. #elif Z2_USE_ENDSTOP == _ZMIN_
  846. #define Z2_MIN_PIN Z_MIN_PIN
  847. #elif Z2_USE_ENDSTOP == _ZMAX_
  848. #define Z2_MIN_PIN Z_MAX_PIN
  849. #elif Z2_USE_ENDSTOP == _XDIAG_
  850. #define Z2_MIN_PIN X_DIAG_PIN
  851. #elif Z2_USE_ENDSTOP == _YDIAG_
  852. #define Z2_MIN_PIN Y_DIAG_PIN
  853. #elif Z2_USE_ENDSTOP == _ZDIAG_
  854. #define Z2_MIN_PIN Z_DIAG_PIN
  855. #elif Z2_USE_ENDSTOP == _E0DIAG_
  856. #define Z2_MIN_PIN E0_DIAG_PIN
  857. #elif Z2_USE_ENDSTOP == _E1DIAG_
  858. #define Z2_MIN_PIN E1_DIAG_PIN
  859. #elif Z2_USE_ENDSTOP == _E2DIAG_
  860. #define Z2_MIN_PIN E2_DIAG_PIN
  861. #elif Z2_USE_ENDSTOP == _E3DIAG_
  862. #define Z2_MIN_PIN E3_DIAG_PIN
  863. #elif Z2_USE_ENDSTOP == _E4DIAG_
  864. #define Z2_MIN_PIN E4_DIAG_PIN
  865. #elif Z2_USE_ENDSTOP == _E5DIAG_
  866. #define Z2_MIN_PIN E5_DIAG_PIN
  867. #elif Z2_USE_ENDSTOP == _E6DIAG_
  868. #define Z2_MIN_PIN E6_DIAG_PIN
  869. #elif Z2_USE_ENDSTOP == _E7DIAG_
  870. #define Z2_MIN_PIN E7_DIAG_PIN
  871. #endif
  872. #endif
  873. #define Z2_MAX_ENDSTOP_INVERTING false
  874. #endif
  875. #if NUM_Z_STEPPER_DRIVERS >= 3
  876. #if Z_HOME_DIR > 0
  877. #if Z3_USE_ENDSTOP == _XMIN_
  878. #define Z3_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  879. #elif Z3_USE_ENDSTOP == _XMAX_
  880. #define Z3_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  881. #elif Z3_USE_ENDSTOP == _YMIN_
  882. #define Z3_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  883. #elif Z3_USE_ENDSTOP == _YMAX_
  884. #define Z3_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  885. #elif Z3_USE_ENDSTOP == _ZMIN_
  886. #define Z3_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  887. #elif Z3_USE_ENDSTOP == _ZMAX_
  888. #define Z3_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  889. #else
  890. #define Z3_MAX_ENDSTOP_INVERTING false
  891. #endif
  892. #ifndef Z3_MAX_PIN
  893. #if Z3_USE_ENDSTOP == _XMIN_
  894. #define Z3_MAX_PIN X_MIN_PIN
  895. #elif Z3_USE_ENDSTOP == _XMAX_
  896. #define Z3_MAX_PIN X_MAX_PIN
  897. #elif Z3_USE_ENDSTOP == _YMIN_
  898. #define Z3_MAX_PIN Y_MIN_PIN
  899. #elif Z3_USE_ENDSTOP == _YMAX_
  900. #define Z3_MAX_PIN Y_MAX_PIN
  901. #elif Z3_USE_ENDSTOP == _ZMIN_
  902. #define Z3_MAX_PIN Z_MIN_PIN
  903. #elif Z3_USE_ENDSTOP == _ZMAX_
  904. #define Z3_MAX_PIN Z_MAX_PIN
  905. #elif Z3_USE_ENDSTOP == _XDIAG_
  906. #define Z3_MAX_PIN X_DIAG_PIN
  907. #elif Z3_USE_ENDSTOP == _YDIAG_
  908. #define Z3_MAX_PIN Y_DIAG_PIN
  909. #elif Z3_USE_ENDSTOP == _ZDIAG_
  910. #define Z3_MAX_PIN Z_DIAG_PIN
  911. #elif Z3_USE_ENDSTOP == _E0DIAG_
  912. #define Z3_MAX_PIN E0_DIAG_PIN
  913. #elif Z3_USE_ENDSTOP == _E1DIAG_
  914. #define Z3_MAX_PIN E1_DIAG_PIN
  915. #elif Z3_USE_ENDSTOP == _E2DIAG_
  916. #define Z3_MAX_PIN E2_DIAG_PIN
  917. #elif Z3_USE_ENDSTOP == _E3DIAG_
  918. #define Z3_MAX_PIN E3_DIAG_PIN
  919. #elif Z3_USE_ENDSTOP == _E4DIAG_
  920. #define Z3_MAX_PIN E4_DIAG_PIN
  921. #elif Z3_USE_ENDSTOP == _E5DIAG_
  922. #define Z3_MAX_PIN E5_DIAG_PIN
  923. #elif Z3_USE_ENDSTOP == _E6DIAG_
  924. #define Z3_MAX_PIN E6_DIAG_PIN
  925. #elif Z3_USE_ENDSTOP == _E7DIAG_
  926. #define Z3_MAX_PIN E7_DIAG_PIN
  927. #endif
  928. #endif
  929. #define Z3_MIN_ENDSTOP_INVERTING false
  930. #else
  931. #if Z3_USE_ENDSTOP == _XMIN_
  932. #define Z3_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  933. #elif Z3_USE_ENDSTOP == _XMAX_
  934. #define Z3_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  935. #elif Z3_USE_ENDSTOP == _YMIN_
  936. #define Z3_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  937. #elif Z3_USE_ENDSTOP == _YMAX_
  938. #define Z3_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  939. #elif Z3_USE_ENDSTOP == _ZMIN_
  940. #define Z3_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  941. #elif Z3_USE_ENDSTOP == _ZMAX_
  942. #define Z3_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  943. #else
  944. #define Z3_MIN_ENDSTOP_INVERTING false
  945. #endif
  946. #ifndef Z3_MIN_PIN
  947. #if Z3_USE_ENDSTOP == _XMIN_
  948. #define Z3_MIN_PIN X_MIN_PIN
  949. #elif Z3_USE_ENDSTOP == _XMAX_
  950. #define Z3_MIN_PIN X_MAX_PIN
  951. #elif Z3_USE_ENDSTOP == _YMIN_
  952. #define Z3_MIN_PIN Y_MIN_PIN
  953. #elif Z3_USE_ENDSTOP == _YMAX_
  954. #define Z3_MIN_PIN Y_MAX_PIN
  955. #elif Z3_USE_ENDSTOP == _ZMIN_
  956. #define Z3_MIN_PIN Z_MIN_PIN
  957. #elif Z3_USE_ENDSTOP == _ZMAX_
  958. #define Z3_MIN_PIN Z_MAX_PIN
  959. #elif Z3_USE_ENDSTOP == _XDIAG_
  960. #define Z3_MIN_PIN X_DIAG_PIN
  961. #elif Z3_USE_ENDSTOP == _YDIAG_
  962. #define Z3_MIN_PIN Y_DIAG_PIN
  963. #elif Z3_USE_ENDSTOP == _ZDIAG_
  964. #define Z3_MIN_PIN Z_DIAG_PIN
  965. #elif Z3_USE_ENDSTOP == _E0DIAG_
  966. #define Z3_MIN_PIN E0_DIAG_PIN
  967. #elif Z3_USE_ENDSTOP == _E1DIAG_
  968. #define Z3_MIN_PIN E1_DIAG_PIN
  969. #elif Z3_USE_ENDSTOP == _E2DIAG_
  970. #define Z3_MIN_PIN E2_DIAG_PIN
  971. #elif Z3_USE_ENDSTOP == _E3DIAG_
  972. #define Z3_MIN_PIN E3_DIAG_PIN
  973. #elif Z3_USE_ENDSTOP == _E4DIAG_
  974. #define Z3_MIN_PIN E4_DIAG_PIN
  975. #elif Z3_USE_ENDSTOP == _E5DIAG_
  976. #define Z3_MIN_PIN E5_DIAG_PIN
  977. #elif Z3_USE_ENDSTOP == _E6DIAG_
  978. #define Z3_MIN_PIN E6_DIAG_PIN
  979. #elif Z3_USE_ENDSTOP == _E7DIAG_
  980. #define Z3_MIN_PIN E7_DIAG_PIN
  981. #endif
  982. #endif
  983. #define Z3_MAX_ENDSTOP_INVERTING false
  984. #endif
  985. #endif
  986. #if NUM_Z_STEPPER_DRIVERS >= 4
  987. #if Z_HOME_DIR > 0
  988. #if Z4_USE_ENDSTOP == _XMIN_
  989. #define Z4_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  990. #elif Z4_USE_ENDSTOP == _XMAX_
  991. #define Z4_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  992. #elif Z4_USE_ENDSTOP == _YMIN_
  993. #define Z4_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  994. #elif Z4_USE_ENDSTOP == _YMAX_
  995. #define Z4_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  996. #elif Z4_USE_ENDSTOP == _ZMIN_
  997. #define Z4_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  998. #elif Z4_USE_ENDSTOP == _ZMAX_
  999. #define Z4_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  1000. #else
  1001. #define Z4_MAX_ENDSTOP_INVERTING false
  1002. #endif
  1003. #ifndef Z4_MAX_PIN
  1004. #if Z4_USE_ENDSTOP == _XMIN_
  1005. #define Z4_MAX_PIN X_MIN_PIN
  1006. #elif Z4_USE_ENDSTOP == _XMAX_
  1007. #define Z4_MAX_PIN X_MAX_PIN
  1008. #elif Z4_USE_ENDSTOP == _YMIN_
  1009. #define Z4_MAX_PIN Y_MIN_PIN
  1010. #elif Z4_USE_ENDSTOP == _YMAX_
  1011. #define Z4_MAX_PIN Y_MAX_PIN
  1012. #elif Z4_USE_ENDSTOP == _ZMIN_
  1013. #define Z4_MAX_PIN Z_MIN_PIN
  1014. #elif Z4_USE_ENDSTOP == _ZMAX_
  1015. #define Z4_MAX_PIN Z_MAX_PIN
  1016. #elif Z4_USE_ENDSTOP == _XDIAG_
  1017. #define Z4_MAX_PIN X_DIAG_PIN
  1018. #elif Z4_USE_ENDSTOP == _YDIAG_
  1019. #define Z4_MAX_PIN Y_DIAG_PIN
  1020. #elif Z4_USE_ENDSTOP == _ZDIAG_
  1021. #define Z4_MAX_PIN Z_DIAG_PIN
  1022. #elif Z4_USE_ENDSTOP == _E0DIAG_
  1023. #define Z4_MAX_PIN E0_DIAG_PIN
  1024. #elif Z4_USE_ENDSTOP == _E1DIAG_
  1025. #define Z4_MAX_PIN E1_DIAG_PIN
  1026. #elif Z4_USE_ENDSTOP == _E2DIAG_
  1027. #define Z4_MAX_PIN E2_DIAG_PIN
  1028. #elif Z4_USE_ENDSTOP == _E3DIAG_
  1029. #define Z4_MAX_PIN E3_DIAG_PIN
  1030. #elif Z4_USE_ENDSTOP == _E4DIAG_
  1031. #define Z4_MAX_PIN E4_DIAG_PIN
  1032. #elif Z4_USE_ENDSTOP == _E5DIAG_
  1033. #define Z4_MAX_PIN E5_DIAG_PIN
  1034. #elif Z4_USE_ENDSTOP == _E6DIAG_
  1035. #define Z4_MAX_PIN E6_DIAG_PIN
  1036. #elif Z4_USE_ENDSTOP == _E7DIAG_
  1037. #define Z4_MAX_PIN E7_DIAG_PIN
  1038. #endif
  1039. #endif
  1040. #define Z4_MIN_ENDSTOP_INVERTING false
  1041. #else
  1042. #if Z4_USE_ENDSTOP == _XMIN_
  1043. #define Z4_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
  1044. #elif Z4_USE_ENDSTOP == _XMAX_
  1045. #define Z4_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
  1046. #elif Z4_USE_ENDSTOP == _YMIN_
  1047. #define Z4_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
  1048. #elif Z4_USE_ENDSTOP == _YMAX_
  1049. #define Z4_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
  1050. #elif Z4_USE_ENDSTOP == _ZMIN_
  1051. #define Z4_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
  1052. #elif Z4_USE_ENDSTOP == _ZMAX_
  1053. #define Z4_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
  1054. #else
  1055. #define Z4_MIN_ENDSTOP_INVERTING false
  1056. #endif
  1057. #ifndef Z4_MIN_PIN
  1058. #if Z4_USE_ENDSTOP == _XMIN_
  1059. #define Z4_MIN_PIN X_MIN_PIN
  1060. #elif Z4_USE_ENDSTOP == _XMAX_
  1061. #define Z4_MIN_PIN X_MAX_PIN
  1062. #elif Z4_USE_ENDSTOP == _YMIN_
  1063. #define Z4_MIN_PIN Y_MIN_PIN
  1064. #elif Z4_USE_ENDSTOP == _YMAX_
  1065. #define Z4_MIN_PIN Y_MAX_PIN
  1066. #elif Z4_USE_ENDSTOP == _ZMIN_
  1067. #define Z4_MIN_PIN Z_MIN_PIN
  1068. #elif Z4_USE_ENDSTOP == _ZMAX_
  1069. #define Z4_MIN_PIN Z_MAX_PIN
  1070. #elif Z4_USE_ENDSTOP == _XDIAG_
  1071. #define Z4_MIN_PIN X_DIAG_PIN
  1072. #elif Z4_USE_ENDSTOP == _YDIAG_
  1073. #define Z4_MIN_PIN Y_DIAG_PIN
  1074. #elif Z4_USE_ENDSTOP == _ZDIAG_
  1075. #define Z4_MIN_PIN Z_DIAG_PIN
  1076. #elif Z4_USE_ENDSTOP == _E0DIAG_
  1077. #define Z4_MIN_PIN E0_DIAG_PIN
  1078. #elif Z4_USE_ENDSTOP == _E1DIAG_
  1079. #define Z4_MIN_PIN E1_DIAG_PIN
  1080. #elif Z4_USE_ENDSTOP == _E2DIAG_
  1081. #define Z4_MIN_PIN E2_DIAG_PIN
  1082. #elif Z4_USE_ENDSTOP == _E3DIAG_
  1083. #define Z4_MIN_PIN E3_DIAG_PIN
  1084. #elif Z4_USE_ENDSTOP == _E4DIAG_
  1085. #define Z4_MIN_PIN E4_DIAG_PIN
  1086. #elif Z4_USE_ENDSTOP == _E5DIAG_
  1087. #define Z4_MIN_PIN E5_DIAG_PIN
  1088. #elif Z4_USE_ENDSTOP == _E6DIAG_
  1089. #define Z4_MIN_PIN E6_DIAG_PIN
  1090. #elif Z4_USE_ENDSTOP == _E7DIAG_
  1091. #define Z4_MIN_PIN E7_DIAG_PIN
  1092. #endif
  1093. #endif
  1094. #define Z4_MAX_ENDSTOP_INVERTING false
  1095. #endif
  1096. #endif
  1097. #endif // Z_MULTI_ENDSTOPS
  1098. /**
  1099. * Set ENDSTOPPULLUPS for active endstop switches
  1100. */
  1101. #if ENABLED(ENDSTOPPULLUPS)
  1102. #if ENABLED(USE_XMAX_PLUG)
  1103. #define ENDSTOPPULLUP_XMAX
  1104. #endif
  1105. #if ENABLED(USE_YMAX_PLUG)
  1106. #define ENDSTOPPULLUP_YMAX
  1107. #endif
  1108. #if ENABLED(USE_ZMAX_PLUG)
  1109. #define ENDSTOPPULLUP_ZMAX
  1110. #endif
  1111. #if ENABLED(USE_XMIN_PLUG)
  1112. #define ENDSTOPPULLUP_XMIN
  1113. #endif
  1114. #if ENABLED(USE_YMIN_PLUG)
  1115. #define ENDSTOPPULLUP_YMIN
  1116. #endif
  1117. #if ENABLED(USE_ZMIN_PLUG)
  1118. #define ENDSTOPPULLUP_ZMIN
  1119. #endif
  1120. #endif
  1121. /**
  1122. * Set ENDSTOPPULLDOWNS for active endstop switches
  1123. */
  1124. #if ENABLED(ENDSTOPPULLDOWNS)
  1125. #if ENABLED(USE_XMAX_PLUG)
  1126. #define ENDSTOPPULLDOWN_XMAX
  1127. #endif
  1128. #if ENABLED(USE_YMAX_PLUG)
  1129. #define ENDSTOPPULLDOWN_YMAX
  1130. #endif
  1131. #if ENABLED(USE_ZMAX_PLUG)
  1132. #define ENDSTOPPULLDOWN_ZMAX
  1133. #endif
  1134. #if ENABLED(USE_XMIN_PLUG)
  1135. #define ENDSTOPPULLDOWN_XMIN
  1136. #endif
  1137. #if ENABLED(USE_YMIN_PLUG)
  1138. #define ENDSTOPPULLDOWN_YMIN
  1139. #endif
  1140. #if ENABLED(USE_ZMIN_PLUG)
  1141. #define ENDSTOPPULLDOWN_ZMIN
  1142. #endif
  1143. #endif
  1144. /**
  1145. * Shorthand for pin tests, used wherever needed
  1146. */
  1147. // Steppers
  1148. #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X)))
  1149. #define HAS_X_DIR (PIN_EXISTS(X_DIR))
  1150. #define HAS_X_STEP (PIN_EXISTS(X_STEP))
  1151. #define HAS_X_MICROSTEPS (PIN_EXISTS(X_MS1))
  1152. #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2)))
  1153. #define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
  1154. #define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
  1155. #define HAS_X2_MICROSTEPS (PIN_EXISTS(X2_MS1))
  1156. #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y)))
  1157. #define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
  1158. #define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
  1159. #define HAS_Y_MICROSTEPS (PIN_EXISTS(Y_MS1))
  1160. #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2)))
  1161. #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
  1162. #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
  1163. #define HAS_Y2_MICROSTEPS (PIN_EXISTS(Y2_MS1))
  1164. #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z)))
  1165. #define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
  1166. #define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
  1167. #define HAS_Z_MICROSTEPS (PIN_EXISTS(Z_MS1))
  1168. #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)))
  1169. #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
  1170. #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
  1171. #define HAS_Z2_MICROSTEPS (PIN_EXISTS(Z2_MS1))
  1172. #define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3)))
  1173. #define HAS_Z3_DIR (PIN_EXISTS(Z3_DIR))
  1174. #define HAS_Z3_STEP (PIN_EXISTS(Z3_STEP))
  1175. #define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1))
  1176. #define HAS_Z4_ENABLE (PIN_EXISTS(Z4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z4)))
  1177. #define HAS_Z4_DIR (PIN_EXISTS(Z4_DIR))
  1178. #define HAS_Z4_STEP (PIN_EXISTS(Z4_STEP))
  1179. #define HAS_Z4_MICROSTEPS (PIN_EXISTS(Z4_MS1))
  1180. // Extruder steppers and solenoids
  1181. #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)))
  1182. #define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
  1183. #define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
  1184. #define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1))
  1185. #define HAS_SOLENOID_0 (PIN_EXISTS(SOL0))
  1186. #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)))
  1187. #define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
  1188. #define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
  1189. #define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1))
  1190. #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
  1191. #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)))
  1192. #define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
  1193. #define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
  1194. #define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1))
  1195. #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
  1196. #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)))
  1197. #define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
  1198. #define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
  1199. #define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1))
  1200. #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
  1201. #define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)))
  1202. #define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
  1203. #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
  1204. #define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1))
  1205. #define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
  1206. #define HAS_E5_ENABLE (PIN_EXISTS(E5_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)))
  1207. #define HAS_E5_DIR (PIN_EXISTS(E5_DIR))
  1208. #define HAS_E5_STEP (PIN_EXISTS(E5_STEP))
  1209. #define HAS_E5_MICROSTEPS (PIN_EXISTS(E5_MS1))
  1210. #define HAS_SOLENOID_5 (PIN_EXISTS(SOL5))
  1211. #define HAS_E6_ENABLE (PIN_EXISTS(E6_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E6)))
  1212. #define HAS_E6_DIR (PIN_EXISTS(E6_DIR))
  1213. #define HAS_E6_STEP (PIN_EXISTS(E6_STEP))
  1214. #define HAS_E6_MICROSTEPS (PIN_EXISTS(E6_MS1))
  1215. #define HAS_SOLENOID_6 (PIN_EXISTS(SOL6))
  1216. #define HAS_E7_ENABLE (PIN_EXISTS(E7_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E7)))
  1217. #define HAS_E7_DIR (PIN_EXISTS(E7_DIR))
  1218. #define HAS_E7_STEP (PIN_EXISTS(E7_STEP))
  1219. #define HAS_E7_MICROSTEPS (PIN_EXISTS(E7_MS1))
  1220. #define HAS_SOLENOID_7 (PIN_EXISTS(SOL7))
  1221. // Trinamic Stepper Drivers
  1222. #if HAS_TRINAMIC
  1223. #define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
  1224. #define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
  1225. // Disable Z axis sensorless homing if a probe is used to home the Z axis
  1226. #if HOMING_Z_WITH_PROBE
  1227. #undef Z_STALL_SENSITIVITY
  1228. #endif
  1229. #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY))
  1230. #define X2_SENSORLESS (AXIS_HAS_STALLGUARD(X2) && defined(X2_STALL_SENSITIVITY))
  1231. #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY))
  1232. #define Y2_SENSORLESS (AXIS_HAS_STALLGUARD(Y2) && defined(Y2_STALL_SENSITIVITY))
  1233. #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY))
  1234. #define Z2_SENSORLESS (AXIS_HAS_STALLGUARD(Z2) && defined(Z2_STALL_SENSITIVITY))
  1235. #define Z3_SENSORLESS (AXIS_HAS_STALLGUARD(Z3) && defined(Z3_STALL_SENSITIVITY))
  1236. #define Z4_SENSORLESS (AXIS_HAS_STALLGUARD(Z4) && defined(Z4_STALL_SENSITIVITY))
  1237. #if ENABLED(SPI_ENDSTOPS)
  1238. #define X_SPI_SENSORLESS X_SENSORLESS
  1239. #define Y_SPI_SENSORLESS Y_SENSORLESS
  1240. #define Z_SPI_SENSORLESS Z_SENSORLESS
  1241. #endif
  1242. #endif
  1243. #define HAS_E_STEPPER_ENABLE (HAS_E_DRIVER(TMC2660) \
  1244. || ( E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != X_ENABLE_PIN \
  1245. && E0_ENABLE_PIN != Y_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN ) \
  1246. )
  1247. //
  1248. // Endstops and bed probe
  1249. //
  1250. // Is an endstop plug used for extra Z endstops or the probe?
  1251. #define IS_PROBE_PIN(A,M) (HAS_CUSTOM_PROBE_PIN && Z_MIN_PROBE_PIN == P)
  1252. #define IS_X2_ENDSTOP(A,M) (ENABLED(X_DUAL_ENDSTOPS) && X2_USE_ENDSTOP == _##A##M##_)
  1253. #define IS_Y2_ENDSTOP(A,M) (ENABLED(Y_DUAL_ENDSTOPS) && Y2_USE_ENDSTOP == _##A##M##_)
  1254. #define IS_Z2_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_)
  1255. #define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_)
  1256. #define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_)
  1257. #define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M))
  1258. #define HAS_X_MIN _HAS_STOP(X,MIN)
  1259. #define HAS_X_MAX _HAS_STOP(X,MAX)
  1260. #define HAS_Y_MIN _HAS_STOP(Y,MIN)
  1261. #define HAS_Y_MAX _HAS_STOP(Y,MAX)
  1262. #define HAS_Z_MIN _HAS_STOP(Z,MIN)
  1263. #define HAS_Z_MAX _HAS_STOP(Z,MAX)
  1264. #define HAS_X2_MIN (PIN_EXISTS(X2_MIN))
  1265. #define HAS_X2_MAX (PIN_EXISTS(X2_MAX))
  1266. #define HAS_Y2_MIN (PIN_EXISTS(Y2_MIN))
  1267. #define HAS_Y2_MAX (PIN_EXISTS(Y2_MAX))
  1268. #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
  1269. #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
  1270. #define HAS_Z3_MIN (PIN_EXISTS(Z3_MIN))
  1271. #define HAS_Z3_MAX (PIN_EXISTS(Z3_MAX))
  1272. #define HAS_Z4_MIN (PIN_EXISTS(Z4_MIN))
  1273. #define HAS_Z4_MAX (PIN_EXISTS(Z4_MAX))
  1274. #define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE))
  1275. //
  1276. // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
  1277. //
  1278. #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675))
  1279. #define HAS_TEMP_ADC_0 HAS_ADC_TEST(0)
  1280. #define HAS_TEMP_ADC_1 HAS_ADC_TEST(1)
  1281. #define HAS_TEMP_ADC_2 HAS_ADC_TEST(2)
  1282. #define HAS_TEMP_ADC_3 HAS_ADC_TEST(3)
  1283. #define HAS_TEMP_ADC_4 HAS_ADC_TEST(4)
  1284. #define HAS_TEMP_ADC_5 HAS_ADC_TEST(5)
  1285. #define HAS_TEMP_ADC_6 HAS_ADC_TEST(6)
  1286. #define HAS_TEMP_ADC_7 HAS_ADC_TEST(7)
  1287. #define HAS_TEMP_ADC_BED HAS_ADC_TEST(BED)
  1288. #define HAS_TEMP_ADC_PROBE HAS_ADC_TEST(PROBE)
  1289. #define HAS_TEMP_ADC_CHAMBER HAS_ADC_TEST(CHAMBER)
  1290. #define HAS_TEMP_HOTEND ((HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)) && HOTENDS)
  1291. #define HAS_TEMP_BED HAS_TEMP_ADC_BED
  1292. #define HAS_TEMP_PROBE HAS_TEMP_ADC_PROBE
  1293. #define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER
  1294. #if ENABLED(JOYSTICK)
  1295. #define HAS_JOY_ADC_X PIN_EXISTS(JOY_X)
  1296. #define HAS_JOY_ADC_Y PIN_EXISTS(JOY_Y)
  1297. #define HAS_JOY_ADC_Z PIN_EXISTS(JOY_Z)
  1298. #define HAS_JOY_ADC_EN PIN_EXISTS(JOY_EN)
  1299. #endif
  1300. // Heaters
  1301. #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
  1302. #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
  1303. #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
  1304. #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
  1305. #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
  1306. #define HAS_HEATER_5 (PIN_EXISTS(HEATER_5))
  1307. #define HAS_HEATER_6 (PIN_EXISTS(HEATER_6))
  1308. #define HAS_HEATER_7 (PIN_EXISTS(HEATER_7))
  1309. #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
  1310. // Shorthand for common combinations
  1311. #define HAS_HEATED_BED (HAS_TEMP_BED && HAS_HEATER_BED)
  1312. #define BED_OR_CHAMBER (HAS_HEATED_BED || HAS_TEMP_CHAMBER)
  1313. #define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE)
  1314. #define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER))
  1315. // PID heating
  1316. #if !HAS_HEATED_BED
  1317. #undef PIDTEMPBED
  1318. #endif
  1319. #define HAS_PID_HEATING EITHER(PIDTEMP, PIDTEMPBED)
  1320. #define HAS_PID_FOR_BOTH BOTH(PIDTEMP, PIDTEMPBED)
  1321. // Thermal protection
  1322. #define HAS_THERMALLY_PROTECTED_BED (HAS_HEATED_BED && ENABLED(THERMAL_PROTECTION_BED))
  1323. #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
  1324. #define WATCH_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
  1325. #define WATCH_CHAMBER (HAS_HEATED_CHAMBER && ENABLED(THERMAL_PROTECTION_CHAMBER) && WATCH_CHAMBER_TEMP_PERIOD > 0)
  1326. // Auto fans
  1327. #define HAS_AUTO_FAN_0 (HOTENDS > 0 && PIN_EXISTS(E0_AUTO_FAN))
  1328. #define HAS_AUTO_FAN_1 (HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN))
  1329. #define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN))
  1330. #define HAS_AUTO_FAN_3 (HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN))
  1331. #define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN))
  1332. #define HAS_AUTO_FAN_5 (HOTENDS > 5 && PIN_EXISTS(E5_AUTO_FAN))
  1333. #define HAS_AUTO_FAN_6 (HOTENDS > 6 && PIN_EXISTS(E6_AUTO_FAN))
  1334. #define HAS_AUTO_FAN_7 (HOTENDS > 7 && PIN_EXISTS(E7_AUTO_FAN))
  1335. #define HAS_AUTO_CHAMBER_FAN (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_AUTO_FAN))
  1336. #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_FAN_6 || HAS_AUTO_FAN_7 || HAS_AUTO_CHAMBER_FAN)
  1337. #define _FANOVERLAP(A,B) (A##_AUTO_FAN_PIN == E##B##_AUTO_FAN_PIN)
  1338. #if HAS_AUTO_FAN
  1339. #define AUTO_CHAMBER_IS_E (_FANOVERLAP(CHAMBER,0) || _FANOVERLAP(CHAMBER,1) || _FANOVERLAP(CHAMBER,2) || _FANOVERLAP(CHAMBER,3) || _FANOVERLAP(CHAMBER,4) || _FANOVERLAP(CHAMBER,5) || _FANOVERLAP(CHAMBER,6) || _FANOVERLAP(CHAMBER,7))
  1340. #endif
  1341. #if !HAS_TEMP_SENSOR
  1342. #undef AUTO_REPORT_TEMPERATURES
  1343. #endif
  1344. #define HAS_AUTO_REPORTING EITHER(AUTO_REPORT_TEMPERATURES, AUTO_REPORT_SD_STATUS)
  1345. #if !HAS_AUTO_CHAMBER_FAN || AUTO_CHAMBER_IS_E
  1346. #undef AUTO_POWER_CHAMBER_FAN
  1347. #endif
  1348. // Other fans
  1349. #define HAS_FAN0 (PIN_EXISTS(FAN))
  1350. #define _HAS_FAN(P) (PIN_EXISTS(FAN##P) && CONTROLLER_FAN_PIN != FAN##P##_PIN && E0_AUTO_FAN_PIN != FAN##P##_PIN && E1_AUTO_FAN_PIN != FAN##P##_PIN && E2_AUTO_FAN_PIN != FAN##P##_PIN && E3_AUTO_FAN_PIN != FAN##P##_PIN && E4_AUTO_FAN_PIN != FAN##P##_PIN && E5_AUTO_FAN_PIN != FAN##P##_PIN && E6_AUTO_FAN_PIN != FAN##P##_PIN && E7_AUTO_FAN_PIN != FAN##P##_PIN)
  1351. #define HAS_FAN1 _HAS_FAN(1)
  1352. #define HAS_FAN2 _HAS_FAN(2)
  1353. #define HAS_FAN3 _HAS_FAN(3)
  1354. #define HAS_FAN4 _HAS_FAN(4)
  1355. #define HAS_FAN5 _HAS_FAN(5)
  1356. #define HAS_FAN6 _HAS_FAN(6)
  1357. #define HAS_FAN7 _HAS_FAN(7)
  1358. #define HAS_CONTROLLER_FAN (PIN_EXISTS(CONTROLLER_FAN))
  1359. // Servos
  1360. #define HAS_SERVO_0 (PIN_EXISTS(SERVO0) && NUM_SERVOS > 0)
  1361. #define HAS_SERVO_1 (PIN_EXISTS(SERVO1) && NUM_SERVOS > 1)
  1362. #define HAS_SERVO_2 (PIN_EXISTS(SERVO2) && NUM_SERVOS > 2)
  1363. #define HAS_SERVO_3 (PIN_EXISTS(SERVO3) && NUM_SERVOS > 3)
  1364. #define HAS_SERVOS (NUM_SERVOS > 0)
  1365. // Sensors
  1366. #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
  1367. // User Interface
  1368. #define HAS_HOME (PIN_EXISTS(HOME))
  1369. #define HAS_KILL (PIN_EXISTS(KILL))
  1370. #define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
  1371. #define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
  1372. #define HAS_BUZZER (PIN_EXISTS(BEEPER) || EITHER(LCD_USE_I2C_BUZZER, PCA9632_BUZZER))
  1373. #define USE_BEEPER (HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER, PCA9632_BUZZER))
  1374. #define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE))
  1375. // Digital control
  1376. #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
  1377. #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
  1378. #define HAS_MOTOR_CURRENT_PWM ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_E)
  1379. #define HAS_SOME_Z_MICROSTEPS (HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_Z4_MICROSTEPS)
  1380. #define HAS_SOME_E_MICROSTEPS (HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS || HAS_E6_MICROSTEPS || HAS_E7_MICROSTEPS)
  1381. #define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MICROSTEPS)
  1382. #if HAS_MICROSTEPS
  1383. // MS1 MS2 MS3 Stepper Driver Microstepping mode table
  1384. #ifndef MICROSTEP1
  1385. #define MICROSTEP1 LOW,LOW,LOW
  1386. #endif
  1387. #if ENABLED(HEROIC_STEPPER_DRIVERS)
  1388. #ifndef MICROSTEP128
  1389. #define MICROSTEP128 LOW,HIGH,LOW
  1390. #endif
  1391. #else
  1392. #ifndef MICROSTEP2
  1393. #define MICROSTEP2 HIGH,LOW,LOW
  1394. #endif
  1395. #ifndef MICROSTEP4
  1396. #define MICROSTEP4 LOW,HIGH,LOW
  1397. #endif
  1398. #endif
  1399. #ifndef MICROSTEP8
  1400. #define MICROSTEP8 HIGH,HIGH,LOW
  1401. #endif
  1402. #ifdef __SAM3X8E__
  1403. #if MB(ALLIGATOR)
  1404. #ifndef MICROSTEP16
  1405. #define MICROSTEP16 LOW,LOW,LOW
  1406. #endif
  1407. #ifndef MICROSTEP32
  1408. #define MICROSTEP32 HIGH,HIGH,LOW
  1409. #endif
  1410. #else
  1411. #ifndef MICROSTEP16
  1412. #define MICROSTEP16 HIGH,HIGH,LOW
  1413. #endif
  1414. #endif
  1415. #else
  1416. #ifndef MICROSTEP16
  1417. #define MICROSTEP16 HIGH,HIGH,LOW
  1418. #endif
  1419. #endif
  1420. #define HAS_MICROSTEP1 defined(MICROSTEP1)
  1421. #define HAS_MICROSTEP2 defined(MICROSTEP2)
  1422. #define HAS_MICROSTEP4 defined(MICROSTEP4)
  1423. #define HAS_MICROSTEP8 defined(MICROSTEP8)
  1424. #define HAS_MICROSTEP16 defined(MICROSTEP16)
  1425. #define HAS_MICROSTEP32 defined(MICROSTEP32)
  1426. #define HAS_MICROSTEP64 defined(MICROSTEP64)
  1427. #define HAS_MICROSTEP128 defined(MICROSTEP128)
  1428. #endif // HAS_MICROSTEPS
  1429. /**
  1430. * Heater signal inversion defaults
  1431. */
  1432. #if HAS_HEATER_0 && !defined(HEATER_0_INVERTING)
  1433. #define HEATER_0_INVERTING false
  1434. #endif
  1435. #if HAS_HEATER_1 && !defined(HEATER_1_INVERTING)
  1436. #define HEATER_1_INVERTING false
  1437. #endif
  1438. #if HAS_HEATER_2 && !defined(HEATER_2_INVERTING)
  1439. #define HEATER_2_INVERTING false
  1440. #endif
  1441. #if HAS_HEATER_3 && !defined(HEATER_3_INVERTING)
  1442. #define HEATER_3_INVERTING false
  1443. #endif
  1444. #if HAS_HEATER_4 && !defined(HEATER_4_INVERTING)
  1445. #define HEATER_4_INVERTING false
  1446. #endif
  1447. #if HAS_HEATER_5 && !defined(HEATER_5_INVERTING)
  1448. #define HEATER_5_INVERTING false
  1449. #endif
  1450. #if HAS_HEATER_6 && !defined(HEATER_6_INVERTING)
  1451. #define HEATER_6_INVERTING false
  1452. #endif
  1453. #if HAS_HEATER_7 && !defined(HEATER_7_INVERTING)
  1454. #define HEATER_7_INVERTING false
  1455. #endif
  1456. /**
  1457. * Helper Macros for heaters and extruder fan
  1458. */
  1459. #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
  1460. #if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
  1461. #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, (v) ^ HEATER_1_INVERTING)
  1462. #if HOTENDS > 2
  1463. #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, (v) ^ HEATER_2_INVERTING)
  1464. #if HOTENDS > 3
  1465. #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, (v) ^ HEATER_3_INVERTING)
  1466. #if HOTENDS > 4
  1467. #define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, (v) ^ HEATER_4_INVERTING)
  1468. #if HOTENDS > 5
  1469. #define WRITE_HEATER_5(v) WRITE(HEATER_5_PIN, (v) ^ HEATER_5_INVERTING)
  1470. #if HOTENDS > 6
  1471. #define WRITE_HEATER_6(v) WRITE(HEATER_6_PIN, (v) ^ HEATER_6_INVERTING)
  1472. #if HOTENDS > 7
  1473. #define WRITE_HEATER_7(v) WRITE(HEATER_7_PIN, (v) ^ HEATER_7_INVERTING)
  1474. #endif // HOTENDS > 7
  1475. #endif // HOTENDS > 6
  1476. #endif // HOTENDS > 5
  1477. #endif // HOTENDS > 4
  1478. #endif // HOTENDS > 3
  1479. #endif // HOTENDS > 2
  1480. #endif // HOTENDS > 1
  1481. #if ENABLED(HEATERS_PARALLEL)
  1482. #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
  1483. #else
  1484. #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
  1485. #endif
  1486. #ifndef MIN_POWER
  1487. #define MIN_POWER 0
  1488. #endif
  1489. /**
  1490. * Heated bed requires settings
  1491. */
  1492. #if HAS_HEATED_BED
  1493. #ifndef MIN_BED_POWER
  1494. #define MIN_BED_POWER 0
  1495. #endif
  1496. #ifndef MAX_BED_POWER
  1497. #define MAX_BED_POWER 255
  1498. #endif
  1499. #ifndef HEATER_BED_INVERTING
  1500. #define HEATER_BED_INVERTING false
  1501. #endif
  1502. #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, (v) ^ HEATER_BED_INVERTING)
  1503. #endif
  1504. /**
  1505. * Heated chamber requires settings
  1506. */
  1507. #if HAS_HEATED_CHAMBER
  1508. #ifndef MAX_CHAMBER_POWER
  1509. #define MAX_CHAMBER_POWER 255
  1510. #endif
  1511. #ifndef HEATER_CHAMBER_INVERTING
  1512. #define HEATER_CHAMBER_INVERTING false
  1513. #endif
  1514. #define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING)
  1515. #endif
  1516. /**
  1517. * Up to 3 PWM fans
  1518. */
  1519. #ifndef FAN_INVERTING
  1520. #define FAN_INVERTING false
  1521. #endif
  1522. #if HAS_FAN7
  1523. #define FAN_COUNT 8
  1524. #elif HAS_FAN6
  1525. #define FAN_COUNT 7
  1526. #elif HAS_FAN5
  1527. #define FAN_COUNT 6
  1528. #elif HAS_FAN4
  1529. #define FAN_COUNT 5
  1530. #elif HAS_FAN3
  1531. #define FAN_COUNT 4
  1532. #elif HAS_FAN2
  1533. #define FAN_COUNT 3
  1534. #elif HAS_FAN1
  1535. #define FAN_COUNT 2
  1536. #elif HAS_FAN0
  1537. #define FAN_COUNT 1
  1538. #else
  1539. #define FAN_COUNT 0
  1540. #endif
  1541. #if FAN_COUNT > 0
  1542. #define WRITE_FAN(n, v) WRITE(FAN##n##_PIN, (v) ^ FAN_INVERTING)
  1543. #endif
  1544. /**
  1545. * Part Cooling fan multipliexer
  1546. */
  1547. #define HAS_FANMUX PIN_EXISTS(FANMUX0)
  1548. /**
  1549. * MIN/MAX fan PWM scaling
  1550. */
  1551. #ifndef FAN_OFF_PWM
  1552. #define FAN_OFF_PWM 0
  1553. #endif
  1554. #ifndef FAN_MIN_PWM
  1555. #if FAN_OFF_PWM > 0
  1556. #define FAN_MIN_PWM (FAN_OFF_PWM + 1)
  1557. #else
  1558. #define FAN_MIN_PWM 0
  1559. #endif
  1560. #endif
  1561. #ifndef FAN_MAX_PWM
  1562. #define FAN_MAX_PWM 255
  1563. #endif
  1564. #if FAN_MIN_PWM < 0 || FAN_MIN_PWM > 255
  1565. #error "FAN_MIN_PWM must be a value from 0 to 255."
  1566. #elif FAN_MAX_PWM < 0 || FAN_MAX_PWM > 255
  1567. #error "FAN_MAX_PWM must be a value from 0 to 255."
  1568. #elif FAN_MIN_PWM > FAN_MAX_PWM
  1569. #error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM."
  1570. #elif FAN_OFF_PWM > FAN_MIN_PWM
  1571. #error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
  1572. #endif
  1573. /**
  1574. * FAST PWM FAN Settings
  1575. */
  1576. #if ENABLED(FAST_PWM_FAN) && !defined(FAST_PWM_FAN_FREQUENCY)
  1577. #define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default
  1578. #endif
  1579. /**
  1580. * MIN/MAX case light PWM scaling
  1581. */
  1582. #if HAS_CASE_LIGHT
  1583. #ifndef CASE_LIGHT_MAX_PWM
  1584. #define CASE_LIGHT_MAX_PWM 255
  1585. #elif !WITHIN(CASE_LIGHT_MAX_PWM, 1, 255)
  1586. #error "CASE_LIGHT_MAX_PWM must be a value from 1 to 255."
  1587. #endif
  1588. #endif
  1589. /**
  1590. * Bed Probe dependencies
  1591. */
  1592. #if HAS_BED_PROBE
  1593. #if ENABLED(ENDSTOPPULLUPS) && HAS_Z_MIN_PROBE_PIN
  1594. #define ENDSTOPPULLUP_ZMIN_PROBE
  1595. #endif
  1596. #ifndef Z_PROBE_OFFSET_RANGE_MIN
  1597. #define Z_PROBE_OFFSET_RANGE_MIN -20
  1598. #endif
  1599. #ifndef Z_PROBE_OFFSET_RANGE_MAX
  1600. #define Z_PROBE_OFFSET_RANGE_MAX 20
  1601. #endif
  1602. #ifndef XY_PROBE_SPEED
  1603. #ifdef HOMING_FEEDRATE_XY
  1604. #define XY_PROBE_SPEED HOMING_FEEDRATE_XY
  1605. #else
  1606. #define XY_PROBE_SPEED 4000
  1607. #endif
  1608. #endif
  1609. #ifndef NOZZLE_TO_PROBE_OFFSET
  1610. #define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 }
  1611. #endif
  1612. #else
  1613. #undef NOZZLE_TO_PROBE_OFFSET
  1614. #endif
  1615. /**
  1616. * XYZ Bed Skew Correction
  1617. */
  1618. #if ENABLED(SKEW_CORRECTION)
  1619. #define SKEW_FACTOR_MIN -1
  1620. #define SKEW_FACTOR_MAX 1
  1621. #define _GET_SIDE(a,b,c) (SQRT(2*sq(a)+2*sq(b)-4*sq(c))*0.5)
  1622. #define _SKEW_SIDE(a,b,c) tan(M_PI*0.5-acos((sq(a)-sq(b)-sq(c))/(2*c*b)))
  1623. #define _SKEW_FACTOR(a,b,c) _SKEW_SIDE(float(a),_GET_SIDE(float(a),float(b),float(c)),float(c))
  1624. #ifndef XY_SKEW_FACTOR
  1625. #if defined(XY_DIAG_AC) && defined(XY_DIAG_BD) && defined(XY_SIDE_AD)
  1626. #define XY_SKEW_FACTOR _SKEW_FACTOR(XY_DIAG_AC, XY_DIAG_BD, XY_SIDE_AD)
  1627. #else
  1628. #define XY_SKEW_FACTOR 0.0
  1629. #endif
  1630. #endif
  1631. #ifndef XZ_SKEW_FACTOR
  1632. #if defined(XY_SIDE_AD) && !defined(XZ_SIDE_AD)
  1633. #define XZ_SIDE_AD XY_SIDE_AD
  1634. #endif
  1635. #if defined(XZ_DIAG_AC) && defined(XZ_DIAG_BD) && defined(XZ_SIDE_AD)
  1636. #define XZ_SKEW_FACTOR _SKEW_FACTOR(XZ_DIAG_AC, XZ_DIAG_BD, XZ_SIDE_AD)
  1637. #else
  1638. #define XZ_SKEW_FACTOR 0.0
  1639. #endif
  1640. #endif
  1641. #ifndef YZ_SKEW_FACTOR
  1642. #if defined(YZ_DIAG_AC) && defined(YZ_DIAG_BD) && defined(YZ_SIDE_AD)
  1643. #define YZ_SKEW_FACTOR _SKEW_FACTOR(YZ_DIAG_AC, YZ_DIAG_BD, YZ_SIDE_AD)
  1644. #else
  1645. #define YZ_SKEW_FACTOR 0.0
  1646. #endif
  1647. #endif
  1648. #endif // SKEW_CORRECTION
  1649. /**
  1650. * Set granular options based on the specific type of leveling
  1651. */
  1652. #define UBL_SEGMENTED BOTH(AUTO_BED_LEVELING_UBL, DELTA)
  1653. #define ABL_PLANAR EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
  1654. #define ABL_GRID EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
  1655. #define HAS_ABL_NOT_UBL (ABL_PLANAR || ABL_GRID)
  1656. #define HAS_ABL_OR_UBL (HAS_ABL_NOT_UBL || ENABLED(AUTO_BED_LEVELING_UBL))
  1657. #define HAS_LEVELING (HAS_ABL_OR_UBL || ENABLED(MESH_BED_LEVELING))
  1658. #define HAS_AUTOLEVEL (HAS_ABL_OR_UBL && DISABLED(PROBE_MANUALLY))
  1659. #define HAS_MESH ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
  1660. #define PLANNER_LEVELING (HAS_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL))
  1661. #define HAS_PROBING_PROCEDURE (HAS_ABL_OR_UBL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
  1662. #define HAS_POSITION_MODIFIERS (ENABLED(FWRETRACT) || HAS_LEVELING || ENABLED(SKEW_CORRECTION))
  1663. #define NEEDS_THREE_PROBE_POINTS EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
  1664. #if ENABLED(AUTO_BED_LEVELING_UBL)
  1665. #undef LCD_BED_LEVELING
  1666. #endif
  1667. /**
  1668. * Heater, Fan, and Probe interactions
  1669. */
  1670. #if FAN_COUNT == 0
  1671. #undef PROBING_FANS_OFF
  1672. #undef ADAPTIVE_FAN_SLOWING
  1673. #undef NO_FAN_SLOWING_IN_PID_TUNING
  1674. #endif
  1675. #define QUIET_PROBING (HAS_BED_PROBE && (EITHER(PROBING_HEATERS_OFF, PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0))
  1676. #define HEATER_IDLE_HANDLER EITHER(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF)
  1677. #if ENABLED(ADVANCED_PAUSE_FEATURE) && !defined(FILAMENT_CHANGE_SLOW_LOAD_LENGTH)
  1678. #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0
  1679. #endif
  1680. #if EXTRUDERS > 1 && !defined(TOOLCHANGE_FIL_EXTRA_PRIME)
  1681. #define TOOLCHANGE_FIL_EXTRA_PRIME 0
  1682. #endif
  1683. /**
  1684. * Only constrain Z on DELTA / SCARA machines
  1685. */
  1686. #if IS_KINEMATIC
  1687. #undef MIN_SOFTWARE_ENDSTOP_X
  1688. #undef MIN_SOFTWARE_ENDSTOP_Y
  1689. #undef MAX_SOFTWARE_ENDSTOP_X
  1690. #undef MAX_SOFTWARE_ENDSTOP_Y
  1691. #endif
  1692. /**
  1693. * Bed Probing bounds
  1694. */
  1695. #ifndef MIN_PROBE_EDGE
  1696. #define MIN_PROBE_EDGE 0
  1697. #endif
  1698. #if IS_KINEMATIC
  1699. #undef MIN_PROBE_EDGE_LEFT
  1700. #undef MIN_PROBE_EDGE_RIGHT
  1701. #undef MIN_PROBE_EDGE_FRONT
  1702. #undef MIN_PROBE_EDGE_BACK
  1703. #define MIN_PROBE_EDGE_LEFT 0
  1704. #define MIN_PROBE_EDGE_RIGHT 0
  1705. #define MIN_PROBE_EDGE_FRONT 0
  1706. #define MIN_PROBE_EDGE_BACK 0
  1707. #else
  1708. #ifndef MIN_PROBE_EDGE_LEFT
  1709. #define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE
  1710. #endif
  1711. #ifndef MIN_PROBE_EDGE_RIGHT
  1712. #define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE
  1713. #endif
  1714. #ifndef MIN_PROBE_EDGE_FRONT
  1715. #define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE
  1716. #endif
  1717. #ifndef MIN_PROBE_EDGE_BACK
  1718. #define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE
  1719. #endif
  1720. #endif
  1721. #if ENABLED(DELTA)
  1722. /**
  1723. * Delta radius/rod trimmers/angle trimmers
  1724. */
  1725. #ifndef DELTA_ENDSTOP_ADJ
  1726. #define DELTA_ENDSTOP_ADJ { 0, 0, 0 }
  1727. #endif
  1728. #ifndef DELTA_TOWER_ANGLE_TRIM
  1729. #define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 }
  1730. #endif
  1731. #ifndef DELTA_RADIUS_TRIM_TOWER
  1732. #define DELTA_RADIUS_TRIM_TOWER { 0, 0, 0 }
  1733. #endif
  1734. #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER
  1735. #define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0, 0, 0 }
  1736. #endif
  1737. #endif
  1738. #if ENABLED(SEGMENT_LEVELED_MOVES) && !defined(LEVELED_SEGMENT_LENGTH)
  1739. #define LEVELED_SEGMENT_LENGTH 5
  1740. #endif
  1741. /**
  1742. * Default mesh area is an area with an inset margin on the print area.
  1743. */
  1744. #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
  1745. #if IS_KINEMATIC
  1746. // Probing points may be verified at compile time within the radius
  1747. // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!")
  1748. // so that may be added to SanityCheck.h in the future.
  1749. #define _MESH_MIN_X (X_MIN_BED + MESH_INSET)
  1750. #define _MESH_MIN_Y (Y_MIN_BED + MESH_INSET)
  1751. #define _MESH_MAX_X (X_MAX_BED - (MESH_INSET))
  1752. #define _MESH_MAX_Y (Y_MAX_BED - (MESH_INSET))
  1753. #else
  1754. // Boundaries for Cartesian probing based on set limits
  1755. #define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS)) // UBL is careful not to probe off the bed. It does not
  1756. #define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS)) // need NOZZLE_TO_PROBE_OFFSET in the mesh dimensions
  1757. #define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS))
  1758. #define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS))
  1759. #endif
  1760. // These may be overridden in Configuration.h if a smaller area is desired
  1761. #ifndef MESH_MIN_X
  1762. #define MESH_MIN_X _MESH_MIN_X
  1763. #endif
  1764. #ifndef MESH_MIN_Y
  1765. #define MESH_MIN_Y _MESH_MIN_Y
  1766. #endif
  1767. #ifndef MESH_MAX_X
  1768. #define MESH_MAX_X _MESH_MAX_X
  1769. #endif
  1770. #ifndef MESH_MAX_Y
  1771. #define MESH_MAX_Y _MESH_MAX_Y
  1772. #endif
  1773. #else
  1774. #undef MESH_MIN_X
  1775. #undef MESH_MIN_Y
  1776. #undef MESH_MAX_X
  1777. #undef MESH_MAX_Y
  1778. #endif
  1779. #if (defined(PROBE_PT_1_X) && defined(PROBE_PT_2_X) && defined(PROBE_PT_3_X) && defined(PROBE_PT_1_Y) && defined(PROBE_PT_2_Y) && defined(PROBE_PT_3_Y))
  1780. #define HAS_FIXED_3POINT
  1781. #endif
  1782. /**
  1783. * Buzzer/Speaker
  1784. */
  1785. #if ENABLED(LCD_USE_I2C_BUZZER)
  1786. #ifndef LCD_FEEDBACK_FREQUENCY_HZ
  1787. #define LCD_FEEDBACK_FREQUENCY_HZ 1000
  1788. #endif
  1789. #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
  1790. #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
  1791. #endif
  1792. #elif HAS_BUZZER
  1793. #ifndef LCD_FEEDBACK_FREQUENCY_HZ
  1794. #define LCD_FEEDBACK_FREQUENCY_HZ 5000
  1795. #endif
  1796. #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
  1797. #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
  1798. #endif
  1799. #endif
  1800. /**
  1801. * Make sure DOGLCD_SCK and DOGLCD_MOSI are defined.
  1802. */
  1803. #if HAS_GRAPHICAL_LCD
  1804. #ifndef DOGLCD_SCK
  1805. #define DOGLCD_SCK SCK_PIN
  1806. #endif
  1807. #ifndef DOGLCD_MOSI
  1808. #define DOGLCD_MOSI MOSI_PIN
  1809. #endif
  1810. #endif
  1811. /**
  1812. * Z_HOMING_HEIGHT / Z_CLEARANCE_BETWEEN_PROBES
  1813. */
  1814. #ifndef Z_HOMING_HEIGHT
  1815. #ifndef Z_CLEARANCE_BETWEEN_PROBES
  1816. #define Z_HOMING_HEIGHT 0
  1817. #else
  1818. #define Z_HOMING_HEIGHT Z_CLEARANCE_BETWEEN_PROBES
  1819. #endif
  1820. #endif
  1821. #if PROBE_SELECTED
  1822. #ifndef Z_CLEARANCE_BETWEEN_PROBES
  1823. #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT
  1824. #endif
  1825. #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT
  1826. #define MANUAL_PROBE_HEIGHT Z_CLEARANCE_BETWEEN_PROBES
  1827. #else
  1828. #define MANUAL_PROBE_HEIGHT Z_HOMING_HEIGHT
  1829. #endif
  1830. #ifndef Z_CLEARANCE_MULTI_PROBE
  1831. #define Z_CLEARANCE_MULTI_PROBE Z_CLEARANCE_BETWEEN_PROBES
  1832. #endif
  1833. #if ENABLED(BLTOUCH) && !defined(BLTOUCH_DELAY)
  1834. #define BLTOUCH_DELAY 500
  1835. #endif
  1836. #endif
  1837. #ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation
  1838. #undef UI_VOLTAGE_LEVEL
  1839. #undef RADDS_DISPLAY
  1840. #undef MOTOR_CURRENT
  1841. #endif
  1842. // Updated G92 behavior shifts the workspace
  1843. #define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS)
  1844. // The home offset also shifts the coordinate space
  1845. #define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_CARTESIAN)
  1846. // The SCARA home offset applies only on G28
  1847. #define HAS_SCARA_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_SCARA)
  1848. // Cumulative offset to workspace to save some calculation
  1849. #define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT && HAS_HOME_OFFSET)
  1850. // M206 sets the home offset for Cartesian machines
  1851. #define HAS_M206_COMMAND (HAS_HOME_OFFSET && !IS_SCARA)
  1852. // LCD timeout to status screen default is 15s
  1853. #ifndef LCD_TIMEOUT_TO_STATUS
  1854. #define LCD_TIMEOUT_TO_STATUS 15000
  1855. #endif
  1856. // Add commands that need sub-codes to this list
  1857. #if ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY)
  1858. #define USE_GCODE_SUBCODES
  1859. #endif
  1860. // Parking Extruder
  1861. #if ENABLED(PARKING_EXTRUDER)
  1862. #ifndef PARKING_EXTRUDER_GRAB_DISTANCE
  1863. #define PARKING_EXTRUDER_GRAB_DISTANCE 0
  1864. #endif
  1865. #ifndef PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
  1866. #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE HIGH
  1867. #endif
  1868. #endif
  1869. // Number of VFAT entries used. Each entry has 13 UTF-16 characters
  1870. #if ENABLED(SCROLL_LONG_FILENAMES)
  1871. #define MAX_VFAT_ENTRIES (5)
  1872. #else
  1873. #define MAX_VFAT_ENTRIES (2)
  1874. #endif
  1875. // Nozzle park for Delta
  1876. #if BOTH(NOZZLE_PARK_FEATURE, DELTA)
  1877. #undef NOZZLE_PARK_Z_FEEDRATE
  1878. #define NOZZLE_PARK_Z_FEEDRATE NOZZLE_PARK_XY_FEEDRATE
  1879. #endif
  1880. // Force SDCARD_SORT_ALPHA to be enabled for Graphical LCD on LPC1768
  1881. // on boards where SD card and LCD display share the same SPI bus
  1882. // because of a bug in the shared SPI implementation. (See #8122)
  1883. #if defined(TARGET_LPC1768) && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && (SCK_PIN == LCD_PINS_D4)
  1884. #define SDCARD_SORT_ALPHA // Keeps one directory level in RAM. Changing
  1885. // directory levels still glitches the screen,
  1886. // but the following LCD update cleans it up.
  1887. #undef SDSORT_LIMIT
  1888. #undef SDSORT_USES_RAM
  1889. #undef SDSORT_USES_STACK
  1890. #undef SDSORT_CACHE_NAMES
  1891. #define SDSORT_LIMIT 64
  1892. #define SDSORT_USES_RAM true
  1893. #define SDSORT_USES_STACK false
  1894. #define SDSORT_CACHE_NAMES true
  1895. #ifndef FOLDER_SORTING
  1896. #define FOLDER_SORTING -1
  1897. #endif
  1898. #ifndef SDSORT_GCODE
  1899. #define SDSORT_GCODE false
  1900. #endif
  1901. #ifndef SDSORT_DYNAMIC_RAM
  1902. #define SDSORT_DYNAMIC_RAM false
  1903. #endif
  1904. #ifndef SDSORT_CACHE_VFATS
  1905. #define SDSORT_CACHE_VFATS 2
  1906. #endif
  1907. #endif
  1908. // Defined here to catch the above defines
  1909. #if ENABLED(SDCARD_SORT_ALPHA) && (FOLDER_SORTING || ENABLED(SDSORT_GCODE))
  1910. #define HAS_FOLDER_SORTING 1
  1911. #endif
  1912. #if HAS_SPI_LCD
  1913. // Get LCD character width/height, which may be overridden by pins, configs, etc.
  1914. #ifndef LCD_WIDTH
  1915. #if HAS_GRAPHICAL_LCD
  1916. #define LCD_WIDTH 21
  1917. #elif ENABLED(ULTIPANEL)
  1918. #define LCD_WIDTH 20
  1919. #else
  1920. #define LCD_WIDTH 16
  1921. #endif
  1922. #endif
  1923. #ifndef LCD_HEIGHT
  1924. #if HAS_GRAPHICAL_LCD
  1925. #define LCD_HEIGHT 5
  1926. #elif ENABLED(ULTIPANEL)
  1927. #define LCD_HEIGHT 4
  1928. #else
  1929. #define LCD_HEIGHT 2
  1930. #endif
  1931. #endif
  1932. #endif
  1933. #if ENABLED(SDSUPPORT)
  1934. #if SD_CONNECTION_IS(ONBOARD) && DISABLED(NO_SD_HOST_DRIVE) && !defined(ARDUINO_GRAND_CENTRAL_M4)
  1935. //
  1936. // The external SD card is not used. Hardware SPI is used to access the card.
  1937. // When sharing the SD card with a PC we want the menu options to
  1938. // mount/unmount the card and refresh it. So we disable card detect.
  1939. //
  1940. #undef SD_DETECT_PIN
  1941. #define SHARED_SD_CARD
  1942. #endif
  1943. #if DISABLED(SHARED_SD_CARD)
  1944. #define INIT_SDCARD_ON_BOOT
  1945. #endif
  1946. #endif