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.

SanityCheck.h 147KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325
  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. * SanityCheck.h
  25. *
  26. * Test configuration values for errors at compile-time.
  27. */
  28. /**
  29. * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features.
  30. */
  31. #if __cplusplus < 201103L
  32. #error "Marlin requires C++11 support (gcc >= 4.7, Arduino IDE >= 1.6.8). Please upgrade your toolchain."
  33. #endif
  34. // Make sure macros aren't borked
  35. #define TEST1
  36. #define TEST2 1
  37. #define TEST3 0
  38. #define TEST4 true
  39. #if ENABLED(TEST0) || !ENABLED(TEST2) || ENABLED(TEST3)
  40. #error "ENABLED is borked!"
  41. #endif
  42. #if BOTH(TEST0, TEST1)
  43. #error "BOTH is borked!"
  44. #endif
  45. #if DISABLED(TEST1) || !DISABLED(TEST3) || DISABLED(TEST4) || DISABLED(TEST0, TEST1, TEST2, TEST4) || !DISABLED(TEST0, TEST3)
  46. #error "DISABLED is borked!"
  47. #endif
  48. #if !ANY(TEST1, TEST2, TEST3, TEST4) || ANY(TEST0, TEST3)
  49. #error "ANY is borked!"
  50. #endif
  51. #if NONE(TEST0, TEST1, TEST2, TEST4) || !NONE(TEST0, TEST3)
  52. #error "NONE is borked!"
  53. #endif
  54. #undef TEST1
  55. #undef TEST2
  56. #undef TEST3
  57. #undef TEST4
  58. /**
  59. * We try our best to include sanity checks for all changed configuration
  60. * directives because users have a tendency to use outdated config files with
  61. * the bleeding-edge source code, but sometimes this is not enough. This check
  62. * forces a minimum config file revision. Otherwise Marlin will not build.
  63. */
  64. #define HEXIFY(H) _CAT(0x,H)
  65. #if !defined(CONFIGURATION_H_VERSION) || HEXIFY(CONFIGURATION_H_VERSION) < HEXIFY(REQUIRED_CONFIGURATION_H_VERSION)
  66. #error "You are using an old Configuration.h file, update it before building Marlin."
  67. #endif
  68. #if !defined(CONFIGURATION_ADV_H_VERSION) || HEXIFY(CONFIGURATION_ADV_H_VERSION) < HEXIFY(REQUIRED_CONFIGURATION_ADV_H_VERSION)
  69. #error "You are using an old Configuration_adv.h file, update it before building Marlin."
  70. #endif
  71. #undef HEXIFY
  72. /**
  73. * Warnings for old configurations
  74. */
  75. #ifndef MOTHERBOARD
  76. #error "MOTHERBOARD is required."
  77. #elif !defined(X_BED_SIZE) || !defined(Y_BED_SIZE)
  78. #error "X_BED_SIZE and Y_BED_SIZE are now required!"
  79. #elif WATCH_TEMP_PERIOD > 500
  80. #error "WATCH_TEMP_PERIOD now uses seconds instead of milliseconds."
  81. #elif DISABLED(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD))
  82. #error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS."
  83. #elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
  84. #error "Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED."
  85. #elif (CORE_IS_XZ || CORE_IS_YZ) && ENABLED(Z_LATE_ENABLE)
  86. #error "Z_LATE_ENABLE can't be used with COREXZ, COREZX, COREYZ, or COREZY."
  87. #elif defined(X_HOME_RETRACT_MM)
  88. #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
  89. #elif defined(SDCARDDETECTINVERTED)
  90. #error "SDCARDDETECTINVERTED is now SD_DETECT_STATE (HIGH)."
  91. #elif defined(SD_DETECT_INVERTED)
  92. #error "SD_DETECT_INVERTED is now SD_DETECT_STATE (HIGH)."
  93. #elif defined(BTENABLED)
  94. #error "BTENABLED is now BLUETOOTH."
  95. #elif defined(CUSTOM_MENDEL_NAME)
  96. #error "CUSTOM_MENDEL_NAME is now CUSTOM_MACHINE_NAME."
  97. #elif defined(HAS_AUTOMATIC_VERSIONING)
  98. #error "HAS_AUTOMATIC_VERSIONING is now CUSTOM_VERSION_FILE."
  99. #elif defined(USE_AUTOMATIC_VERSIONING)
  100. #error "USE_AUTOMATIC_VERSIONING is now CUSTOM_VERSION_FILE."
  101. #elif defined(SDSLOW)
  102. #error "SDSLOW deprecated. Set SPI_SPEED to SPI_HALF_SPEED instead."
  103. #elif defined(SDEXTRASLOW)
  104. #error "SDEXTRASLOW deprecated. Set SPI_SPEED to SPI_QUARTER_SPEED instead."
  105. #elif defined(FILAMENT_SENSOR)
  106. #error "FILAMENT_SENSOR is now FILAMENT_WIDTH_SENSOR."
  107. #elif defined(ENDSTOPPULLUP_FIL_RUNOUT)
  108. #error "ENDSTOPPULLUP_FIL_RUNOUT is now FIL_RUNOUT_PULLUP."
  109. #elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS)
  110. #error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated. Use individual USE_*_PLUG options instead."
  111. #elif defined(LANGUAGE_INCLUDE)
  112. #error "LANGUAGE_INCLUDE has been replaced by LCD_LANGUAGE."
  113. #elif defined(EXTRUDER_OFFSET_X) || defined(EXTRUDER_OFFSET_Y)
  114. #error "EXTRUDER_OFFSET_[XY] is deprecated. Use HOTEND_OFFSET_[XY] instead."
  115. #elif defined(PID_PARAMS_PER_EXTRUDER)
  116. #error "PID_PARAMS_PER_EXTRUDER is deprecated. Use PID_PARAMS_PER_HOTEND instead."
  117. #elif defined(EXTRUDER_WATTS) || defined(BED_WATTS)
  118. #error "EXTRUDER_WATTS and BED_WATTS are deprecated and should be removed."
  119. #elif defined(SERVO_ENDSTOP_ANGLES)
  120. #error "SERVO_ENDSTOP_ANGLES is deprecated. Use Z_SERVO_ANGLES instead."
  121. #elif defined(X_ENDSTOP_SERVO_NR) || defined(Y_ENDSTOP_SERVO_NR)
  122. #error "X_ENDSTOP_SERVO_NR and Y_ENDSTOP_SERVO_NR are deprecated and should be removed."
  123. #elif defined(Z_ENDSTOP_SERVO_NR)
  124. #error "Z_ENDSTOP_SERVO_NR is now Z_PROBE_SERVO_NR."
  125. #elif defined(DEFAULT_XYJERK)
  126. #error "DEFAULT_XYJERK is deprecated. Use DEFAULT_XJERK and DEFAULT_YJERK instead."
  127. #elif defined(XY_TRAVEL_SPEED)
  128. #error "XY_TRAVEL_SPEED is deprecated. Use XY_PROBE_SPEED instead."
  129. #elif defined(PROBE_SERVO_DEACTIVATION_DELAY)
  130. #error "PROBE_SERVO_DEACTIVATION_DELAY is deprecated. Use DEACTIVATE_SERVOS_AFTER_MOVE instead."
  131. #elif defined(SERVO_DEACTIVATION_DELAY)
  132. #error "SERVO_DEACTIVATION_DELAY is now SERVO_DELAY."
  133. #elif ENABLED(FILAMENTCHANGEENABLE)
  134. #error "FILAMENTCHANGEENABLE is now ADVANCED_PAUSE_FEATURE."
  135. #elif ENABLED(FILAMENT_CHANGE_FEATURE)
  136. #error "FILAMENT_CHANGE_FEATURE is now ADVANCED_PAUSE_FEATURE."
  137. #elif defined(FILAMENT_CHANGE_X_POS) || defined(FILAMENT_CHANGE_Y_POS)
  138. #error "FILAMENT_CHANGE_[XY]_POS is now set with NOZZLE_PARK_POINT."
  139. #elif defined(FILAMENT_CHANGE_Z_ADD)
  140. #error "FILAMENT_CHANGE_Z_ADD is now set with NOZZLE_PARK_POINT."
  141. #elif defined(FILAMENT_CHANGE_XY_FEEDRATE)
  142. #error "FILAMENT_CHANGE_XY_FEEDRATE is now NOZZLE_PARK_XY_FEEDRATE."
  143. #elif defined(FILAMENT_CHANGE_Z_FEEDRATE)
  144. #error "FILAMENT_CHANGE_Z_FEEDRATE is now NOZZLE_PARK_Z_FEEDRATE."
  145. #elif defined(PAUSE_PARK_X_POS) || defined(PAUSE_PARK_Y_POS)
  146. #error "PAUSE_PARK_[XY]_POS is now set with NOZZLE_PARK_POINT."
  147. #elif defined(PAUSE_PARK_Z_ADD)
  148. #error "PAUSE_PARK_Z_ADD is now set with NOZZLE_PARK_POINT."
  149. #elif defined(PAUSE_PARK_XY_FEEDRATE)
  150. #error "PAUSE_PARK_XY_FEEDRATE is now NOZZLE_PARK_XY_FEEDRATE."
  151. #elif defined(PAUSE_PARK_Z_FEEDRATE)
  152. #error "PAUSE_PARK_Z_FEEDRATE is now NOZZLE_PARK_Z_FEEDRATE."
  153. #elif defined(FILAMENT_CHANGE_RETRACT_FEEDRATE)
  154. #error "FILAMENT_CHANGE_RETRACT_FEEDRATE is now PAUSE_PARK_RETRACT_FEEDRATE."
  155. #elif defined(FILAMENT_CHANGE_RETRACT_LENGTH)
  156. #error "FILAMENT_CHANGE_RETRACT_LENGTH is now PAUSE_PARK_RETRACT_LENGTH."
  157. #elif defined(FILAMENT_CHANGE_EXTRUDE_FEEDRATE)
  158. #error "FILAMENT_CHANGE_EXTRUDE_FEEDRATE is now ADVANCED_PAUSE_PURGE_FEEDRATE."
  159. #elif defined(ADVANCED_PAUSE_EXTRUDE_FEEDRATE)
  160. #error "ADVANCED_PAUSE_EXTRUDE_FEEDRATE is now ADVANCED_PAUSE_PURGE_FEEDRATE."
  161. #elif defined(FILAMENT_CHANGE_EXTRUDE_LENGTH)
  162. #error "FILAMENT_CHANGE_EXTRUDE_LENGTH is now ADVANCED_PAUSE_PURGE_LENGTH."
  163. #elif defined(ADVANCED_PAUSE_EXTRUDE_LENGTH)
  164. #error "ADVANCED_PAUSE_EXTRUDE_LENGTH is now ADVANCED_PAUSE_PURGE_LENGTH."
  165. #elif defined(FILAMENT_CHANGE_NOZZLE_TIMEOUT)
  166. #error "FILAMENT_CHANGE_NOZZLE_TIMEOUT is now PAUSE_PARK_NOZZLE_TIMEOUT."
  167. #elif defined(FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS)
  168. #error "FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS is now FILAMENT_CHANGE_ALERT_BEEPS."
  169. #elif defined(FILAMENT_CHANGE_NO_STEPPER_TIMEOUT)
  170. #error "FILAMENT_CHANGE_NO_STEPPER_TIMEOUT is now PAUSE_PARK_NO_STEPPER_TIMEOUT."
  171. #elif defined(PLA_PREHEAT_HOTEND_TEMP)
  172. #error "PLA_PREHEAT_HOTEND_TEMP is now PREHEAT_1_TEMP_HOTEND."
  173. #elif defined(PLA_PREHEAT_HPB_TEMP)
  174. #error "PLA_PREHEAT_HPB_TEMP is now PREHEAT_1_TEMP_BED."
  175. #elif defined(PLA_PREHEAT_FAN_SPEED)
  176. #error "PLA_PREHEAT_FAN_SPEED is now PREHEAT_1_FAN_SPEED."
  177. #elif defined(ABS_PREHEAT_HOTEND_TEMP)
  178. #error "ABS_PREHEAT_HOTEND_TEMP is now PREHEAT_2_TEMP_HOTEND."
  179. #elif defined(ABS_PREHEAT_HPB_TEMP)
  180. #error "ABS_PREHEAT_HPB_TEMP is now PREHEAT_2_TEMP_BED."
  181. #elif defined(ABS_PREHEAT_FAN_SPEED)
  182. #error "ABS_PREHEAT_FAN_SPEED is now PREHEAT_2_FAN_SPEED."
  183. #elif defined(ENDSTOPS_ONLY_FOR_HOMING)
  184. #error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
  185. #elif defined(HOMING_FEEDRATE)
  186. #error "HOMING_FEEDRATE is now set using the HOMING_FEEDRATE_MM_M array instead."
  187. #elif defined(HOMING_FEEDRATE_XY) || defined(HOMING_FEEDRATE_Z)
  188. #error "HOMING_FEEDRATE_XY and HOMING_FEEDRATE_Z are now set using the HOMING_FEEDRATE_MM_M array instead."
  189. #elif defined(MANUAL_HOME_POSITIONS)
  190. #error "MANUAL_HOME_POSITIONS is deprecated. Set MANUAL_[XYZ]_HOME_POS as-needed instead."
  191. #elif defined(PID_ADD_EXTRUSION_RATE)
  192. #error "PID_ADD_EXTRUSION_RATE is now PID_EXTRUSION_SCALING and is DISABLED by default."
  193. #elif defined(Z_RAISE_BEFORE_HOMING)
  194. #error "Z_RAISE_BEFORE_HOMING is now Z_HOMING_HEIGHT."
  195. #elif defined(MIN_Z_HEIGHT_FOR_HOMING)
  196. #error "MIN_Z_HEIGHT_FOR_HOMING is now Z_HOMING_HEIGHT."
  197. #elif defined(Z_RAISE_BEFORE_PROBING) || defined(Z_RAISE_AFTER_PROBING)
  198. #error "Z_RAISE_(BEFORE|AFTER)_PROBING are deprecated. Use Z_CLEARANCE_DEPLOY_PROBE and Z_AFTER_PROBING instead."
  199. #elif defined(Z_RAISE_PROBE_DEPLOY_STOW) || defined(Z_RAISE_BETWEEN_PROBINGS)
  200. #error "Z_RAISE_PROBE_DEPLOY_STOW and Z_RAISE_BETWEEN_PROBINGS are now Z_CLEARANCE_DEPLOY_PROBE and Z_CLEARANCE_BETWEEN_PROBES."
  201. #elif defined(Z_PROBE_DEPLOY_HEIGHT) || defined(Z_PROBE_TRAVEL_HEIGHT)
  202. #error "Z_PROBE_DEPLOY_HEIGHT and Z_PROBE_TRAVEL_HEIGHT are now Z_CLEARANCE_DEPLOY_PROBE and Z_CLEARANCE_BETWEEN_PROBES."
  203. #elif defined(MANUAL_BED_LEVELING)
  204. #error "MANUAL_BED_LEVELING is now LCD_BED_LEVELING."
  205. #elif defined(MESH_HOME_SEARCH_Z)
  206. #error "MESH_HOME_SEARCH_Z is now LCD_PROBE_Z_RANGE."
  207. #elif defined(MANUAL_PROBE_Z_RANGE)
  208. #error "MANUAL_PROBE_Z_RANGE is now LCD_PROBE_Z_RANGE."
  209. #elif !defined(MIN_STEPS_PER_SEGMENT)
  210. #error "Please replace 'const int dropsegments' with '#define MIN_STEPS_PER_SEGMENT' (and increase by 1)."
  211. #elif MIN_STEPS_PER_SEGMENT <= 0
  212. #error "MIN_STEPS_PER_SEGMENT must be at least 1."
  213. #elif defined(PREVENT_DANGEROUS_EXTRUDE)
  214. #error "PREVENT_DANGEROUS_EXTRUDE is now PREVENT_COLD_EXTRUSION."
  215. #elif defined(SCARA)
  216. #error "SCARA is now MORGAN_SCARA."
  217. #elif defined(ENABLE_AUTO_BED_LEVELING)
  218. #error "ENABLE_AUTO_BED_LEVELING is deprecated. Specify AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_3POINT."
  219. #elif defined(AUTO_BED_LEVELING_FEATURE)
  220. #error "AUTO_BED_LEVELING_FEATURE is deprecated. Specify AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_3POINT."
  221. #elif defined(ABL_GRID_POINTS)
  222. #error "ABL_GRID_POINTS is now GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y."
  223. #elif defined(ABL_GRID_POINTS_X) || defined(ABL_GRID_POINTS_Y)
  224. #error "ABL_GRID_POINTS_[XY] is now GRID_MAX_POINTS_[XY]."
  225. #elif defined(ABL_GRID_MAX_POINTS_X) || defined(ABL_GRID_MAX_POINTS_Y)
  226. #error "ABL_GRID_MAX_POINTS_[XY] is now GRID_MAX_POINTS_[XY]."
  227. #elif defined(MESH_NUM_X_POINTS) || defined(MESH_NUM_Y_POINTS)
  228. #error "MESH_NUM_[XY]_POINTS is now GRID_MAX_POINTS_[XY]."
  229. #elif defined(UBL_MESH_NUM_X_POINTS) || defined(UBL_MESH_NUM_Y_POINTS)
  230. #error "UBL_MESH_NUM_[XY]_POINTS is now GRID_MAX_POINTS_[XY]."
  231. #elif defined(UBL_G26_MESH_VALIDATION)
  232. #error "UBL_G26_MESH_VALIDATION is now G26_MESH_VALIDATION."
  233. #elif defined(UBL_MESH_EDIT_ENABLED)
  234. #error "UBL_MESH_EDIT_ENABLED is now G26_MESH_VALIDATION."
  235. #elif defined(UBL_MESH_EDITING)
  236. #error "UBL_MESH_EDITING is now G26_MESH_VALIDATION."
  237. #elif defined(BLTOUCH_HEATERS_OFF)
  238. #error "BLTOUCH_HEATERS_OFF is now PROBING_HEATERS_OFF."
  239. #elif defined(BLTOUCH_V3)
  240. #error "BLTOUCH_V3 is obsolete."
  241. #elif defined(BLTOUCH_FORCE_OPEN_DRAIN_MODE)
  242. #error "BLTOUCH_FORCE_OPEN_DRAIN_MODE is obsolete."
  243. #elif defined(BEEPER)
  244. #error "BEEPER is now BEEPER_PIN."
  245. #elif defined(SDCARDDETECT)
  246. #error "SDCARDDETECT is now SD_DETECT_PIN."
  247. #elif defined(STAT_LED_RED) || defined(STAT_LED_BLUE)
  248. #error "STAT_LED_RED/STAT_LED_BLUE are now STAT_LED_RED_PIN/STAT_LED_BLUE_PIN."
  249. #elif defined(LCD_PIN_BL)
  250. #error "LCD_PIN_BL is now LCD_BACKLIGHT_PIN."
  251. #elif defined(LCD_PIN_RESET)
  252. #error "LCD_PIN_RESET is now LCD_RESET_PIN."
  253. #elif defined(EXTRUDER_0_AUTO_FAN_PIN) || defined(EXTRUDER_1_AUTO_FAN_PIN) || defined(EXTRUDER_2_AUTO_FAN_PIN) || defined(EXTRUDER_3_AUTO_FAN_PIN)
  254. #error "EXTRUDER_[0123]_AUTO_FAN_PIN is now E[0123]_AUTO_FAN_PIN."
  255. #elif defined(PID_FAN_SCALING) && !HAS_FAN
  256. #error "PID_FAN_SCALING needs at least one fan enabled."
  257. #elif defined(min_software_endstops) || defined(max_software_endstops)
  258. #error "(min|max)_software_endstops are now (MIN|MAX)_SOFTWARE_ENDSTOPS."
  259. #elif ENABLED(Z_PROBE_SLED) && defined(SLED_PIN)
  260. #error "Replace SLED_PIN with SOL1_PIN (applies to both Z_PROBE_SLED and SOLENOID_PROBE)."
  261. #elif defined(CONTROLLERFAN_PIN)
  262. #error "CONTROLLERFAN_PIN is now CONTROLLER_FAN_PIN, enabled with USE_CONTROLLER_FAN."
  263. #elif defined(CONTROLLERFAN_SPEED)
  264. #error "CONTROLLERFAN_SPEED is now CONTROLLERFAN_SPEED_ACTIVE."
  265. #elif defined(CONTROLLERFAN_SECS)
  266. #error "CONTROLLERFAN_SECS is now CONTROLLERFAN_IDLE_TIME."
  267. #elif defined(MIN_RETRACT)
  268. #error "MIN_RETRACT is now MIN_AUTORETRACT and MAX_AUTORETRACT."
  269. #elif defined(ADVANCE)
  270. #error "ADVANCE is now LIN_ADVANCE."
  271. #elif defined(LIN_ADVANCE_E_D_RATIO)
  272. #error "LIN_ADVANCE (1.5) no longer uses LIN_ADVANCE_E_D_RATIO."
  273. #elif defined(NEOPIXEL_RGBW_LED)
  274. #error "NEOPIXEL_RGBW_LED is now NEOPIXEL_LED."
  275. #elif ENABLED(DELTA) && defined(DELTA_PROBEABLE_RADIUS)
  276. #error "Remove DELTA_PROBEABLE_RADIUS and use PROBING_MARGIN to inset the probe area instead."
  277. #elif ENABLED(DELTA) && defined(DELTA_CALIBRATION_RADIUS)
  278. #error "Remove DELTA_CALIBRATION_RADIUS and use PROBING_MARGIN to inset the probe area instead."
  279. #elif defined(UBL_MESH_INSET)
  280. #error "UBL_MESH_INSET is now just MESH_INSET."
  281. #elif defined(UBL_MESH_MIN_X) || defined(UBL_MESH_MIN_Y) || defined(UBL_MESH_MAX_X) || defined(UBL_MESH_MAX_Y)
  282. #error "UBL_MESH_(MIN|MAX)_[XY] is now just MESH_(MIN|MAX)_[XY]."
  283. #elif defined(ABL_PROBE_PT_1_X) || defined(ABL_PROBE_PT_1_Y) || defined(ABL_PROBE_PT_2_X) || defined(ABL_PROBE_PT_2_Y) || defined(ABL_PROBE_PT_3_X) || defined(ABL_PROBE_PT_3_Y)
  284. #error "ABL_PROBE_PT_[123]_[XY] is no longer required. Please remove it."
  285. #elif defined(UBL_PROBE_PT_1_X) || defined(UBL_PROBE_PT_1_Y) || defined(UBL_PROBE_PT_2_X) || defined(UBL_PROBE_PT_2_Y) || defined(UBL_PROBE_PT_3_X) || defined(UBL_PROBE_PT_3_Y)
  286. #error "UBL_PROBE_PT_[123]_[XY] is no longer required. Please remove it."
  287. #elif defined(MIN_PROBE_EDGE)
  288. #error "MIN_PROBE_EDGE is now called PROBING_MARGIN."
  289. #elif defined(MIN_PROBE_EDGE_LEFT)
  290. #error "MIN_PROBE_EDGE_LEFT is now called PROBING_MARGIN_LEFT."
  291. #elif defined(MIN_PROBE_EDGE_RIGHT)
  292. #error "MIN_PROBE_EDGE_RIGHT is now called PROBING_MARGIN_RIGHT."
  293. #elif defined(MIN_PROBE_EDGE_FRONT)
  294. #error "MIN_PROBE_EDGE_FRONT is now called PROBING_MARGIN_FRONT."
  295. #elif defined(MIN_PROBE_EDGE_BACK)
  296. #error "MIN_PROBE_EDGE_BACK is now called PROBING_MARGIN_BACK."
  297. #elif defined(LEFT_PROBE_BED_POSITION)
  298. #error "LEFT_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_LEFT instead."
  299. #elif defined(RIGHT_PROBE_BED_POSITION)
  300. #error "RIGHT_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_RIGHT instead."
  301. #elif defined(FRONT_PROBE_BED_POSITION)
  302. #error "FRONT_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_FRONT instead."
  303. #elif defined(BACK_PROBE_BED_POSITION)
  304. #error "BACK_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_BACK instead."
  305. #elif defined(ENABLE_MESH_EDIT_GFX_OVERLAY)
  306. #error "ENABLE_MESH_EDIT_GFX_OVERLAY is now MESH_EDIT_GFX_OVERLAY."
  307. #elif defined(BABYSTEP_ZPROBE_GFX_REVERSE)
  308. #error "BABYSTEP_ZPROBE_GFX_REVERSE is now set by OVERLAY_GFX_REVERSE."
  309. #elif defined(UBL_GRANULAR_SEGMENTATION_FOR_CARTESIAN)
  310. #error "UBL_GRANULAR_SEGMENTATION_FOR_CARTESIAN is now SEGMENT_LEVELED_MOVES."
  311. #elif HAS_PID_HEATING && (defined(K1) || !defined(PID_K1))
  312. #error "K1 is now PID_K1."
  313. #elif defined(PROBE_DOUBLE_TOUCH)
  314. #error "PROBE_DOUBLE_TOUCH is now MULTIPLE_PROBING."
  315. #elif defined(ANET_KEYPAD_LCD)
  316. #error "ANET_KEYPAD_LCD is now ZONESTAR_LCD."
  317. #elif defined(LCD_I2C_SAINSMART_YWROBOT)
  318. #error "LCD_I2C_SAINSMART_YWROBOT is now LCD_SAINSMART_I2C_(1602|2004)."
  319. #elif defined(MEASURED_LOWER_LIMIT) || defined(MEASURED_UPPER_LIMIT)
  320. #error "MEASURED_(UPPER|LOWER)_LIMIT is now FILWIDTH_ERROR_MARGIN."
  321. #elif defined(HAVE_TMCDRIVER)
  322. #error "HAVE_TMCDRIVER is now [AXIS]_DRIVER_TYPE TMC26X."
  323. #elif defined(STEALTHCHOP)
  324. #error "STEALTHCHOP is now STEALTHCHOP_(XY|Z|E)."
  325. #elif defined(HAVE_TMC26X)
  326. #error "HAVE_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X."
  327. #elif defined(HAVE_TMC2130)
  328. #error "HAVE_TMC2130 is now [AXIS]_DRIVER_TYPE TMC2130."
  329. #elif defined(HAVE_TMC2208)
  330. #error "HAVE_TMC2208 is now [AXIS]_DRIVER_TYPE TMC2208."
  331. #elif defined(HAVE_L6470DRIVER)
  332. #error "HAVE_L6470DRIVER is now [AXIS]_DRIVER_TYPE L6470."
  333. #elif defined(X_IS_TMC) || defined(X2_IS_TMC) || defined(Y_IS_TMC) || defined(Y2_IS_TMC) || defined(Z_IS_TMC) || defined(Z2_IS_TMC) || defined(Z3_IS_TMC) \
  334. || defined(E0_IS_TMC) || defined(E1_IS_TMC) || defined(E2_IS_TMC) || defined(E3_IS_TMC) || defined(E4_IS_TMC) || defined(E5_IS_TMC) || defined(E6_IS_TMC) || defined(E7_IS_TMC)
  335. #error "[AXIS]_IS_TMC is now [AXIS]_DRIVER_TYPE TMC26X."
  336. #elif defined(X_IS_TMC26X) || defined(X2_IS_TMC26X) || defined(Y_IS_TMC26X) || defined(Y2_IS_TMC26X) || defined(Z_IS_TMC26X) || defined(Z2_IS_TMC26X) || defined(Z3_IS_TMC26X) \
  337. || defined(E0_IS_TMC26X) || defined(E1_IS_TMC26X) || defined(E2_IS_TMC26X) || defined(E3_IS_TMC26X) || defined(E4_IS_TMC26X) || defined(E5_IS_TMC26X) || defined(E6_IS_TMC26X) || defined(E7_IS_TMC26X)
  338. #error "[AXIS]_IS_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X."
  339. #elif defined(X_IS_TMC2130) || defined(X2_IS_TMC2130) || defined(Y_IS_TMC2130) || defined(Y2_IS_TMC2130) || defined(Z_IS_TMC2130) || defined(Z2_IS_TMC2130) || defined(Z3_IS_TMC2130) \
  340. || defined(E0_IS_TMC2130) || defined(E1_IS_TMC2130) || defined(E2_IS_TMC2130) || defined(E3_IS_TMC2130) || defined(E4_IS_TMC2130) || defined(E5_IS_TMC2130) || defined(E6_IS_TMC2130) || defined(E7_IS_TMC2130)
  341. #error "[AXIS]_IS_TMC2130 is now [AXIS]_DRIVER_TYPE TMC2130."
  342. #elif defined(X_IS_TMC2208) || defined(X2_IS_TMC2208) || defined(Y_IS_TMC2208) || defined(Y2_IS_TMC2208) || defined(Z_IS_TMC2208) || defined(Z2_IS_TMC2208) || defined(Z3_IS_TMC2208) \
  343. || defined(E0_IS_TMC2208) || defined(E1_IS_TMC2208) || defined(E2_IS_TMC2208) || defined(E3_IS_TMC2208) || defined(E4_IS_TMC2208) || defined(E5_IS_TMC2208) || defined(E6_IS_TMC2208) || defined(E7_IS_TMC2208)
  344. #error "[AXIS]_IS_TMC2208 is now [AXIS]_DRIVER_TYPE TMC2208."
  345. #elif defined(X_IS_L6470) || defined(X2_IS_L6470) || defined(Y_IS_L6470) || defined(Y2_IS_L6470) || defined(Z_IS_L6470) || defined(Z2_IS_L6470) || defined(Z3_IS_L6470) \
  346. || defined(E0_IS_L6470) || defined(E1_IS_L6470) || defined(E2_IS_L6470) || defined(E3_IS_L6470) || defined(E4_IS_L6470) || defined(E5_IS_L6470) || defined(E6_IS_L6470) || defined(E7_IS_L6470)
  347. #error "[AXIS]_IS_L6470 is now [AXIS]_DRIVER_TYPE L6470."
  348. #elif defined(AUTOMATIC_CURRENT_CONTROL)
  349. #error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS."
  350. #elif defined(FILAMENT_CHANGE_LOAD_LENGTH)
  351. #error "FILAMENT_CHANGE_LOAD_LENGTH is now FILAMENT_CHANGE_FAST_LOAD_LENGTH."
  352. #elif defined(LEVEL_CORNERS_INSET)
  353. #error "LEVEL_CORNERS_INSET is now LEVEL_CORNERS_INSET_LFRB."
  354. #elif ENABLED(LEVEL_BED_CORNERS) && !defined(LEVEL_CORNERS_INSET_LFRB)
  355. #error "LEVEL_BED_CORNERS requires LEVEL_CORNERS_INSET_LFRB values."
  356. #elif BOTH(LEVEL_CORNERS_USE_PROBE, SENSORLESS_PROBING)
  357. #error "LEVEL_CORNERS_USE_PROBE is incompatible with SENSORLESS_PROBING."
  358. #elif defined(BEZIER_JERK_CONTROL)
  359. #error "BEZIER_JERK_CONTROL is now S_CURVE_ACCELERATION."
  360. #elif HAS_JUNCTION_DEVIATION && defined(JUNCTION_DEVIATION_FACTOR)
  361. #error "JUNCTION_DEVIATION_FACTOR is now JUNCTION_DEVIATION_MM."
  362. #elif defined(JUNCTION_ACCELERATION_FACTOR)
  363. #error "JUNCTION_ACCELERATION_FACTOR is obsolete. Delete it from Configuration_adv.h."
  364. #elif defined(JUNCTION_ACCELERATION)
  365. #error "JUNCTION_ACCELERATION is obsolete. Delete it from Configuration_adv.h."
  366. #elif defined(MAX7219_DEBUG_STEPPER_HEAD)
  367. #error "MAX7219_DEBUG_STEPPER_HEAD is now MAX7219_DEBUG_PLANNER_HEAD."
  368. #elif defined(MAX7219_DEBUG_STEPPER_TAIL)
  369. #error "MAX7219_DEBUG_STEPPER_TAIL is now MAX7219_DEBUG_PLANNER_TAIL."
  370. #elif defined(MAX7219_DEBUG_STEPPER_QUEUE)
  371. #error "MAX7219_DEBUG_STEPPER_QUEUE is now MAX7219_DEBUG_PLANNER_QUEUE."
  372. #elif defined(ENDSTOP_NOISE_FILTER)
  373. #error "ENDSTOP_NOISE_FILTER is now ENDSTOP_NOISE_THRESHOLD [2-7]."
  374. #elif defined(RETRACT_ZLIFT)
  375. #error "RETRACT_ZLIFT is now RETRACT_ZRAISE."
  376. #elif defined(TOOLCHANGE_PARK_ZLIFT) || defined(TOOLCHANGE_UNPARK_ZLIFT)
  377. #error "TOOLCHANGE_PARK_ZLIFT and TOOLCHANGE_UNPARK_ZLIFT are now TOOLCHANGE_ZRAISE."
  378. #elif defined(SINGLENOZZLE_TOOLCHANGE_ZRAISE)
  379. #error "SINGLENOZZLE_TOOLCHANGE_ZRAISE is now TOOLCHANGE_ZRAISE."
  380. #elif defined(SINGLENOZZLE_SWAP_LENGTH)
  381. #error "SINGLENOZZLE_SWAP_LENGTH is now TOOLCHANGE_FIL_SWAP_LENGTH."
  382. #elif defined(SINGLENOZZLE_SWAP_RETRACT_SPEED)
  383. #error "SINGLENOZZLE_SWAP_RETRACT_SPEED is now TOOLCHANGE_FIL_SWAP_RETRACT_SPEED."
  384. #elif defined(SINGLENOZZLE_SWAP_PRIME_SPEED)
  385. #error "SINGLENOZZLE_SWAP_PRIME_SPEED is now TOOLCHANGE_FIL_SWAP_PRIME_SPEED."
  386. #elif defined(SINGLENOZZLE_SWAP_PARK)
  387. #error "SINGLENOZZLE_SWAP_PARK is now TOOLCHANGE_PARK."
  388. #elif defined(SINGLENOZZLE_TOOLCHANGE_XY)
  389. #error "SINGLENOZZLE_TOOLCHANGE_XY is now TOOLCHANGE_PARK_XY."
  390. #elif defined(SINGLENOZZLE_PARK_XY_FEEDRATE)
  391. #error "SINGLENOZZLE_PARK_XY_FEEDRATE is now TOOLCHANGE_PARK_XY_FEEDRATE."
  392. #elif defined(PARKING_EXTRUDER_SECURITY_RAISE)
  393. #error "PARKING_EXTRUDER_SECURITY_RAISE is now TOOLCHANGE_ZRAISE."
  394. #elif defined(SWITCHING_TOOLHEAD_SECURITY_RAISE)
  395. #error "SWITCHING_TOOLHEAD_SECURITY_RAISE is now TOOLCHANGE_ZRAISE."
  396. #elif defined(G0_FEEDRATE) && G0_FEEDRATE == 0
  397. #error "G0_FEEDRATE is now used to set the G0 feedrate."
  398. #elif defined(MBL_Z_STEP)
  399. #error "MBL_Z_STEP is now MESH_EDIT_Z_STEP."
  400. #elif defined(CHDK)
  401. #error "CHDK is now CHDK_PIN."
  402. #elif defined(MAX6675_SS) || defined(MAX6675_SS2)
  403. #error "MAX6675_SS / MAX6675_SS2 is now MAX6675_SS_PIN / MAX6675_SS2_PIN."
  404. #elif defined(MAX31865_SENSOR_OHMS)
  405. #error "MAX31865_SENSOR_OHMS is now MAX31865_SENSOR_OHMS_0."
  406. #elif defined(MAX31865_CALIBRATION_OHMS)
  407. #error "MAX31865_CALIBRATION_OHMS is now MAX31865_CALIBRATION_OHMS_0."
  408. #elif defined(SPINDLE_LASER_ENABLE)
  409. #error "SPINDLE_LASER_ENABLE is now SPINDLE_FEATURE or LASER_FEATURE."
  410. #elif defined(SPINDLE_LASER_ENABLE_PIN)
  411. #error "SPINDLE_LASER_ENABLE_PIN is now SPINDLE_LASER_ENA_PIN."
  412. #elif defined(SPINDLE_DIR_CHANGE)
  413. #error "SPINDLE_DIR_CHANGE is now SPINDLE_CHANGE_DIR."
  414. #elif defined(SPINDLE_STOP_ON_DIR_CHANGE)
  415. #error "SPINDLE_STOP_ON_DIR_CHANGE is now SPINDLE_CHANGE_DIR_STOP."
  416. #elif defined(SPINDLE_LASER_ACTIVE_HIGH)
  417. #error "SPINDLE_LASER_ACTIVE_HIGH is now SPINDLE_LASER_ACTIVE_STATE."
  418. #elif defined(SPINDLE_LASER_ENABLE_INVERT)
  419. #error "SPINDLE_LASER_ENABLE_INVERT is now SPINDLE_LASER_ACTIVE_STATE."
  420. #elif defined(CUTTER_POWER_DISPLAY)
  421. #error "CUTTER_POWER_DISPLAY is now CUTTER_POWER_UNIT."
  422. #elif defined(CHAMBER_HEATER_PIN)
  423. #error "CHAMBER_HEATER_PIN is now HEATER_CHAMBER_PIN."
  424. #elif defined(TMC_Z_CALIBRATION)
  425. #error "TMC_Z_CALIBRATION has been deprecated in favor of MECHANICAL_GANTRY_CALIBRATION."
  426. #elif defined(Z_MIN_PROBE_ENDSTOP)
  427. #error "Z_MIN_PROBE_ENDSTOP is no longer required. Please remove it."
  428. #elif defined(DUAL_NOZZLE_DUPLICATION_MODE)
  429. #error "DUAL_NOZZLE_DUPLICATION_MODE is now MULTI_NOZZLE_DUPLICATION."
  430. #elif defined(MENU_ITEM_CASE_LIGHT)
  431. #error "MENU_ITEM_CASE_LIGHT is now CASE_LIGHT_MENU."
  432. #elif defined(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
  433. #error "ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED is now SD_ABORT_ON_ENDSTOP_HIT."
  434. #elif defined(LPC_SD_LCD) || defined(LPC_SD_ONBOARD) || defined(LPC_SD_CUSTOM_CABLE)
  435. #error "LPC_SD_(LCD|ONBOARD|CUSTOM_CABLE) are now SDCARD_CONNECTION."
  436. #elif defined(USB_SD_DISABLED)
  437. #error "USB_SD_DISABLED is now NO_SD_HOST_DRIVE."
  438. #elif defined(USB_SD_ONBOARD)
  439. #error "USB_SD_ONBOARD is obsolete. Disable NO_SD_HOST_DRIVE instead."
  440. #elif defined(PSU_ACTIVE_HIGH)
  441. #error "PSU_ACTIVE_HIGH is now PSU_ACTIVE_STATE."
  442. #elif POWER_SUPPLY == 1
  443. #error "Replace POWER_SUPPLY 1 by enabling PSU_CONTROL and setting PSU_ACTIVE_STATE to 'LOW'."
  444. #elif POWER_SUPPLY == 2
  445. #error "Replace POWER_SUPPLY 2 by enabling PSU_CONTROL and setting PSU_ACTIVE_STATE to 'HIGH'."
  446. #elif defined(POWER_SUPPLY)
  447. #error "POWER_SUPPLY is now obsolete. Please remove it."
  448. #elif defined(MKS_ROBIN_TFT)
  449. #error "MKS_ROBIN_TFT is now FSMC_GRAPHICAL_TFT."
  450. #elif defined(SDPOWER)
  451. #error "SDPOWER is now SDPOWER_PIN."
  452. #elif defined(STRING_SPLASH_LINE1) || defined(STRING_SPLASH_LINE2)
  453. #error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them."
  454. #elif defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_X) || defined(Z_PROBE_ALLEN_KEY_STOW_1_X)
  455. #error "Z_PROBE_ALLEN_KEY_(DEPLOY|STOW) coordinates are now a single setting."
  456. #elif defined(X_PROBE_OFFSET_FROM_EXTRUDER) || defined(Y_PROBE_OFFSET_FROM_EXTRUDER) || defined(Z_PROBE_OFFSET_FROM_EXTRUDER)
  457. #error "[XYZ]_PROBE_OFFSET_FROM_EXTRUDER is now NOZZLE_TO_PROBE_OFFSET."
  458. #elif defined(MIN_PROBE_X) || defined(MIN_PROBE_Y) || defined(MAX_PROBE_X) || defined(MAX_PROBE_Y)
  459. #error "(MIN|MAX)_PROBE_[XY] are now calculated at runtime. Please remove them."
  460. #elif defined(Z_STEPPER_ALIGN_X) || defined(Z_STEPPER_ALIGN_X)
  461. #error "Z_STEPPER_ALIGN_X and Z_STEPPER_ALIGN_Y are now combined as Z_STEPPER_ALIGN_XY."
  462. #elif defined(JUNCTION_DEVIATION)
  463. #error "JUNCTION_DEVIATION is no longer required. (See CLASSIC_JERK). Please remove it."
  464. #elif defined(BABYSTEP_MULTIPLICATOR)
  465. #error "BABYSTEP_MULTIPLICATOR is now BABYSTEP_MULTIPLICATOR_[XY|Z]."
  466. #elif defined(LULZBOT_TOUCH_UI)
  467. #error "LULZBOT_TOUCH_UI is now TOUCH_UI_FTDI_EVE."
  468. #elif defined(PS_DEFAULT_OFF)
  469. #error "PS_DEFAULT_OFF is now PSU_DEFAULT_OFF."
  470. #elif defined(FILAMENT_UNLOAD_RETRACT_LENGTH)
  471. #error "FILAMENT_UNLOAD_RETRACT_LENGTH is now FILAMENT_UNLOAD_PURGE_RETRACT."
  472. #elif defined(FILAMENT_UNLOAD_DELAY)
  473. #error "FILAMENT_UNLOAD_DELAY is now FILAMENT_UNLOAD_PURGE_DELAY."
  474. #elif defined(HOME_USING_SPREADCYCLE)
  475. #error "HOME_USING_SPREADCYCLE is now obsolete. Please remove it."
  476. #elif defined(DGUS_LCD)
  477. #error "DGUS_LCD is now DGUS_LCD_UI_(ORIGIN|FYSETC|HIPRECY)."
  478. #elif defined(DGUS_SERIAL_PORT)
  479. #error "DGUS_SERIAL_PORT is now LCD_SERIAL_PORT."
  480. #elif defined(DGUS_BAUDRATE)
  481. #error "DGUS_BAUDRATE is now LCD_BAUDRATE."
  482. #elif defined(DGUS_STATS_RX_BUFFER_OVERRUNS)
  483. #error "DGUS_STATS_RX_BUFFER_OVERRUNS is now STATS_RX_BUFFER_OVERRUNS."
  484. #elif defined(ANYCUBIC_LCD_SERIAL_PORT)
  485. #error "ANYCUBIC_LCD_SERIAL_PORT is now LCD_SERIAL_PORT."
  486. #elif defined(INTERNAL_SERIAL_PORT)
  487. #error "INTERNAL_SERIAL_PORT is now MMU2_SERIAL_PORT."
  488. #elif defined(X_DUAL_ENDSTOPS_ADJUSTMENT) || defined(Y_DUAL_ENDSTOPS_ADJUSTMENT) || defined(Z_DUAL_ENDSTOPS_ADJUSTMENT)
  489. #error "[XYZ]_DUAL_ENDSTOPS_ADJUSTMENT is now [XYZ]2_ENDSTOP_ADJUSTMENT."
  490. #elif defined(Z_TRIPLE_ENDSTOPS_ADJUSTMENT2) || defined(Z_TRIPLE_ENDSTOPS_ADJUSTMENT3)
  491. #error "Z_TRIPLE_ENDSTOPS_ADJUSTMENT[23] is now Z[23]_ENDSTOP_ADJUSTMENT."
  492. #elif defined(Z_QUAD_ENDSTOPS_ADJUSTMENT2) || defined(Z_QUAD_ENDSTOPS_ADJUSTMENT3) || defined(Z_QUAD_ENDSTOPS_ADJUSTMENT4)
  493. #error "Z_QUAD_ENDSTOPS_ADJUSTMENT[234] is now Z[234]_ENDSTOP_ADJUSTMENT."
  494. #elif defined(Z_DUAL_STEPPER_DRIVERS)
  495. #error "Z_DUAL_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 2."
  496. #elif defined(Z_TRIPLE_STEPPER_DRIVERS)
  497. #error "Z_TRIPLE_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 3."
  498. #elif defined(Z_QUAD_STEPPER_DRIVERS)
  499. #error "Z_QUAD_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 4."
  500. #elif defined(Z_DUAL_ENDSTOPS) || defined(Z_TRIPLE_ENDSTOPS) || defined(Z_QUAD_ENDSTOPS)
  501. #error "Z_(DUAL|TRIPLE|QUAD)_ENDSTOPS is now Z_MULTI_ENDSTOPS."
  502. #elif defined(DUGS_UI_MOVE_DIS_OPTION)
  503. #error "DUGS_UI_MOVE_DIS_OPTION is spelled DGUS_UI_MOVE_DIS_OPTION."
  504. #elif defined(ORIG_E0_AUTO_FAN_PIN) || defined(ORIG_E1_AUTO_FAN_PIN) || defined(ORIG_E2_AUTO_FAN_PIN) || defined(ORIG_E3_AUTO_FAN_PIN) || defined(ORIG_E4_AUTO_FAN_PIN) || defined(ORIG_E5_AUTO_FAN_PIN) || defined(ORIG_E6_AUTO_FAN_PIN) || defined(ORIG_E7_AUTO_FAN_PIN)
  505. #error "ORIG_Ex_AUTO_FAN_PIN is now just Ex_AUTO_FAN_PIN."
  506. #elif defined(ORIG_CHAMBER_AUTO_FAN_PIN)
  507. #error "ORIG_CHAMBER_AUTO_FAN_PIN is now just CHAMBER_AUTO_FAN_PIN."
  508. #elif defined(HOMING_BACKOFF_MM)
  509. #error "HOMING_BACKOFF_MM is now HOMING_BACKOFF_POST_MM."
  510. #elif defined(X_HOME_BUMP_MM) || defined(Y_HOME_BUMP_MM) || defined(Z_HOME_BUMP_MM)
  511. #error "[XYZ]_HOME_BUMP_MM is now HOMING_BUMP_MM."
  512. #elif defined(DIGIPOT_I2C)
  513. #error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018)."
  514. #elif defined(TOUCH_BUTTONS)
  515. #error "TOUCH_BUTTONS is now TOUCH_SCREEN."
  516. #elif defined(LCD_FULL_PIXEL_HEIGHT) || defined(LCD_FULL_PIXEL_WIDTH)
  517. #error "LCD_FULL_PIXEL_(WIDTH|HEIGHT) is deprecated and should be removed."
  518. #elif defined(FSMC_UPSCALE)
  519. #error "FSMC_UPSCALE is now GRAPHICAL_TFT_UPSCALE."
  520. #elif defined(ANYCUBIC_TFT_MODEL)
  521. #error "ANYCUBIC_TFT_MODEL is now ANYCUBIC_LCD_I3MEGA."
  522. #elif defined(EVENT_GCODE_SD_STOP)
  523. #error "EVENT_GCODE_SD_STOP is now EVENT_GCODE_SD_ABORT."
  524. #elif defined(GRAPHICAL_TFT_ROTATE_180)
  525. #error "GRAPHICAL_TFT_ROTATE_180 is now TFT_ROTATION set to TFT_ROTATE_180."
  526. #elif defined(PROBE_OFFSET_START)
  527. #error "PROBE_OFFSET_START is now PROBE_OFFSET_WIZARD_START_Z."
  528. #elif defined(POWER_LOSS_PULL)
  529. #error "POWER_LOSS_PULL is now specifically POWER_LOSS_PULL(UP|DOWN)."
  530. #elif defined(SHORT_MANUAL_Z_MOVE)
  531. #error "SHORT_MANUAL_Z_MOVE is now FINE_MANUAL_MOVE, applying to Z on most printers."
  532. #elif defined(FIL_RUNOUT_INVERTING)
  533. #if FIL_RUNOUT_INVERTING
  534. #error "FIL_RUNOUT_INVERTING true is now FIL_RUNOUT_STATE HIGH."
  535. #else
  536. #error "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW."
  537. #endif
  538. #endif
  539. /**
  540. * Probe temp compensation requirements
  541. */
  542. #if ENABLED(PROBE_TEMP_COMPENSATION)
  543. #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z)
  544. #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)."
  545. #elif !defined(PTC_PARK_POS)
  546. #error "PROBE_TEMP_COMPENSATION requires PTC_PARK_POS."
  547. #elif defined(PTC_PROBE_POS_X) || defined(PTC_PROBE_POS_Y)
  548. #error "PTC_PROBE_POS_[XY] is now PTC_PROBE_POS (array)."
  549. #elif !defined(PTC_PROBE_POS)
  550. #error "PROBE_TEMP_COMPENSATION requires PTC_PROBE_POS."
  551. #endif
  552. #endif
  553. /**
  554. * Marlin release, version and default string
  555. */
  556. #ifndef SHORT_BUILD_VERSION
  557. #error "SHORT_BUILD_VERSION must be specified."
  558. #elif !defined(DETAILED_BUILD_VERSION)
  559. #error "BUILD_VERSION must be specified."
  560. #elif !defined(STRING_DISTRIBUTION_DATE)
  561. #error "STRING_DISTRIBUTION_DATE must be specified."
  562. #elif !defined(PROTOCOL_VERSION)
  563. #error "PROTOCOL_VERSION must be specified."
  564. #elif !defined(MACHINE_NAME)
  565. #error "MACHINE_NAME must be specified."
  566. #elif !defined(SOURCE_CODE_URL)
  567. #error "SOURCE_CODE_URL must be specified."
  568. #elif !defined(DEFAULT_MACHINE_UUID)
  569. #error "DEFAULT_MACHINE_UUID must be specified."
  570. #elif !defined(WEBSITE_URL)
  571. #error "WEBSITE_URL must be specified."
  572. #endif
  573. /**
  574. * Serial
  575. */
  576. #ifndef SERIAL_PORT
  577. #error "SERIAL_PORT must be defined."
  578. #elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
  579. #error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT."
  580. #elif defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == SERIAL_PORT
  581. #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT."
  582. #elif defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == SERIAL_PORT_2
  583. #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2."
  584. #endif
  585. #if !(defined(__AVR__) && defined(USBCON))
  586. #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
  587. #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
  588. #elif RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE))
  589. #error "RX_BUFFER_SIZE must be a power of 2 greater than 1."
  590. #elif TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
  591. #error "TX_BUFFER_SIZE must be 0 or a power of 2 between 1 and 256."
  592. #endif
  593. #elif ANY(SERIAL_XON_XOFF, SERIAL_STATS_MAX_RX_QUEUED, SERIAL_STATS_DROPPED_RX)
  594. #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
  595. #endif
  596. /**
  597. * Multiple Stepper Drivers Per Axis
  598. */
  599. #define GOOD_AXIS_PINS(A) (HAS_##A##_ENABLE && HAS_##A##_STEP && HAS_##A##_DIR)
  600. #if ENABLED(X_DUAL_STEPPER_DRIVERS)
  601. #if ENABLED(DUAL_X_CARRIAGE)
  602. #error "DUAL_X_CARRIAGE is not compatible with X_DUAL_STEPPER_DRIVERS."
  603. #elif !GOOD_AXIS_PINS(X)
  604. #error "X_DUAL_STEPPER_DRIVERS requires X2 pins to be defined."
  605. #endif
  606. #endif
  607. #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !GOOD_AXIS_PINS(Y)
  608. #error "Y_DUAL_STEPPER_DRIVERS requires Y2 pins to be defined."
  609. #elif !WITHIN(NUM_Z_STEPPER_DRIVERS, 1, 4)
  610. #error "NUM_Z_STEPPER_DRIVERS must be an integer from 1 to 4."
  611. #elif NUM_Z_STEPPER_DRIVERS == 2 && !GOOD_AXIS_PINS(Z2)
  612. #error "If NUM_Z_STEPPER_DRIVERS is 2, you must define stepper pins for Z2."
  613. #elif NUM_Z_STEPPER_DRIVERS == 3 && !(GOOD_AXIS_PINS(Z2) && GOOD_AXIS_PINS(Z3))
  614. #error "If NUM_Z_STEPPER_DRIVERS is 3, you must define stepper pins for Z2 and Z3."
  615. #elif NUM_Z_STEPPER_DRIVERS == 4 && !(GOOD_AXIS_PINS(Z2) && GOOD_AXIS_PINS(Z3) && GOOD_AXIS_PINS(Z4))
  616. #error "If NUM_Z_STEPPER_DRIVERS is 4, you must define stepper pins for Z2, Z3, and Z4."
  617. #endif
  618. /**
  619. * Validate that the bed size fits
  620. */
  621. static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS) are too narrow to contain X_BED_SIZE.");
  622. static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE.");
  623. /**
  624. * Granular software endstops (Marlin >= 1.1.7)
  625. */
  626. #if ENABLED(MIN_SOFTWARE_ENDSTOPS) && DISABLED(MIN_SOFTWARE_ENDSTOP_Z)
  627. #if IS_KINEMATIC
  628. #error "MIN_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MIN_SOFTWARE_ENDSTOP_Z."
  629. #elif NONE(MIN_SOFTWARE_ENDSTOP_X, MIN_SOFTWARE_ENDSTOP_Y)
  630. #error "MIN_SOFTWARE_ENDSTOPS requires at least one of the MIN_SOFTWARE_ENDSTOP_[XYZ] options."
  631. #endif
  632. #endif
  633. #if ENABLED(MAX_SOFTWARE_ENDSTOPS) && DISABLED(MAX_SOFTWARE_ENDSTOP_Z)
  634. #if IS_KINEMATIC
  635. #error "MAX_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MAX_SOFTWARE_ENDSTOP_Z."
  636. #elif NONE(MAX_SOFTWARE_ENDSTOP_X, MAX_SOFTWARE_ENDSTOP_Y)
  637. #error "MAX_SOFTWARE_ENDSTOPS requires at least one of the MAX_SOFTWARE_ENDSTOP_[XYZ] options."
  638. #endif
  639. #endif
  640. #if !defined(TARGET_LPC1768) && ANY( \
  641. ENDSTOPPULLDOWNS, \
  642. ENDSTOPPULLDOWN_XMAX, ENDSTOPPULLDOWN_YMAX, \
  643. ENDSTOPPULLDOWN_ZMAX, ENDSTOPPULLDOWN_XMIN, \
  644. ENDSTOPPULLDOWN_YMIN, ENDSTOPPULLDOWN_ZMIN \
  645. )
  646. #error "PULLDOWN pin mode is not available on the selected board."
  647. #endif
  648. #if BOTH(ENDSTOPPULLUPS, ENDSTOPPULLDOWNS)
  649. #error "Enable only one of ENDSTOPPULLUPS or ENDSTOPPULLDOWNS."
  650. #elif BOTH(FIL_RUNOUT_PULLUP, FIL_RUNOUT_PULLDOWN)
  651. #error "Enable only one of FIL_RUNOUT_PULLUP or FIL_RUNOUT_PULLDOWN."
  652. #elif BOTH(ENDSTOPPULLUP_XMAX, ENDSTOPPULLDOWN_XMAX)
  653. #error "Enable only one of ENDSTOPPULLUP_X_MAX or ENDSTOPPULLDOWN_X_MAX."
  654. #elif BOTH(ENDSTOPPULLUP_YMAX, ENDSTOPPULLDOWN_YMAX)
  655. #error "Enable only one of ENDSTOPPULLUP_Y_MAX or ENDSTOPPULLDOWN_Y_MAX."
  656. #elif BOTH(ENDSTOPPULLUP_ZMAX, ENDSTOPPULLDOWN_ZMAX)
  657. #error "Enable only one of ENDSTOPPULLUP_Z_MAX or ENDSTOPPULLDOWN_Z_MAX."
  658. #elif BOTH(ENDSTOPPULLUP_XMIN, ENDSTOPPULLDOWN_XMIN)
  659. #error "Enable only one of ENDSTOPPULLUP_X_MIN or ENDSTOPPULLDOWN_X_MIN."
  660. #elif BOTH(ENDSTOPPULLUP_YMIN, ENDSTOPPULLDOWN_YMIN)
  661. #error "Enable only one of ENDSTOPPULLUP_Y_MIN or ENDSTOPPULLDOWN_Y_MIN."
  662. #elif BOTH(ENDSTOPPULLUP_ZMIN, ENDSTOPPULLDOWN_ZMIN)
  663. #error "Enable only one of ENDSTOPPULLUP_Z_MIN or ENDSTOPPULLDOWN_Z_MIN."
  664. #endif
  665. /**
  666. * LCD Info Screen Style
  667. */
  668. #if LCD_INFO_SCREEN_STYLE > 0
  669. #if HAS_MARLINUI_U8GLIB || LCD_WIDTH < 20 || LCD_HEIGHT < 4
  670. #error "Alternative LCD_INFO_SCREEN_STYLE requires 20x4 Character LCD."
  671. #elif LCD_INFO_SCREEN_STYLE > 1
  672. #error "LCD_INFO_SCREEN_STYLE only has options 0 and 1 at this time."
  673. #endif
  674. #endif
  675. /**
  676. * Progress Bar
  677. */
  678. #if ENABLED(LCD_PROGRESS_BAR)
  679. #if NONE(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
  680. #error "LCD_PROGRESS_BAR requires SDSUPPORT or LCD_SET_PROGRESS_MANUALLY."
  681. #elif NONE(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
  682. #error "LCD_PROGRESS_BAR only applies to HD44780 character LCD and TFTGLCD_PANEL_(SPI|I2C)."
  683. #elif HAS_MARLINUI_U8GLIB
  684. #error "LCD_PROGRESS_BAR does not apply to graphical displays."
  685. #elif ENABLED(FILAMENT_LCD_DISPLAY)
  686. #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
  687. #elif PROGRESS_MSG_EXPIRE < 0
  688. #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
  689. #endif
  690. #elif ENABLED(LCD_SET_PROGRESS_MANUALLY)
  691. #if NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI)
  692. #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, or EXTENSIBLE_UI."
  693. #endif
  694. #endif
  695. #if !HAS_LCD_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
  696. #error "SD_REPRINT_LAST_SELECTED_FILE currently requires a Marlin-native LCD menu."
  697. #endif
  698. /**
  699. * Custom Boot and Status screens
  700. */
  701. #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) && NONE(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE)
  702. #error "SHOW_CUSTOM_BOOTSCREEN requires Graphical LCD or TOUCH_UI_FTDI_EVE."
  703. #elif ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) && !HAS_MARLINUI_U8GLIB
  704. #error "CUSTOM_STATUS_SCREEN_IMAGE requires a Graphical LCD."
  705. #endif
  706. /**
  707. * LCD Lightweight Screen Style
  708. */
  709. #if ENABLED(LIGHTWEIGHT_UI) && DISABLED(U8GLIB_ST7920)
  710. #error "LIGHTWEIGHT_UI requires a U8GLIB_ST7920-based display."
  711. #endif
  712. /**
  713. * SD File Sorting
  714. */
  715. #if ENABLED(SDCARD_SORT_ALPHA)
  716. #if SDSORT_LIMIT > 256
  717. #error "SDSORT_LIMIT must be 256 or smaller."
  718. #elif SDSORT_LIMIT < 10
  719. #error "SDSORT_LIMIT should be greater than 9 to be useful."
  720. #elif DISABLED(SDSORT_USES_RAM)
  721. #if ENABLED(SDSORT_DYNAMIC_RAM)
  722. #error "SDSORT_DYNAMIC_RAM requires SDSORT_USES_RAM (which reads the directory into RAM)."
  723. #elif ENABLED(SDSORT_CACHE_NAMES)
  724. #error "SDSORT_CACHE_NAMES requires SDSORT_USES_RAM (which reads the directory into RAM)."
  725. #endif
  726. #endif
  727. #if ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM)
  728. #if SDSORT_CACHE_VFATS < 2
  729. #error "SDSORT_CACHE_VFATS must be 2 or greater!"
  730. #elif SDSORT_CACHE_VFATS > MAX_VFAT_ENTRIES
  731. #undef SDSORT_CACHE_VFATS
  732. #define SDSORT_CACHE_VFATS MAX_VFAT_ENTRIES
  733. #warning "SDSORT_CACHE_VFATS was reduced to MAX_VFAT_ENTRIES!"
  734. #endif
  735. #endif
  736. #endif
  737. #if defined(EVENT_GCODE_SD_ABORT) && DISABLED(NOZZLE_PARK_FEATURE)
  738. static_assert(nullptr == strstr(EVENT_GCODE_SD_ABORT, "G27"), "NOZZLE_PARK_FEATURE is required to use G27 in EVENT_GCODE_SD_ABORT.");
  739. #endif
  740. /**
  741. * I2C Position Encoders
  742. */
  743. #if ENABLED(I2C_POSITION_ENCODERS)
  744. #if !BOTH(BABYSTEPPING, BABYSTEP_XY)
  745. #error "I2C_POSITION_ENCODERS requires BABYSTEPPING and BABYSTEP_XY."
  746. #elif !WITHIN(I2CPE_ENCODER_CNT, 1, 5)
  747. #error "I2CPE_ENCODER_CNT must be between 1 and 5."
  748. #endif
  749. #endif
  750. /**
  751. * Babystepping
  752. */
  753. #if ENABLED(BABYSTEPPING)
  754. #if ENABLED(SCARA)
  755. #error "BABYSTEPPING is not implemented for SCARA yet."
  756. #elif BOTH(MARKFORGED_XY, BABYSTEP_XY)
  757. #error "BABYSTEPPING only implemented for Z axis on MarkForged."
  758. #elif BOTH(DELTA, BABYSTEP_XY)
  759. #error "BABYSTEPPING only implemented for Z axis on deltabots."
  760. #elif BOTH(BABYSTEP_ZPROBE_OFFSET, MESH_BED_LEVELING)
  761. #error "MESH_BED_LEVELING and BABYSTEP_ZPROBE_OFFSET is not a valid combination"
  762. #elif ENABLED(BABYSTEP_ZPROBE_OFFSET) && !HAS_BED_PROBE
  763. #error "BABYSTEP_ZPROBE_OFFSET requires a probe."
  764. #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && !HAS_MARLINUI_U8GLIB
  765. #error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a Graphical LCD."
  766. #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && DISABLED(BABYSTEP_ZPROBE_OFFSET)
  767. #error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a BABYSTEP_ZPROBE_OFFSET."
  768. #elif ENABLED(BABYSTEP_HOTEND_Z_OFFSET) && !HAS_HOTEND_OFFSET
  769. #error "BABYSTEP_HOTEND_Z_OFFSET requires 2 or more HOTENDS."
  770. #elif BOTH(BABYSTEP_ALWAYS_AVAILABLE, MOVE_Z_WHEN_IDLE)
  771. #error "BABYSTEP_ALWAYS_AVAILABLE and MOVE_Z_WHEN_IDLE are incompatible."
  772. #elif !defined(BABYSTEP_MULTIPLICATOR_Z)
  773. #error "BABYSTEPPING requires BABYSTEP_MULTIPLICATOR_Z."
  774. #elif ENABLED(BABYSTEP_XY) && !defined(BABYSTEP_MULTIPLICATOR_XY)
  775. #error "BABYSTEP_XY requires BABYSTEP_MULTIPLICATOR_XY."
  776. #elif ENABLED(BABYSTEP_MILLIMETER_UNITS)
  777. static_assert(BABYSTEP_MULTIPLICATOR_Z <= 0.1f, "BABYSTEP_MULTIPLICATOR_Z must be less or equal to 0.1mm.");
  778. #if ENABLED(BABYSTEP_XY)
  779. static_assert(BABYSTEP_MULTIPLICATOR_XY <= 0.25f, "BABYSTEP_MULTIPLICATOR_XY must be less than or equal to 0.25mm.");
  780. #endif
  781. #elif ENABLED(BABYSTEP_DISPLAY_TOTAL) && ANY(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)
  782. #error "New Color UI (TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI) does not support BABYSTEP_DISPLAY_TOTAL yet."
  783. #endif
  784. #endif
  785. /**
  786. * Filament Runout needs one or more pins and either SD Support or Auto print start detection
  787. */
  788. #if HAS_FILAMENT_SENSOR
  789. #if !PIN_EXISTS(FIL_RUNOUT)
  790. #error "FILAMENT_RUNOUT_SENSOR requires FIL_RUNOUT_PIN."
  791. #elif NUM_RUNOUT_SENSORS > E_STEPPERS
  792. #if HAS_PRUSA_MMU2
  793. #error "NUM_RUNOUT_SENSORS must be 1 with MMU2 / MMU2S."
  794. #else
  795. #error "NUM_RUNOUT_SENSORS cannot exceed the number of E steppers."
  796. #endif
  797. #elif NUM_RUNOUT_SENSORS >= 2 && !PIN_EXISTS(FIL_RUNOUT2)
  798. #error "FIL_RUNOUT2_PIN is required with NUM_RUNOUT_SENSORS >= 2."
  799. #elif NUM_RUNOUT_SENSORS >= 3 && !PIN_EXISTS(FIL_RUNOUT3)
  800. #error "FIL_RUNOUT3_PIN is required with NUM_RUNOUT_SENSORS >= 3."
  801. #elif NUM_RUNOUT_SENSORS >= 4 && !PIN_EXISTS(FIL_RUNOUT4)
  802. #error "FIL_RUNOUT4_PIN is required with NUM_RUNOUT_SENSORS >= 4."
  803. #elif NUM_RUNOUT_SENSORS >= 5 && !PIN_EXISTS(FIL_RUNOUT5)
  804. #error "FIL_RUNOUT5_PIN is required with NUM_RUNOUT_SENSORS >= 5."
  805. #elif NUM_RUNOUT_SENSORS >= 6 && !PIN_EXISTS(FIL_RUNOUT6)
  806. #error "FIL_RUNOUT6_PIN is required with NUM_RUNOUT_SENSORS >= 6."
  807. #elif NUM_RUNOUT_SENSORS >= 7 && !PIN_EXISTS(FIL_RUNOUT7)
  808. #error "FIL_RUNOUT7_PIN is required with NUM_RUNOUT_SENSORS >= 7."
  809. #elif NUM_RUNOUT_SENSORS >= 8 && !PIN_EXISTS(FIL_RUNOUT8)
  810. #error "FIL_RUNOUT8_PIN is required with NUM_RUNOUT_SENSORS >= 8."
  811. #elif BOTH(FIL_RUNOUT1_PULLUP, FIL_RUNOUT1_PULLDOWN)
  812. #error "You can't enable FIL_RUNOUT1_PULLUP and FIL_RUNOUT1_PULLDOWN at the same time."
  813. #elif BOTH(FIL_RUNOUT2_PULLUP, FIL_RUNOUT2_PULLDOWN)
  814. #error "You can't enable FIL_RUNOUT2_PULLUP and FIL_RUNOUT2_PULLDOWN at the same time."
  815. #elif BOTH(FIL_RUNOUT3_PULLUP, FIL_RUNOUT3_PULLDOWN)
  816. #error "You can't enable FIL_RUNOUT3_PULLUP and FIL_RUNOUT3_PULLDOWN at the same time."
  817. #elif BOTH(FIL_RUNOUT4_PULLUP, FIL_RUNOUT4_PULLDOWN)
  818. #error "You can't enable FIL_RUNOUT4_PULLUP and FIL_RUNOUT4_PULLDOWN at the same time."
  819. #elif BOTH(FIL_RUNOUT5_PULLUP, FIL_RUNOUT5_PULLDOWN)
  820. #error "You can't enable FIL_RUNOUT5_PULLUP and FIL_RUNOUT5_PULLDOWN at the same time."
  821. #elif BOTH(FIL_RUNOUT6_PULLUP, FIL_RUNOUT6_PULLDOWN)
  822. #error "You can't enable FIL_RUNOUT6_PULLUP and FIL_RUNOUT6_PULLDOWN at the same time."
  823. #elif BOTH(FIL_RUNOUT7_PULLUP, FIL_RUNOUT7_PULLDOWN)
  824. #error "You can't enable FIL_RUNOUT7_PULLUP and FIL_RUNOUT7_PULLDOWN at the same time."
  825. #elif BOTH(FIL_RUNOUT8_PULLUP, FIL_RUNOUT8_PULLDOWN)
  826. #error "You can't enable FIL_RUNOUT8_PULLUP and FIL_RUNOUT8_PULLDOWN at the same time."
  827. #elif FILAMENT_RUNOUT_DISTANCE_MM < 0
  828. #error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero."
  829. #elif DISABLED(ADVANCED_PAUSE_FEATURE)
  830. static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with FILAMENT_RUNOUT_SENSOR.");
  831. #endif
  832. #endif
  833. /**
  834. * Advanced Pause
  835. */
  836. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  837. #if !HAS_RESUME_CONTINUE
  838. #error "ADVANCED_PAUSE_FEATURE requires a supported LCD controller (or EMERGENCY_PARSER)."
  839. #elif DISABLED(NOZZLE_PARK_FEATURE)
  840. #error "ADVANCED_PAUSE_FEATURE requires NOZZLE_PARK_FEATURE."
  841. #elif !defined(FILAMENT_UNLOAD_PURGE_FEEDRATE)
  842. #error "ADVANCED_PAUSE_FEATURE requires FILAMENT_UNLOAD_PURGE_FEEDRATE."
  843. #elif ENABLED(EXTRUDER_RUNOUT_PREVENT)
  844. #error "EXTRUDER_RUNOUT_PREVENT is incompatible with ADVANCED_PAUSE_FEATURE."
  845. #elif ENABLED(PARK_HEAD_ON_PAUSE) && NONE(SDSUPPORT, IS_NEWPANEL, EMERGENCY_PARSER)
  846. #error "PARK_HEAD_ON_PAUSE requires SDSUPPORT, EMERGENCY_PARSER, or an LCD controller."
  847. #elif ENABLED(HOME_BEFORE_FILAMENT_CHANGE) && DISABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT)
  848. #error "HOME_BEFORE_FILAMENT_CHANGE requires PAUSE_PARK_NO_STEPPER_TIMEOUT."
  849. #elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_UNLOAD_LENGTH > EXTRUDE_MAXLENGTH
  850. #error "FILAMENT_CHANGE_UNLOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH."
  851. #elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_SLOW_LOAD_LENGTH > EXTRUDE_MAXLENGTH
  852. #error "FILAMENT_CHANGE_SLOW_LOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH."
  853. #elif ENABLED(PREVENT_LENGTHY_EXTRUDE) && FILAMENT_CHANGE_FAST_LOAD_LENGTH > EXTRUDE_MAXLENGTH
  854. #error "FILAMENT_CHANGE_FAST_LOAD_LENGTH must be less than or equal to EXTRUDE_MAXLENGTH."
  855. #endif
  856. #endif
  857. #if ENABLED(NOZZLE_PARK_FEATURE)
  858. constexpr float npp[] = NOZZLE_PARK_POINT;
  859. static_assert(COUNT(npp) == XYZ, "NOZZLE_PARK_POINT requires X, Y, and Z values.");
  860. constexpr xyz_pos_t npp_xyz = NOZZLE_PARK_POINT;
  861. static_assert(WITHIN(npp_xyz.x, X_MIN_POS, X_MAX_POS), "NOZZLE_PARK_POINT.X is out of bounds (X_MIN_POS, X_MAX_POS).");
  862. static_assert(WITHIN(npp_xyz.y, Y_MIN_POS, Y_MAX_POS), "NOZZLE_PARK_POINT.Y is out of bounds (Y_MIN_POS, Y_MAX_POS).");
  863. static_assert(WITHIN(npp_xyz.z, Z_MIN_POS, Z_MAX_POS), "NOZZLE_PARK_POINT.Z is out of bounds (Z_MIN_POS, Z_MAX_POS).");
  864. #endif
  865. /**
  866. * Individual axis homing is useless for DELTAS
  867. */
  868. #if BOTH(INDIVIDUAL_AXIS_HOMING_MENU, DELTA)
  869. #error "INDIVIDUAL_AXIS_HOMING_MENU is incompatible with DELTA kinematics."
  870. #endif
  871. /**
  872. * Sanity checking for all Průša MMU
  873. */
  874. #ifdef SNMM
  875. #error "SNMM is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead."
  876. #elif ENABLED(MK2_MULTIPLEXER)
  877. #error "MK2_MULTIPLEXER is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead."
  878. #elif ENABLED(PRUSA_MMU2)
  879. #error "PRUSA_MMU2 is obsolete. Define MMU_MODEL as PRUSA_MMU2 instead."
  880. #elif ENABLED(PRUSA_MMU2_S_MODE)
  881. #error "PRUSA_MMU2_S_MODE is obsolete. Define MMU_MODEL as PRUSA_MMU2S instead."
  882. #endif
  883. /**
  884. * Multi-Material-Unit 2 / SMUFF requirements
  885. */
  886. #if HAS_PRUSA_MMU2
  887. #if EXTRUDERS != 5
  888. #undef SINGLENOZZLE
  889. #error "PRUSA_MMU2(S) requires exactly 5 EXTRUDERS. Please update your Configuration."
  890. #elif DISABLED(NOZZLE_PARK_FEATURE)
  891. #error "PRUSA_MMU2(S) requires NOZZLE_PARK_FEATURE. Enable it to continue."
  892. #elif HAS_PRUSA_MMU2S && DISABLED(FILAMENT_RUNOUT_SENSOR)
  893. #error "PRUSA_MMU2S requires FILAMENT_RUNOUT_SENSOR. Enable it to continue."
  894. #elif ENABLED(MMU_EXTRUDER_SENSOR) && DISABLED(FILAMENT_RUNOUT_SENSOR)
  895. #error "MMU_EXTRUDER_SENSOR requires FILAMENT_RUNOUT_SENSOR. Enable it to continue."
  896. #elif ENABLED(MMU_EXTRUDER_SENSOR) && !HAS_LCD_MENU
  897. #error "MMU_EXTRUDER_SENSOR requires an LCD supporting MarlinUI to be enabled."
  898. #elif DISABLED(ADVANCED_PAUSE_FEATURE)
  899. static_assert(nullptr == strstr(MMU2_FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with PRUSA_MMU2(S) / SMUFF_EMU_MMU2(S).");
  900. #endif
  901. #endif
  902. #if HAS_SMUFF && EXTRUDERS > 12
  903. #error "Too many extruders for SMUFF_EMU_MMU2(S). (12 maximum)."
  904. #endif
  905. /**
  906. * Options only for EXTRUDERS > 1
  907. */
  908. #if HAS_MULTI_EXTRUDER
  909. #if EXTRUDERS > 8
  910. #error "Marlin supports a maximum of 8 EXTRUDERS."
  911. #endif
  912. #if ENABLED(HEATERS_PARALLEL)
  913. #error "EXTRUDERS must be 1 with HEATERS_PARALLEL."
  914. #endif
  915. #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
  916. #ifndef TOOLCHANGE_FS_LENGTH
  917. #error "TOOLCHANGE_FILAMENT_SWAP requires TOOLCHANGE_FS_LENGTH."
  918. #elif !defined(TOOLCHANGE_FS_RETRACT_SPEED)
  919. #error "TOOLCHANGE_FILAMENT_SWAP requires TOOLCHANGE_FS_RETRACT_SPEED."
  920. #elif !defined(TOOLCHANGE_FS_PRIME_SPEED)
  921. #error "TOOLCHANGE_FILAMENT_SWAP requires TOOLCHANGE_FS_PRIME_SPEED."
  922. #endif
  923. #endif
  924. #if ENABLED(TOOLCHANGE_PARK)
  925. #ifndef TOOLCHANGE_PARK_XY
  926. #error "TOOLCHANGE_PARK requires TOOLCHANGE_PARK_XY."
  927. #elif !defined(TOOLCHANGE_PARK_XY_FEEDRATE)
  928. #error "TOOLCHANGE_PARK requires TOOLCHANGE_PARK_XY_FEEDRATE."
  929. #endif
  930. #endif
  931. #ifndef TOOLCHANGE_ZRAISE
  932. #error "TOOLCHANGE_ZRAISE required for EXTRUDERS > 1."
  933. #endif
  934. #elif HAS_PRUSA_MMU1 || HAS_SMUFF
  935. #error "Multi-Material-Unit requires 2 or more EXTRUDERS."
  936. #elif ENABLED(SINGLENOZZLE)
  937. #error "SINGLENOZZLE requires 2 or more EXTRUDERS."
  938. #endif
  939. /**
  940. * A Dual Nozzle carriage with switching servo
  941. */
  942. #if ENABLED(SWITCHING_NOZZLE)
  943. #if ENABLED(DUAL_X_CARRIAGE)
  944. #error "SWITCHING_NOZZLE and DUAL_X_CARRIAGE are incompatible."
  945. #elif ENABLED(SINGLENOZZLE)
  946. #error "SWITCHING_NOZZLE and SINGLENOZZLE are incompatible."
  947. #elif EXTRUDERS != 2
  948. #error "SWITCHING_NOZZLE requires exactly 2 EXTRUDERS."
  949. #elif NUM_SERVOS < 1
  950. #error "SWITCHING_NOZZLE requires NUM_SERVOS >= 1."
  951. #endif
  952. #ifndef SWITCHING_NOZZLE_SERVO_NR
  953. #error "SWITCHING_NOZZLE requires SWITCHING_NOZZLE_SERVO_NR."
  954. #elif SWITCHING_NOZZLE_SERVO_NR == 0 && !PIN_EXISTS(SERVO0)
  955. #error "SERVO0_PIN must be defined for your SWITCHING_NOZZLE."
  956. #elif SWITCHING_NOZZLE_SERVO_NR == 1 && !PIN_EXISTS(SERVO1)
  957. #error "SERVO1_PIN must be defined for your SWITCHING_NOZZLE."
  958. #elif SWITCHING_NOZZLE_SERVO_NR == 2 && !PIN_EXISTS(SERVO2)
  959. #error "SERVO2_PIN must be defined for your SWITCHING_NOZZLE."
  960. #elif SWITCHING_NOZZLE_SERVO_NR == 3 && !PIN_EXISTS(SERVO3)
  961. #error "SERVO3_PIN must be defined for your SWITCHING_NOZZLE."
  962. #endif
  963. #ifdef SWITCHING_NOZZLE_E1_SERVO_NR
  964. #if SWITCHING_NOZZLE_E1_SERVO_NR == SWITCHING_NOZZLE_SERVO_NR
  965. #error "SWITCHING_NOZZLE_E1_SERVO_NR must be different from SWITCHING_NOZZLE_SERVO_NR."
  966. #elif SWITCHING_NOZZLE_E1_SERVO_NR == 0 && !PIN_EXISTS(SERVO0)
  967. #error "SERVO0_PIN must be defined for your SWITCHING_NOZZLE."
  968. #elif SWITCHING_NOZZLE_E1_SERVO_NR == 1 && !PIN_EXISTS(SERVO1)
  969. #error "SERVO1_PIN must be defined for your SWITCHING_NOZZLE."
  970. #elif SWITCHING_NOZZLE_E1_SERVO_NR == 2 && !PIN_EXISTS(SERVO2)
  971. #error "SERVO2_PIN must be defined for your SWITCHING_NOZZLE."
  972. #elif SWITCHING_NOZZLE_E1_SERVO_NR == 3 && !PIN_EXISTS(SERVO3)
  973. #error "SERVO3_PIN must be defined for your SWITCHING_NOZZLE."
  974. #endif
  975. #endif
  976. #endif
  977. /**
  978. * Single Stepper Dual Extruder with switching servo
  979. */
  980. #if ENABLED(SWITCHING_EXTRUDER)
  981. #if NUM_SERVOS < 1
  982. #error "SWITCHING_EXTRUDER requires NUM_SERVOS >= 1."
  983. #elif SWITCHING_EXTRUDER_SERVO_NR == 0 && !PIN_EXISTS(SERVO0)
  984. #error "SERVO0_PIN must be defined for your SWITCHING_EXTRUDER."
  985. #elif SWITCHING_EXTRUDER_SERVO_NR == 1 && !PIN_EXISTS(SERVO1)
  986. #error "SERVO1_PIN must be defined for your SWITCHING_EXTRUDER."
  987. #elif SWITCHING_EXTRUDER_SERVO_NR == 2 && !PIN_EXISTS(SERVO2)
  988. #error "SERVO2_PIN must be defined for your SWITCHING_EXTRUDER."
  989. #elif SWITCHING_EXTRUDER_SERVO_NR == 3 && !PIN_EXISTS(SERVO3)
  990. #error "SERVO3_PIN must be defined for your SWITCHING_EXTRUDER."
  991. #endif
  992. #if EXTRUDERS > 3
  993. #if NUM_SERVOS < 2
  994. #error "SWITCHING_EXTRUDER with 4 extruders requires NUM_SERVOS >= 2."
  995. #elif SWITCHING_EXTRUDER_E23_SERVO_NR == 0 && !PIN_EXISTS(SERVO0)
  996. #error "SERVO0_PIN must be defined for your SWITCHING_EXTRUDER."
  997. #elif SWITCHING_EXTRUDER_E23_SERVO_NR == 1 && !PIN_EXISTS(SERVO1)
  998. #error "SERVO1_PIN must be defined for your SWITCHING_EXTRUDER."
  999. #elif SWITCHING_EXTRUDER_E23_SERVO_NR == 2 && !PIN_EXISTS(SERVO2)
  1000. #error "SERVO2_PIN must be defined for your SWITCHING_EXTRUDER."
  1001. #elif SWITCHING_EXTRUDER_E23_SERVO_NR == 3 && !PIN_EXISTS(SERVO3)
  1002. #error "SERVO3_PIN must be defined for your SWITCHING_EXTRUDER."
  1003. #elif SWITCHING_EXTRUDER_E23_SERVO_NR == SWITCHING_EXTRUDER_SERVO_NR
  1004. #error "SWITCHING_EXTRUDER_E23_SERVO_NR should be a different extruder from SWITCHING_EXTRUDER_SERVO_NR."
  1005. #endif
  1006. #endif
  1007. #endif
  1008. /**
  1009. * Mixing Extruder requirements
  1010. */
  1011. #if ENABLED(MIXING_EXTRUDER)
  1012. #if HAS_MULTI_EXTRUDER
  1013. #error "For MIXING_EXTRUDER set MIXING_STEPPERS > 1 instead of EXTRUDERS > 1."
  1014. #elif MIXING_STEPPERS < 2
  1015. #error "You must set MIXING_STEPPERS >= 2 for a mixing extruder."
  1016. #elif ENABLED(FILAMENT_SENSOR)
  1017. #error "MIXING_EXTRUDER is incompatible with FILAMENT_SENSOR. Comment out this line to use it anyway."
  1018. #elif ENABLED(SWITCHING_EXTRUDER)
  1019. #error "Please select either MIXING_EXTRUDER or SWITCHING_EXTRUDER, not both."
  1020. #elif ENABLED(SINGLENOZZLE)
  1021. #error "MIXING_EXTRUDER is incompatible with SINGLENOZZLE."
  1022. #endif
  1023. #endif
  1024. /**
  1025. * Linear Advance 1.5 - Check K value range
  1026. */
  1027. #if ENABLED(LIN_ADVANCE)
  1028. static_assert(
  1029. WITHIN(LIN_ADVANCE_K, 0, 10),
  1030. "LIN_ADVANCE_K must be a value from 0 to 10 (Changed in LIN_ADVANCE v1.5, Marlin 1.1.9)."
  1031. );
  1032. #if ENABLED(S_CURVE_ACCELERATION) && DISABLED(EXPERIMENTAL_SCURVE)
  1033. #error "LIN_ADVANCE and S_CURVE_ACCELERATION may not play well together! Enable EXPERIMENTAL_SCURVE to continue."
  1034. #endif
  1035. #endif
  1036. /**
  1037. * Special tool-changing options
  1038. */
  1039. #if MANY(SINGLENOZZLE, DUAL_X_CARRIAGE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER, SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD, ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
  1040. #error "Please select only one of SINGLENOZZLE, DUAL_X_CARRIAGE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER, SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD, or ELECTROMAGNETIC_SWITCHING_TOOLHEAD."
  1041. #endif
  1042. /**
  1043. * (Magnetic) Parking Extruder requirements
  1044. */
  1045. #if ANY(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER)
  1046. #if ENABLED(EXT_SOLENOID)
  1047. #error "(MAGNETIC_)PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)"
  1048. #elif EXTRUDERS != 2
  1049. #error "(MAGNETIC_)PARKING_EXTRUDER requires exactly 2 EXTRUDERS."
  1050. #elif !defined(PARKING_EXTRUDER_PARKING_X)
  1051. #error "(MAGNETIC_)PARKING_EXTRUDER requires PARKING_EXTRUDER_PARKING_X."
  1052. #elif !defined(TOOLCHANGE_ZRAISE)
  1053. #error "(MAGNETIC_)PARKING_EXTRUDER requires TOOLCHANGE_ZRAISE."
  1054. #elif TOOLCHANGE_ZRAISE < 0
  1055. #error "TOOLCHANGE_ZRAISE must be 0 or higher."
  1056. #elif ENABLED(PARKING_EXTRUDER)
  1057. #if !PINS_EXIST(SOL0, SOL1)
  1058. #error "PARKING_EXTRUDER requires SOL0_PIN and SOL1_PIN."
  1059. #elif !defined(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE, LOW, HIGH)
  1060. #error "PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE must be defined as HIGH or LOW."
  1061. #elif !defined(PARKING_EXTRUDER_SOLENOIDS_DELAY) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_DELAY, 0, 2000)
  1062. #error "PARKING_EXTRUDER_SOLENOIDS_DELAY must be between 0 and 2000 (ms)."
  1063. #endif
  1064. #endif
  1065. #endif
  1066. /**
  1067. * Switching Toolhead requirements
  1068. */
  1069. #if ENABLED(SWITCHING_TOOLHEAD)
  1070. #ifndef SWITCHING_TOOLHEAD_SERVO_NR
  1071. #error "SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_SERVO_NR."
  1072. #elif EXTRUDERS < 2
  1073. #error "SWITCHING_TOOLHEAD requires at least 2 EXTRUDERS."
  1074. #elif NUM_SERVOS < (SWITCHING_TOOLHEAD_SERVO_NR - 1)
  1075. #if SWITCHING_TOOLHEAD_SERVO_NR == 0
  1076. #error "A SWITCHING_TOOLHEAD_SERVO_NR of 0 requires NUM_SERVOS >= 1."
  1077. #elif SWITCHING_TOOLHEAD_SERVO_NR == 1
  1078. #error "A SWITCHING_TOOLHEAD_SERVO_NR of 1 requires NUM_SERVOS >= 2."
  1079. #elif SWITCHING_TOOLHEAD_SERVO_NR == 2
  1080. #error "A SWITCHING_TOOLHEAD_SERVO_NR of 2 requires NUM_SERVOS >= 3."
  1081. #elif SWITCHING_TOOLHEAD_SERVO_NR == 3
  1082. #error "A SWITCHING_TOOLHEAD_SERVO_NR of 3 requires NUM_SERVOS >= 4."
  1083. #endif
  1084. #elif !defined(TOOLCHANGE_ZRAISE)
  1085. #error "SWITCHING_TOOLHEAD requires TOOLCHANGE_ZRAISE."
  1086. #elif TOOLCHANGE_ZRAISE < 0
  1087. #error "TOOLCHANGE_ZRAISE must be 0 or higher."
  1088. #endif
  1089. #endif
  1090. /**
  1091. * (Electro)magnetic Switching Toolhead requirements
  1092. */
  1093. #if EITHER(MAGNETIC_SWITCHING_TOOLHEAD, ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
  1094. #ifndef SWITCHING_TOOLHEAD_Y_POS
  1095. #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_Y_POS"
  1096. #elif !defined(SWITCHING_TOOLHEAD_X_POS)
  1097. #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_X_POS"
  1098. #elif !defined(SWITCHING_TOOLHEAD_Z_HOP)
  1099. #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_Z_HOP."
  1100. #elif !defined(SWITCHING_TOOLHEAD_Y_CLEAR)
  1101. #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_Y_CLEAR."
  1102. #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
  1103. #if ENABLED(EXT_SOLENOID)
  1104. #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD and EXT_SOLENOID are incompatible. (Pins are used twice.)"
  1105. #elif !PIN_EXISTS(SOL0)
  1106. #error "(ELECTRO)MAGNETIC_SWITCHING_TOOLHEAD requires SOL0_PIN."
  1107. #endif
  1108. #endif
  1109. #endif
  1110. /**
  1111. * Part-Cooling Fan Multiplexer requirements
  1112. */
  1113. #if PIN_EXISTS(FANMUX1)
  1114. #if !HAS_FANMUX
  1115. #error "FANMUX0_PIN must be set before FANMUX1_PIN can be set."
  1116. #endif
  1117. #elif PIN_EXISTS(FANMUX2)
  1118. #error "FANMUX0_PIN and FANMUX1_PIN must be set before FANMUX2_PIN can be set."
  1119. #endif
  1120. /**
  1121. * Limited user-controlled fans
  1122. */
  1123. #if NUM_M106_FANS > FAN_COUNT
  1124. #error "The selected board doesn't support enough user-controlled fans. Reduce NUM_M106_FANS."
  1125. #endif
  1126. /**
  1127. * Limited number of servos
  1128. */
  1129. #if NUM_SERVOS > NUM_SERVO_PLUGS
  1130. #error "The selected board doesn't support enough servos for your configuration. Reduce NUM_SERVOS."
  1131. #endif
  1132. /**
  1133. * Servo deactivation depends on servo endstops, switching nozzle, or switching extruder
  1134. */
  1135. #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && !HAS_Z_SERVO_PROBE && !defined(SWITCHING_NOZZLE_SERVO_NR) && !defined(SWITCHING_EXTRUDER_SERVO_NR) && !defined(SWITCHING_TOOLHEAD_SERVO_NR)
  1136. #error "Z_PROBE_SERVO_NR, switching nozzle, switching toolhead or switching extruder is required for DEACTIVATE_SERVOS_AFTER_MOVE."
  1137. #endif
  1138. /**
  1139. * Required LCD language
  1140. */
  1141. #if HAS_MARLINUI_HD44780 && !defined(DISPLAY_CHARSET_HD44780)
  1142. #error "You must set DISPLAY_CHARSET_HD44780 to JAPANESE, WESTERN or CYRILLIC for your LCD controller."
  1143. #endif
  1144. /**
  1145. * Bed Heating Options - PID vs Limit Switching
  1146. */
  1147. #if BOTH(PIDTEMPBED, BED_LIMIT_SWITCHING)
  1148. #error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED."
  1149. #endif
  1150. /**
  1151. * Kinematics
  1152. */
  1153. /**
  1154. * Allow only one kinematic type to be defined
  1155. */
  1156. #if MANY(DELTA, MORGAN_SCARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY)
  1157. #error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, COREZY, or MARKFORGED_XY."
  1158. #endif
  1159. /**
  1160. * Delta requirements
  1161. */
  1162. #if ENABLED(DELTA)
  1163. #if NONE(USE_XMAX_PLUG, USE_YMAX_PLUG, USE_ZMAX_PLUG)
  1164. #error "You probably want to use Max Endstops for DELTA!"
  1165. #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_SEGMENTED
  1166. #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL."
  1167. #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || HAS_LCD_MENU)
  1168. #error "DELTA_AUTO_CALIBRATION requires a probe or LCD Controller."
  1169. #elif ENABLED(DELTA_CALIBRATION_MENU) && !HAS_LCD_MENU
  1170. #error "DELTA_CALIBRATION_MENU requires an LCD Controller."
  1171. #elif ABL_GRID
  1172. #if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0
  1173. #error "DELTA requires GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y to be odd numbers."
  1174. #elif GRID_MAX_POINTS_X < 3
  1175. #error "DELTA requires GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y to be 3 or higher."
  1176. #endif
  1177. #endif
  1178. #endif
  1179. /**
  1180. * Junction deviation is incompatible with kinematic systems.
  1181. */
  1182. #if HAS_JUNCTION_DEVIATION && IS_KINEMATIC
  1183. #error "CLASSIC_JERK is required for DELTA and SCARA."
  1184. #endif
  1185. /**
  1186. * Probes
  1187. */
  1188. /**
  1189. * Allow only one probe option to be defined
  1190. */
  1191. #if 1 < 0 \
  1192. + (DISABLED(BLTOUCH) && HAS_Z_SERVO_PROBE) \
  1193. + (ENABLED(BLTOUCH) && DISABLED(CREALITY_TOUCH)) \
  1194. + COUNT_ENABLED(PROBE_MANUALLY, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, CREALITY_TOUCH, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING)
  1195. #error "Please enable only one probe option: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
  1196. #endif
  1197. #if HAS_BED_PROBE
  1198. /**
  1199. * Z_PROBE_SLED is incompatible with DELTA
  1200. */
  1201. #if BOTH(Z_PROBE_SLED, DELTA)
  1202. #error "You cannot use Z_PROBE_SLED with DELTA."
  1203. #endif
  1204. /**
  1205. * SOLENOID_PROBE requirements
  1206. */
  1207. #if ENABLED(SOLENOID_PROBE)
  1208. #if ENABLED(EXT_SOLENOID)
  1209. #error "SOLENOID_PROBE is incompatible with EXT_SOLENOID."
  1210. #elif !HAS_SOLENOID_1
  1211. #error "SOLENOID_PROBE requires SOL1_PIN."
  1212. #endif
  1213. #endif
  1214. /**
  1215. * NUM_SERVOS is required for a Z servo probe
  1216. */
  1217. #if HAS_Z_SERVO_PROBE
  1218. #if !NUM_SERVOS
  1219. #error "NUM_SERVOS is required for a Z servo probe (Z_PROBE_SERVO_NR)."
  1220. #elif Z_PROBE_SERVO_NR >= NUM_SERVOS
  1221. #error "Z_PROBE_SERVO_NR must be smaller than NUM_SERVOS."
  1222. #elif Z_PROBE_SERVO_NR == 0 && !PIN_EXISTS(SERVO0)
  1223. #error "SERVO0_PIN must be defined for your servo or BLTOUCH probe."
  1224. #elif Z_PROBE_SERVO_NR == 1 && !PIN_EXISTS(SERVO1)
  1225. #error "SERVO1_PIN must be defined for your servo or BLTOUCH probe."
  1226. #elif Z_PROBE_SERVO_NR == 2 && !PIN_EXISTS(SERVO2)
  1227. #error "SERVO2_PIN must be defined for your servo or BLTOUCH probe."
  1228. #elif Z_PROBE_SERVO_NR == 3 && !PIN_EXISTS(SERVO3)
  1229. #error "SERVO3_PIN must be defined for your servo or BLTOUCH probe."
  1230. #endif
  1231. #endif
  1232. #if ENABLED(BLTOUCH)
  1233. #if BLTOUCH_DELAY < 200
  1234. #error "BLTOUCH_DELAY less than 200 is unsafe and is not supported."
  1235. #elif DISABLED(BLTOUCH_SET_5V_MODE) && NONE(ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS, ENDSTOPPULLUP_ZMIN, ENDSTOPPULLUP_ZMIN_PROBE)
  1236. #error "BLTOUCH without BLTOUCH_SET_5V_MODE requires ENDSTOPPULLUPS, ENDSTOPPULLUP_ZMIN or ENDSTOPPULLUP_ZMIN_PROBE."
  1237. #endif
  1238. #endif
  1239. #if ENABLED(RACK_AND_PINION_PROBE) && !(defined(Z_PROBE_DEPLOY_X) && defined(Z_PROBE_RETRACT_X))
  1240. #error "RACK_AND_PINION_PROBE requires Z_PROBE_DEPLOY_X and Z_PROBE_RETRACT_X."
  1241. #endif
  1242. /**
  1243. * Touch-MI probe requirements
  1244. */
  1245. #if ENABLED(TOUCH_MI_PROBE)
  1246. #if DISABLED(Z_SAFE_HOMING)
  1247. #error "TOUCH_MI_PROBE requires Z_SAFE_HOMING."
  1248. #elif !defined(TOUCH_MI_RETRACT_Z)
  1249. #error "TOUCH_MI_PROBE requires TOUCH_MI_RETRACT_Z."
  1250. #elif defined(Z_AFTER_PROBING)
  1251. #error "TOUCH_MI_PROBE requires Z_AFTER_PROBING to be disabled."
  1252. #elif Z_HOMING_HEIGHT < 10
  1253. #error "TOUCH_MI_PROBE requires Z_HOMING_HEIGHT >= 10."
  1254. #elif Z_MIN_PROBE_ENDSTOP_INVERTING
  1255. #error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_INVERTING to be set to false."
  1256. #elif DISABLED(BABYSTEP_ZPROBE_OFFSET)
  1257. #error "TOUCH_MI_PROBE requires BABYSTEPPING with BABYSTEP_ZPROBE_OFFSET."
  1258. #elif !HAS_RESUME_CONTINUE
  1259. #error "TOUCH_MI_PROBE currently requires an LCD controller or EMERGENCY_PARSER."
  1260. #endif
  1261. #endif
  1262. /**
  1263. * Require pin options and pins to be defined
  1264. */
  1265. #if ENABLED(SENSORLESS_PROBING)
  1266. #if ENABLED(DELTA) && !(AXIS_HAS_STALLGUARD(X) && AXIS_HAS_STALLGUARD(Y) && AXIS_HAS_STALLGUARD(Z))
  1267. #error "SENSORLESS_PROBING requires TMC2130/2160/2209/5130/5160 drivers on X, Y, and Z."
  1268. #elif !AXIS_HAS_STALLGUARD(Z)
  1269. #error "SENSORLESS_PROBING requires a TMC2130/2160/2209/5130/5160 driver on Z."
  1270. #endif
  1271. #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  1272. #if DISABLED(USE_ZMIN_PLUG)
  1273. #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires USE_ZMIN_PLUG to be enabled."
  1274. #elif !HAS_Z_MIN
  1275. #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires the Z_MIN_PIN to be defined."
  1276. #elif Z_MIN_PROBE_ENDSTOP_INVERTING != Z_MIN_ENDSTOP_INVERTING
  1277. #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_INVERTING to match Z_MIN_PROBE_ENDSTOP_INVERTING."
  1278. #endif
  1279. #elif !HAS_Z_MIN_PROBE_PIN
  1280. #error "Z_MIN_PROBE_PIN must be defined if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is not enabled."
  1281. #endif
  1282. /**
  1283. * Check for improper NOZZLE_TO_PROBE_OFFSET
  1284. */
  1285. constexpr xyz_pos_t sanity_nozzle_to_probe_offset = NOZZLE_TO_PROBE_OFFSET;
  1286. #if ENABLED(NOZZLE_AS_PROBE)
  1287. static_assert(sanity_nozzle_to_probe_offset.x == 0 && sanity_nozzle_to_probe_offset.y == 0,
  1288. "NOZZLE_AS_PROBE requires the XY offsets in NOZZLE_TO_PROBE_OFFSET to both be 0.");
  1289. #else
  1290. static_assert(PROBING_MARGIN >= 0, "PROBING_MARGIN must be >= 0.");
  1291. static_assert(PROBING_MARGIN_BACK >= 0, "PROBING_MARGIN_BACK must be >= 0.");
  1292. static_assert(PROBING_MARGIN_FRONT >= 0, "PROBING_MARGIN_FRONT must be >= 0.");
  1293. static_assert(PROBING_MARGIN_LEFT >= 0, "PROBING_MARGIN_LEFT must be >= 0.");
  1294. static_assert(PROBING_MARGIN_RIGHT >= 0, "PROBING_MARGIN_RIGHT must be >= 0.");
  1295. #endif
  1296. #define _MARGIN(A) TERN(IS_SCARA, SCARA_PRINTABLE_RADIUS, TERN(DELTA, DELTA_PRINTABLE_RADIUS, ((A##_BED_SIZE) / 2)))
  1297. static_assert(PROBING_MARGIN < _MARGIN(X), "PROBING_MARGIN is too large.");
  1298. static_assert(PROBING_MARGIN_BACK < _MARGIN(Y), "PROBING_MARGIN_BACK is too large.");
  1299. static_assert(PROBING_MARGIN_FRONT < _MARGIN(Y), "PROBING_MARGIN_FRONT is too large.");
  1300. static_assert(PROBING_MARGIN_LEFT < _MARGIN(X), "PROBING_MARGIN_LEFT is too large.");
  1301. static_assert(PROBING_MARGIN_RIGHT < _MARGIN(X), "PROBING_MARGIN_RIGHT is too large.");
  1302. #undef _MARGIN
  1303. /**
  1304. * Make sure Z raise values are set
  1305. */
  1306. #ifndef Z_CLEARANCE_DEPLOY_PROBE
  1307. #error "You must define Z_CLEARANCE_DEPLOY_PROBE in your configuration."
  1308. #elif !defined(Z_CLEARANCE_BETWEEN_PROBES)
  1309. #error "You must define Z_CLEARANCE_BETWEEN_PROBES in your configuration."
  1310. #elif Z_CLEARANCE_DEPLOY_PROBE < 0
  1311. #error "Probes need Z_CLEARANCE_DEPLOY_PROBE >= 0."
  1312. #elif Z_CLEARANCE_BETWEEN_PROBES < 0
  1313. #error "Probes need Z_CLEARANCE_BETWEEN_PROBES >= 0."
  1314. #elif Z_AFTER_PROBING < 0
  1315. #error "Probes need Z_AFTER_PROBING >= 0."
  1316. #endif
  1317. #if MULTIPLE_PROBING > 0 || EXTRA_PROBING > 0
  1318. #if MULTIPLE_PROBING == 0
  1319. #error "EXTRA_PROBING requires MULTIPLE_PROBING."
  1320. #elif MULTIPLE_PROBING < 2
  1321. #error "MULTIPLE_PROBING must be 2 or more."
  1322. #elif MULTIPLE_PROBING <= EXTRA_PROBING
  1323. #error "EXTRA_PROBING must be less than MULTIPLE_PROBING."
  1324. #endif
  1325. #endif
  1326. #if Z_PROBE_LOW_POINT > 0
  1327. #error "Z_PROBE_LOW_POINT must be less than or equal to 0."
  1328. #endif
  1329. #if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING)
  1330. #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable it or comment out this line to continue."
  1331. #endif
  1332. #else
  1333. /**
  1334. * Require some kind of probe for bed leveling and probe testing
  1335. */
  1336. #if HAS_ABL_NOT_UBL && !PROBE_SELECTED
  1337. #error "Auto Bed Leveling requires one of these: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or a Z Servo."
  1338. #endif
  1339. #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
  1340. #error "Z_MIN_PROBE_REPEATABILITY_TEST requires a probe: FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
  1341. #endif
  1342. #endif
  1343. /**
  1344. * Allow only one bed leveling option to be defined
  1345. */
  1346. #if MANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
  1347. #error "Select only one of: MESH_BED_LEVELING, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL."
  1348. #endif
  1349. /**
  1350. * Bed Leveling Requirements
  1351. */
  1352. #if ENABLED(AUTO_BED_LEVELING_UBL)
  1353. /**
  1354. * Unified Bed Leveling
  1355. */
  1356. #if IS_SCARA
  1357. #error "AUTO_BED_LEVELING_UBL does not yet support SCARA printers."
  1358. #elif DISABLED(EEPROM_SETTINGS)
  1359. #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS."
  1360. #elif !WITHIN(GRID_MAX_POINTS_X, 3, 15) || !WITHIN(GRID_MAX_POINTS_Y, 3, 15)
  1361. #error "GRID_MAX_POINTS_[XY] must be a whole number between 3 and 15."
  1362. #elif !defined(RESTORE_LEVELING_AFTER_G28) && !defined(ENABLE_LEVELING_AFTER_G28)
  1363. #error "AUTO_BED_LEVELING_UBL used to enable RESTORE_LEVELING_AFTER_G28. To keep this behavior enable RESTORE_LEVELING_AFTER_G28. Otherwise define it as 'false'."
  1364. #endif
  1365. #elif HAS_ABL_NOT_UBL
  1366. /**
  1367. * Auto Bed Leveling
  1368. */
  1369. /**
  1370. * Delta and SCARA have limited bed leveling options
  1371. */
  1372. #if IS_SCARA && DISABLED(AUTO_BED_LEVELING_BILINEAR)
  1373. #error "SCARA machines can only use the AUTO_BED_LEVELING_BILINEAR leveling option."
  1374. #endif
  1375. #elif ENABLED(MESH_BED_LEVELING)
  1376. // Mesh Bed Leveling
  1377. #if ENABLED(DELTA)
  1378. #error "MESH_BED_LEVELING is not compatible with DELTA printers."
  1379. #elif GRID_MAX_POINTS_X > 9 || GRID_MAX_POINTS_Y > 9
  1380. #error "GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y must be less than 10 for MBL."
  1381. #endif
  1382. #endif
  1383. #if ALL(HAS_LEVELING, RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28)
  1384. #error "Only enable RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28, but not both."
  1385. #endif
  1386. #if HAS_MESH && HAS_CLASSIC_JERK
  1387. static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling.");
  1388. #endif
  1389. #if ENABLED(G26_MESH_VALIDATION)
  1390. #if !EXTRUDERS
  1391. #error "G26_MESH_VALIDATION requires at least one extruder."
  1392. #elif !HAS_MESH
  1393. #error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL."
  1394. #endif
  1395. #endif
  1396. #if ENABLED(MESH_EDIT_GFX_OVERLAY) && !BOTH(AUTO_BED_LEVELING_UBL, HAS_MARLINUI_U8GLIB)
  1397. #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD."
  1398. #endif
  1399. #if ENABLED(G29_RETRY_AND_RECOVER)
  1400. #if ENABLED(AUTO_BED_LEVELING_UBL)
  1401. #error "G29_RETRY_AND_RECOVER is not compatible with UBL."
  1402. #elif ENABLED(MESH_BED_LEVELING)
  1403. #error "G29_RETRY_AND_RECOVER is not compatible with MESH_BED_LEVELING."
  1404. #endif
  1405. #endif
  1406. /**
  1407. * LCD_BED_LEVELING requirements
  1408. */
  1409. #if ENABLED(LCD_BED_LEVELING)
  1410. #if !HAS_LCD_MENU
  1411. #error "LCD_BED_LEVELING requires a programmable LCD controller."
  1412. #elif !(ENABLED(MESH_BED_LEVELING) || HAS_ABL_NOT_UBL)
  1413. #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or AUTO_BED_LEVELING."
  1414. #endif
  1415. #endif
  1416. /**
  1417. * Homing
  1418. */
  1419. constexpr float hbm[] = HOMING_BUMP_MM;
  1420. static_assert(COUNT(hbm) == XYZ, "HOMING_BUMP_MM requires X, Y, and Z elements.");
  1421. static_assert(hbm[X_AXIS] >= 0, "HOMING_BUMP_MM.X must be greater than or equal to 0.");
  1422. static_assert(hbm[Y_AXIS] >= 0, "HOMING_BUMP_MM.Y must be greater than or equal to 0.");
  1423. static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal to 0.");
  1424. #if ENABLED(CODEPENDENT_XY_HOMING)
  1425. #if ENABLED(QUICK_HOME)
  1426. #error "QUICK_HOME is incompatible with CODEPENDENT_XY_HOMING."
  1427. #elif IS_KINEMATIC
  1428. #error "CODEPENDENT_XY_HOMING requires a Cartesian setup."
  1429. #endif
  1430. #endif
  1431. /**
  1432. * Make sure Z_SAFE_HOMING point is reachable
  1433. */
  1434. #if ENABLED(Z_SAFE_HOMING)
  1435. static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, X_MIN_POS, X_MAX_POS), "Z_SAFE_HOMING_X_POINT can't be reached by the nozzle.");
  1436. static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, Y_MIN_POS, Y_MAX_POS), "Z_SAFE_HOMING_Y_POINT can't be reached by the nozzle.");
  1437. #endif
  1438. /**
  1439. * Make sure DISABLE_[XYZ] compatible with selected homing options
  1440. */
  1441. #if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z)
  1442. #if EITHER(HOME_AFTER_DEACTIVATE, Z_SAFE_HOMING)
  1443. #error "DISABLE_[XYZ] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING."
  1444. #endif
  1445. #endif
  1446. /**
  1447. * Filament Width Sensor
  1448. */
  1449. #if ENABLED(FILAMENT_WIDTH_SENSOR)
  1450. #if !HAS_FILAMENT_WIDTH_SENSOR
  1451. #error "FILAMENT_WIDTH_SENSOR requires a FILWIDTH_PIN to be defined."
  1452. #elif ENABLED(NO_VOLUMETRICS)
  1453. #error "FILAMENT_WIDTH_SENSOR requires NO_VOLUMETRICS to be disabled."
  1454. #endif
  1455. #endif
  1456. /**
  1457. * System Power Sensor
  1458. */
  1459. #if ENABLED(POWER_MONITOR_CURRENT) && !PIN_EXISTS(POWER_MONITOR_CURRENT)
  1460. #error "POWER_MONITOR_CURRENT requires a valid POWER_MONITOR_CURRENT_PIN."
  1461. #elif ENABLED(POWER_MONITOR_VOLTAGE) && !PIN_EXISTS(POWER_MONITOR_VOLTAGE)
  1462. #error "POWER_MONITOR_VOLTAGE requires POWER_MONITOR_VOLTAGE_PIN to be defined."
  1463. #elif BOTH(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE) && POWER_MONITOR_CURRENT_PIN == POWER_MONITOR_VOLTAGE_PIN
  1464. #error "POWER_MONITOR_CURRENT_PIN and POWER_MONITOR_VOLTAGE_PIN must be different."
  1465. #endif
  1466. /**
  1467. * Volumetric Extruder Limit
  1468. */
  1469. #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
  1470. #if ENABLED(NO_VOLUMETRICS)
  1471. #error "VOLUMETRIC_EXTRUDER_LIMIT requires NO_VOLUMETRICS to be disabled."
  1472. #elif MIN_STEPS_PER_SEGMENT > 1
  1473. #error "VOLUMETRIC_EXTRUDER_LIMIT is not compatible with MIN_STEPS_PER_SEGMENT greater than 1."
  1474. #endif
  1475. #endif
  1476. /**
  1477. * ULTIPANEL encoder
  1478. */
  1479. #if IS_ULTIPANEL && NONE(IS_NEWPANEL, SR_LCD_2W_NL) && !defined(SHIFT_CLK)
  1480. #error "ULTIPANEL controllers require some kind of encoder."
  1481. #endif
  1482. #if ENCODER_PULSES_PER_STEP < 0
  1483. #error "ENCODER_PULSES_PER_STEP should not be negative, use REVERSE_MENU_DIRECTION instead."
  1484. #endif
  1485. /**
  1486. * SAV_3DGLCD display options
  1487. */
  1488. #if ENABLED(SAV_3DGLCD)
  1489. #if NONE(U8GLIB_SSD1306, U8GLIB_SH1106)
  1490. #error "Enable a SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106."
  1491. #elif BOTH(U8GLIB_SSD1306, U8GLIB_SH1106)
  1492. #error "Only enable one SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106."
  1493. #endif
  1494. #endif
  1495. /**
  1496. * Allen Key
  1497. * Deploying the Allen Key probe uses big moves in z direction. Too dangerous for an unhomed z-axis.
  1498. */
  1499. #if BOTH(Z_PROBE_ALLEN_KEY, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && (Z_HOME_DIR < 0)
  1500. #error "You can't home to a Z min endstop with a Z_PROBE_ALLEN_KEY."
  1501. #endif
  1502. /**
  1503. * Dual X Carriage requirements
  1504. */
  1505. #if ENABLED(DUAL_X_CARRIAGE)
  1506. #if EXTRUDERS < 2
  1507. #error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
  1508. #elif ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
  1509. #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, COREZX, or MARKFORGED_XY."
  1510. #elif !GOOD_AXIS_PINS(X2)
  1511. #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
  1512. #elif !HAS_X_MAX
  1513. #error "DUAL_X_CARRIAGE requires USE_XMAX_PLUG and an X Max Endstop."
  1514. #elif !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS)
  1515. #error "DUAL_X_CARRIAGE requires X2_HOME_POS, X2_MIN_POS, and X2_MAX_POS."
  1516. #elif X_HOME_DIR != -1 || X2_HOME_DIR != 1
  1517. #error "DUAL_X_CARRIAGE requires X_HOME_DIR -1 and X2_HOME_DIR 1."
  1518. #endif
  1519. #endif
  1520. #undef GOOD_AXIS_PINS
  1521. /**
  1522. * Make sure auto fan pins don't conflict with the fan pin
  1523. */
  1524. #if HAS_AUTO_FAN
  1525. #if HAS_FAN0
  1526. #if E0_AUTO_FAN_PIN == FAN_PIN
  1527. #error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN."
  1528. #elif E1_AUTO_FAN_PIN == FAN_PIN
  1529. #error "You cannot set E1_AUTO_FAN_PIN equal to FAN_PIN."
  1530. #elif E2_AUTO_FAN_PIN == FAN_PIN
  1531. #error "You cannot set E2_AUTO_FAN_PIN equal to FAN_PIN."
  1532. #elif E3_AUTO_FAN_PIN == FAN_PIN
  1533. #error "You cannot set E3_AUTO_FAN_PIN equal to FAN_PIN."
  1534. #endif
  1535. #endif
  1536. #endif
  1537. #if HAS_FAN0 && CONTROLLER_FAN_PIN == FAN_PIN
  1538. #error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
  1539. #endif
  1540. #if ENABLED(USE_CONTROLLER_FAN)
  1541. #if !HAS_CONTROLLER_FAN
  1542. #error "USE_CONTROLLER_FAN requires a CONTROLLER_FAN_PIN. Define in Configuration_adv.h."
  1543. #elif E0_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1544. #error "You cannot set E0_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1545. #elif E1_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1546. #error "You cannot set E1_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1547. #elif E2_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1548. #error "You cannot set E2_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1549. #elif E3_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1550. #error "You cannot set E3_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1551. #endif
  1552. #endif
  1553. /**
  1554. * Case Light requirements
  1555. */
  1556. #if ENABLED(CASE_LIGHT_ENABLE)
  1557. #if !PIN_EXISTS(CASE_LIGHT)
  1558. #error "CASE_LIGHT_ENABLE requires CASE_LIGHT_PIN to be defined."
  1559. #elif CASE_LIGHT_PIN == FAN_PIN
  1560. #error "CASE_LIGHT_PIN conflicts with FAN_PIN. Resolve before continuing."
  1561. #endif
  1562. #endif
  1563. /**
  1564. * Required custom thermistor settings
  1565. */
  1566. #if HEATER_0_USER_THERMISTOR && !(defined(HOTEND0_PULLUP_RESISTOR_OHMS) && defined(HOTEND0_RESISTANCE_25C_OHMS) && defined(HOTEND0_BETA))
  1567. #error "TEMP_SENSOR_0 1000 requires HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS and HOTEND0_BETA in Configuration_adv.h."
  1568. #elif HEATER_1_USER_THERMISTOR && !(defined(HOTEND1_PULLUP_RESISTOR_OHMS) && defined(HOTEND1_RESISTANCE_25C_OHMS) && defined(HOTEND1_BETA))
  1569. #error "TEMP_SENSOR_1 1000 requires HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS and HOTEND1_BETA in Configuration_adv.h."
  1570. #elif HEATER_2_USER_THERMISTOR && !(defined(HOTEND2_PULLUP_RESISTOR_OHMS) && defined(HOTEND2_RESISTANCE_25C_OHMS) && defined(HOTEND2_BETA))
  1571. #error "TEMP_SENSOR_2 1000 requires HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS and HOTEND2_BETA in Configuration_adv.h."
  1572. #elif HEATER_3_USER_THERMISTOR && !(defined(HOTEND3_PULLUP_RESISTOR_OHMS) && defined(HOTEND3_RESISTANCE_25C_OHMS) && defined(HOTEND3_BETA))
  1573. #error "TEMP_SENSOR_3 1000 requires HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS and HOTEND3_BETA in Configuration_adv.h."
  1574. #elif HEATER_4_USER_THERMISTOR && !(defined(HOTEND4_PULLUP_RESISTOR_OHMS) && defined(HOTEND4_RESISTANCE_25C_OHMS) && defined(HOTEND4_BETA))
  1575. #error "TEMP_SENSOR_4 1000 requires HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS and HOTEND4_BETA in Configuration_adv.h."
  1576. #elif HEATER_5_USER_THERMISTOR && !(defined(HOTEND5_PULLUP_RESISTOR_OHMS) && defined(HOTEND5_RESISTANCE_25C_OHMS) && defined(HOTEND5_BETA))
  1577. #error "TEMP_SENSOR_5 1000 requires HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS and HOTEND5_BETA in Configuration_adv.h."
  1578. #elif HEATER_6_USER_THERMISTOR && !(defined(HOTEND6_PULLUP_RESISTOR_OHMS) && defined(HOTEND6_RESISTANCE_25C_OHMS) && defined(HOTEND6_BETA))
  1579. #error "TEMP_SENSOR_6 1000 requires HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS and HOTEND6_BETA in Configuration_adv.h."
  1580. #elif HEATER_7_USER_THERMISTOR && !(defined(HOTEND7_PULLUP_RESISTOR_OHMS) && defined(HOTEND7_RESISTANCE_25C_OHMS) && defined(HOTEND7_BETA))
  1581. #error "TEMP_SENSOR_7 1000 requires HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS and HOTEND7_BETA in Configuration_adv.h."
  1582. #elif HEATER_BED_USER_THERMISTOR && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA))
  1583. #error "TEMP_SENSOR_BED 1000 requires BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS and BED_BETA in Configuration_adv.h."
  1584. #elif HEATER_CHAMBER_USER_THERMISTOR && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA))
  1585. #error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
  1586. #endif
  1587. /**
  1588. * Pins and Sensor IDs must be set for each heater
  1589. */
  1590. #if HEATER_0_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS)
  1591. #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
  1592. #elif HAS_HOTEND && !HAS_TEMP_HOTEND && !HEATER_0_DUMMY_THERMISTOR
  1593. #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
  1594. #elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
  1595. #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
  1596. #endif
  1597. #if HAS_MULTI_HOTEND
  1598. #if HEATER_1_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS2)
  1599. #error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board."
  1600. #elif TEMP_SENSOR_1 == 0
  1601. #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
  1602. #elif !ANY_PIN(TEMP_1, MAX6675_SS2) && !HEATER_1_DUMMY_THERMISTOR
  1603. #error "TEMP_1_PIN not defined for this board."
  1604. #elif ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
  1605. #error "HOTENDS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT."
  1606. #endif
  1607. #if HOTENDS > 2
  1608. #if TEMP_SENSOR_2 == 0
  1609. #error "TEMP_SENSOR_2 is required with 3 or more HOTENDS."
  1610. #elif !HAS_HEATER_2
  1611. #error "HEATER_2_PIN not defined for this board."
  1612. #elif !PIN_EXISTS(TEMP_2) && !HEATER_2_DUMMY_THERMISTOR
  1613. #error "TEMP_2_PIN not defined for this board."
  1614. #endif
  1615. #if HOTENDS > 3
  1616. #if TEMP_SENSOR_3 == 0
  1617. #error "TEMP_SENSOR_3 is required with 4 or more HOTENDS."
  1618. #elif !HAS_HEATER_3
  1619. #error "HEATER_3_PIN not defined for this board."
  1620. #elif !PIN_EXISTS(TEMP_3) && !HEATER_3_DUMMY_THERMISTOR
  1621. #error "TEMP_3_PIN not defined for this board."
  1622. #endif
  1623. #if HOTENDS > 4
  1624. #if TEMP_SENSOR_4 == 0
  1625. #error "TEMP_SENSOR_4 is required with 5 or more HOTENDS."
  1626. #elif !HAS_HEATER_4
  1627. #error "HEATER_4_PIN not defined for this board."
  1628. #elif !PIN_EXISTS(TEMP_4) && !HEATER_4_DUMMY_THERMISTOR
  1629. #error "TEMP_4_PIN not defined for this board."
  1630. #endif
  1631. #if HOTENDS > 5
  1632. #if TEMP_SENSOR_5 == 0
  1633. #error "TEMP_SENSOR_5 is required with 6 HOTENDS."
  1634. #elif !HAS_HEATER_5
  1635. #error "HEATER_5_PIN not defined for this board."
  1636. #elif !PIN_EXISTS(TEMP_5) && !HEATER_5_DUMMY_THERMISTOR
  1637. #error "TEMP_5_PIN not defined for this board."
  1638. #endif
  1639. #if HOTENDS > 6
  1640. #if TEMP_SENSOR_6 == 0
  1641. #error "TEMP_SENSOR_6 is required with 6 HOTENDS."
  1642. #elif !HAS_HEATER_6
  1643. #error "HEATER_6_PIN not defined for this board."
  1644. #elif !PIN_EXISTS(TEMP_6) && !HEATER_6_DUMMY_THERMISTOR
  1645. #error "TEMP_6_PIN not defined for this board."
  1646. #endif
  1647. #if HOTENDS > 7
  1648. #if TEMP_SENSOR_7 == 0
  1649. #error "TEMP_SENSOR_7 is required with 7 HOTENDS."
  1650. #elif !HAS_HEATER_7
  1651. #error "HEATER_7_PIN not defined for this board."
  1652. #elif !PIN_EXISTS(TEMP_7) && !HEATER_7_DUMMY_THERMISTOR
  1653. #error "TEMP_7_PIN not defined for this board."
  1654. #endif
  1655. #elif TEMP_SENSOR_7 != 0
  1656. #error "TEMP_SENSOR_7 shouldn't be set with only 7 HOTENDS."
  1657. #endif
  1658. #elif TEMP_SENSOR_6 != 0
  1659. #error "TEMP_SENSOR_6 shouldn't be set with only 6 HOTENDS."
  1660. #elif TEMP_SENSOR_7 != 0
  1661. #error "TEMP_SENSOR_7 shouldn't be set with only 6 HOTENDS."
  1662. #endif
  1663. #elif TEMP_SENSOR_5 != 0
  1664. #error "TEMP_SENSOR_5 shouldn't be set with only 5 HOTENDS."
  1665. #elif TEMP_SENSOR_6 != 0
  1666. #error "TEMP_SENSOR_6 shouldn't be set with only 5 HOTENDS."
  1667. #elif TEMP_SENSOR_7 != 0
  1668. #error "TEMP_SENSOR_7 shouldn't be set with only 5 HOTENDS."
  1669. #endif
  1670. #elif TEMP_SENSOR_4 != 0
  1671. #error "TEMP_SENSOR_4 shouldn't be set with only 4 HOTENDS."
  1672. #elif TEMP_SENSOR_5 != 0
  1673. #error "TEMP_SENSOR_5 shouldn't be set with only 4 HOTENDS."
  1674. #elif TEMP_SENSOR_6 != 0
  1675. #error "TEMP_SENSOR_6 shouldn't be set with only 4 HOTENDS."
  1676. #elif TEMP_SENSOR_7 != 0
  1677. #error "TEMP_SENSOR_7 shouldn't be set with only 4 HOTENDS."
  1678. #endif
  1679. #elif TEMP_SENSOR_3 != 0
  1680. #error "TEMP_SENSOR_3 shouldn't be set with only 3 HOTENDS."
  1681. #elif TEMP_SENSOR_4 != 0
  1682. #error "TEMP_SENSOR_4 shouldn't be set with only 3 HOTENDS."
  1683. #elif TEMP_SENSOR_5 != 0
  1684. #error "TEMP_SENSOR_5 shouldn't be set with only 3 HOTENDS."
  1685. #elif TEMP_SENSOR_6 != 0
  1686. #error "TEMP_SENSOR_6 shouldn't be set with only 3 HOTENDS."
  1687. #elif TEMP_SENSOR_7 != 0
  1688. #error "TEMP_SENSOR_7 shouldn't be set with only 3 HOTENDS."
  1689. #endif
  1690. #elif TEMP_SENSOR_2 != 0
  1691. #error "TEMP_SENSOR_2 shouldn't be set with only 2 HOTENDS."
  1692. #elif TEMP_SENSOR_3 != 0
  1693. #error "TEMP_SENSOR_3 shouldn't be set with only 2 HOTENDS."
  1694. #elif TEMP_SENSOR_4 != 0
  1695. #error "TEMP_SENSOR_4 shouldn't be set with only 2 HOTENDS."
  1696. #elif TEMP_SENSOR_5 != 0
  1697. #error "TEMP_SENSOR_5 shouldn't be set with only 2 HOTENDS."
  1698. #elif TEMP_SENSOR_6 != 0
  1699. #error "TEMP_SENSOR_6 shouldn't be set with only 2 HOTENDS."
  1700. #elif TEMP_SENSOR_7 != 0
  1701. #error "TEMP_SENSOR_7 shouldn't be set with only 2 HOTENDS."
  1702. #endif
  1703. #elif TEMP_SENSOR_1 != 0 && DISABLED(TEMP_SENSOR_1_AS_REDUNDANT)
  1704. #error "TEMP_SENSOR_1 shouldn't be set with only 1 HOTEND."
  1705. #elif TEMP_SENSOR_2 != 0
  1706. #error "TEMP_SENSOR_2 shouldn't be set with only 1 HOTEND."
  1707. #elif TEMP_SENSOR_3 != 0
  1708. #error "TEMP_SENSOR_3 shouldn't be set with only 1 HOTEND."
  1709. #elif TEMP_SENSOR_4 != 0
  1710. #error "TEMP_SENSOR_4 shouldn't be set with only 1 HOTEND."
  1711. #elif TEMP_SENSOR_5 != 0
  1712. #error "TEMP_SENSOR_5 shouldn't be set with only 1 HOTEND."
  1713. #elif TEMP_SENSOR_6 != 0
  1714. #error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND."
  1715. #elif TEMP_SENSOR_7 != 0
  1716. #error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND."
  1717. #endif
  1718. #if TEMP_SENSOR_CHAMBER && !PIN_EXISTS(TEMP_CHAMBER)
  1719. #error "TEMP_SENSOR_CHAMBER requires TEMP_CHAMBER_PIN."
  1720. #endif
  1721. #if ENABLED(CHAMBER_FAN) && !(defined(CHAMBER_FAN_MODE) && WITHIN(CHAMBER_FAN_MODE, 0, 2))
  1722. #error "CHAMBER_FAN_MODE must be between 0 and 2."
  1723. #endif
  1724. #if ENABLED(CHAMBER_VENT)
  1725. #ifndef CHAMBER_VENT_SERVO_NR
  1726. #error "CHAMBER_VENT_SERVO_NR is required for CHAMBER SERVO."
  1727. #elif !NUM_SERVOS
  1728. #error "NUM_SERVOS is required for a Heated Chamber vent servo (CHAMBER_VENT_SERVO_NR)."
  1729. #elif CHAMBER_VENT_SERVO_NR >= NUM_SERVOS
  1730. #error "CHAMBER_VENT_SERVO_NR must be smaller than NUM_SERVOS."
  1731. #elif HAS_Z_SERVO_PROBE && CHAMBER_VENT_SERVO_NR == Z_PROBE_SERVO_NR
  1732. #error "CHAMBER SERVO is already used by BLTOUCH."
  1733. #elif CHAMBER_VENT_SERVO_NR == 0 && !PIN_EXISTS(SERVO0)
  1734. #error "SERVO0_PIN must be defined for your Heated Chamber vent servo."
  1735. #elif CHAMBER_VENT_SERVO_NR == 1 && !PIN_EXISTS(SERVO1)
  1736. #error "SERVO1_PIN must be defined for your Heated Chamber vent servo."
  1737. #elif CHAMBER_VENT_SERVO_NR == 2 && !PIN_EXISTS(SERVO2)
  1738. #error "SERVO2_PIN must be defined for your Heated Chamber vent servo."
  1739. #elif CHAMBER_VENT_SERVO_NR == 3 && !PIN_EXISTS(SERVO3)
  1740. #error "SERVO3_PIN must be defined for your Heated Chamber vent servo."
  1741. #endif
  1742. #endif
  1743. #if TEMP_SENSOR_PROBE
  1744. #if !PIN_EXISTS(TEMP_PROBE)
  1745. #error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
  1746. #elif !HAS_TEMP_ADC_PROBE
  1747. #error "TEMP_PROBE_PIN must be an ADC pin."
  1748. #elif !ENABLED(FIX_MOUNTED_PROBE)
  1749. #error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
  1750. #endif
  1751. #endif
  1752. #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) && TEMP_SENSOR_1 == 0
  1753. #error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
  1754. #endif
  1755. #if MAX6675_0_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_0) && defined(MAX31865_CALIBRATION_OHMS_0))
  1756. #error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0 is MAX31865."
  1757. #elif MAX6675_1_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_1) && defined(MAX31865_CALIBRATION_OHMS_1))
  1758. #error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1 is MAX31865."
  1759. #endif
  1760. /**
  1761. * Test Heater, Temp Sensor, and Extruder Pins
  1762. */
  1763. #if !HAS_HEATER_0 && EXTRUDERS
  1764. #error "HEATER_0_PIN not defined for this board."
  1765. #elif !ANY_PIN(TEMP_0, MAX6675_SS)
  1766. #error "TEMP_0_PIN not defined for this board."
  1767. #elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR))
  1768. #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
  1769. #elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
  1770. #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
  1771. #elif EXTRUDERS && TEMP_SENSOR_0 == 0
  1772. #error "TEMP_SENSOR_0 is required if there are any extruders."
  1773. #endif
  1774. /**
  1775. * Temperature status LEDs
  1776. */
  1777. #if ENABLED(TEMP_STAT_LEDS) && !ANY_PIN(STAT_LED_RED, STAT_LED_BLUE)
  1778. #error "TEMP_STAT_LEDS requires STAT_LED_RED_PIN or STAT_LED_BLUE_PIN, preferably both."
  1779. #endif
  1780. /**
  1781. * LED Control Menu
  1782. */
  1783. #if ENABLED(LED_CONTROL_MENU) && !HAS_COLOR_LEDS
  1784. #error "LED_CONTROL_MENU requires BLINKM, RGB_LED, RGBW_LED, PCA9533, PCA9632, or NEOPIXEL_LED."
  1785. #endif
  1786. /**
  1787. * LED Backlight Timeout
  1788. */
  1789. #if defined(LED_BACKLIGHT_TIMEOUT) && !(ENABLED(PSU_CONTROL) && ANY(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864))
  1790. #error "LED_BACKLIGHT_TIMEOUT requires a FYSETC Mini Panel and a Power Switch."
  1791. #endif
  1792. /**
  1793. * Basic multi hotend duplication mode
  1794. */
  1795. #if ENABLED(MULTI_NOZZLE_DUPLICATION)
  1796. #if HOTENDS < 2
  1797. #error "MULTI_NOZZLE_DUPLICATION requires 2 or more hotends."
  1798. #elif ENABLED(DUAL_X_CARRIAGE)
  1799. #error "MULTI_NOZZLE_DUPLICATION is incompatible with DUAL_X_CARRIAGE."
  1800. #elif ENABLED(SINGLENOZZLE)
  1801. #error "MULTI_NOZZLE_DUPLICATION is incompatible with SINGLENOZZLE."
  1802. #elif ENABLED(MIXING_EXTRUDER)
  1803. #error "MULTI_NOZZLE_DUPLICATION is incompatible with MIXING_EXTRUDER."
  1804. #elif ENABLED(SWITCHING_EXTRUDER)
  1805. #error "MULTI_NOZZLE_DUPLICATION is incompatible with SWITCHING_EXTRUDER."
  1806. #endif
  1807. #endif
  1808. /**
  1809. * Test Extruder Stepper Pins
  1810. */
  1811. #if E_STEPPERS
  1812. #if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
  1813. #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
  1814. #endif
  1815. #if E_STEPPERS > 1
  1816. #if !(PINS_EXIST(E1_STEP, E1_DIR) && HAS_E1_ENABLE)
  1817. #error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board."
  1818. #endif
  1819. #if E_STEPPERS > 2
  1820. #if !(PINS_EXIST(E2_STEP, E2_DIR) && HAS_E2_ENABLE)
  1821. #error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board."
  1822. #endif
  1823. #if E_STEPPERS > 3
  1824. #if !(PINS_EXIST(E3_STEP, E3_DIR) && HAS_E3_ENABLE)
  1825. #error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board."
  1826. #endif
  1827. #if E_STEPPERS > 4
  1828. #if !(PINS_EXIST(E4_STEP, E4_DIR) && HAS_E4_ENABLE)
  1829. #error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board."
  1830. #endif
  1831. #if E_STEPPERS > 5
  1832. #if !(PINS_EXIST(E5_STEP, E5_DIR) && HAS_E5_ENABLE)
  1833. #error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board."
  1834. #endif
  1835. #if E_STEPPERS > 6
  1836. #if !(PINS_EXIST(E6_STEP, E6_DIR) && HAS_E6_ENABLE)
  1837. #error "E6_STEP_PIN, E6_DIR_PIN, or E6_ENABLE_PIN not defined for this board."
  1838. #endif
  1839. #if E_STEPPERS > 7
  1840. #if !(PINS_EXIST(E7_STEP, E7_DIR) && HAS_E7_ENABLE)
  1841. #error "E7_STEP_PIN, E7_DIR_PIN, or E7_ENABLE_PIN not defined for this board."
  1842. #endif
  1843. #endif // E_STEPPERS > 7
  1844. #endif // E_STEPPERS > 6
  1845. #endif // E_STEPPERS > 5
  1846. #endif // E_STEPPERS > 4
  1847. #endif // E_STEPPERS > 3
  1848. #endif // E_STEPPERS > 2
  1849. #endif // E_STEPPERS > 1
  1850. #endif // E_STEPPERS
  1851. /**
  1852. * Endstop Tests
  1853. */
  1854. #define _PLUG_UNUSED_TEST(A,P) (DISABLED(USE_##P##MIN_PLUG, USE_##P##MAX_PLUG) \
  1855. && !(ENABLED(A##_DUAL_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) \
  1856. && !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) )
  1857. #define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z))
  1858. // At least 3 endstop plugs must be used
  1859. #if _AXIS_PLUG_UNUSED_TEST(X)
  1860. #error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG."
  1861. #endif
  1862. #if _AXIS_PLUG_UNUSED_TEST(Y)
  1863. #error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG."
  1864. #endif
  1865. #if _AXIS_PLUG_UNUSED_TEST(Z)
  1866. #error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
  1867. #endif
  1868. // Delta and Cartesian use 3 homing endstops
  1869. #if NONE(IS_SCARA, SPI_ENDSTOPS)
  1870. #if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
  1871. #error "Enable USE_XMIN_PLUG when homing X to MIN."
  1872. #elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
  1873. #error "Enable USE_XMAX_PLUG when homing X to MAX."
  1874. #elif Y_HOME_DIR < 0 && DISABLED(USE_YMIN_PLUG)
  1875. #error "Enable USE_YMIN_PLUG when homing Y to MIN."
  1876. #elif Y_HOME_DIR > 0 && DISABLED(USE_YMAX_PLUG)
  1877. #error "Enable USE_YMAX_PLUG when homing Y to MAX."
  1878. #endif
  1879. #endif
  1880. // Z homing direction and plug usage flags
  1881. #if Z_HOME_DIR < 0 && NONE(USE_ZMIN_PLUG, HOMING_Z_WITH_PROBE)
  1882. #error "Enable USE_ZMIN_PLUG when homing Z to MIN."
  1883. #elif Z_HOME_DIR > 0 && ENABLED(USE_PROBE_FOR_Z_HOMING)
  1884. #error "Z_HOME_DIR must be -1 when homing Z with the probe."
  1885. #elif BOTH(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS)
  1886. #error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING."
  1887. #elif Z_HOME_DIR > 0 && DISABLED(USE_ZMAX_PLUG)
  1888. #error "Enable USE_ZMAX_PLUG when homing Z to MAX."
  1889. #endif
  1890. #if BOTH(HOME_Z_FIRST, USE_PROBE_FOR_Z_HOMING)
  1891. #error "HOME_Z_FIRST can't be used when homing Z with a probe."
  1892. #endif
  1893. // Dual/multiple endstops requirements
  1894. #if ENABLED(X_DUAL_ENDSTOPS)
  1895. #if !X2_USE_ENDSTOP
  1896. #error "You must set X2_USE_ENDSTOP with X_DUAL_ENDSTOPS."
  1897. #elif X2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1898. #error "USE_XMIN_PLUG is required when X2_USE_ENDSTOP is _XMIN_."
  1899. #elif X2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1900. #error "USE_XMAX_PLUG is required when X2_USE_ENDSTOP is _XMAX_."
  1901. #elif X2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1902. #error "USE_YMIN_PLUG is required when X2_USE_ENDSTOP is _YMIN_."
  1903. #elif X2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1904. #error "USE_YMAX_PLUG is required when X2_USE_ENDSTOP is _YMAX_."
  1905. #elif X2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1906. #error "USE_ZMIN_PLUG is required when X2_USE_ENDSTOP is _ZMIN_."
  1907. #elif X2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1908. #error "USE_ZMAX_PLUG is required when X2_USE_ENDSTOP is _ZMAX_."
  1909. #elif !HAS_X2_MIN && !HAS_X2_MAX
  1910. #error "X2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1911. #elif ENABLED(DELTA)
  1912. #error "X_DUAL_ENDSTOPS is not compatible with DELTA."
  1913. #endif
  1914. #endif
  1915. #if ENABLED(Y_DUAL_ENDSTOPS)
  1916. #if !Y2_USE_ENDSTOP
  1917. #error "You must set Y2_USE_ENDSTOP with Y_DUAL_ENDSTOPS."
  1918. #elif Y2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1919. #error "USE_XMIN_PLUG is required when Y2_USE_ENDSTOP is _XMIN_."
  1920. #elif Y2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1921. #error "USE_XMAX_PLUG is required when Y2_USE_ENDSTOP is _XMAX_."
  1922. #elif Y2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1923. #error "USE_YMIN_PLUG is required when Y2_USE_ENDSTOP is _YMIN_."
  1924. #elif Y2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1925. #error "USE_YMAX_PLUG is required when Y2_USE_ENDSTOP is _YMAX_."
  1926. #elif Y2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1927. #error "USE_ZMIN_PLUG is required when Y2_USE_ENDSTOP is _ZMIN_."
  1928. #elif Y2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1929. #error "USE_ZMAX_PLUG is required when Y2_USE_ENDSTOP is _ZMAX_."
  1930. #elif !HAS_Y2_MIN && !HAS_Y2_MAX
  1931. #error "Y2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1932. #elif ENABLED(DELTA)
  1933. #error "Y_DUAL_ENDSTOPS is not compatible with DELTA."
  1934. #endif
  1935. #endif
  1936. #if ENABLED(Z_MULTI_ENDSTOPS)
  1937. #if !Z2_USE_ENDSTOP
  1938. #error "You must set Z2_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 2."
  1939. #elif Z2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1940. #error "USE_XMIN_PLUG is required when Z2_USE_ENDSTOP is _XMIN_."
  1941. #elif Z2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1942. #error "USE_XMAX_PLUG is required when Z2_USE_ENDSTOP is _XMAX_."
  1943. #elif Z2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1944. #error "USE_YMIN_PLUG is required when Z2_USE_ENDSTOP is _YMIN_."
  1945. #elif Z2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1946. #error "USE_YMAX_PLUG is required when Z2_USE_ENDSTOP is _YMAX_."
  1947. #elif Z2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1948. #error "USE_ZMIN_PLUG is required when Z2_USE_ENDSTOP is _ZMIN_."
  1949. #elif Z2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1950. #error "USE_ZMAX_PLUG is required when Z2_USE_ENDSTOP is _ZMAX_."
  1951. #elif !HAS_Z2_MIN && !HAS_Z2_MAX
  1952. #error "Z2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1953. #elif ENABLED(DELTA)
  1954. #error "Z_MULTI_ENDSTOPS is not compatible with DELTA."
  1955. #endif
  1956. #if NUM_Z_STEPPER_DRIVERS >= 3
  1957. #if !Z3_USE_ENDSTOP
  1958. #error "You must set Z3_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 3."
  1959. #elif Z3_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1960. #error "USE_XMIN_PLUG is required when Z3_USE_ENDSTOP is _XMIN_."
  1961. #elif Z3_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1962. #error "USE_XMAX_PLUG is required when Z3_USE_ENDSTOP is _XMAX_."
  1963. #elif Z3_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1964. #error "USE_YMIN_PLUG is required when Z3_USE_ENDSTOP is _YMIN_."
  1965. #elif Z3_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1966. #error "USE_YMAX_PLUG is required when Z3_USE_ENDSTOP is _YMAX_."
  1967. #elif Z3_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1968. #error "USE_ZMIN_PLUG is required when Z3_USE_ENDSTOP is _ZMIN_."
  1969. #elif Z3_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1970. #error "USE_ZMAX_PLUG is required when Z3_USE_ENDSTOP is _ZMAX_."
  1971. #elif !HAS_Z3_MIN && !HAS_Z3_MAX
  1972. #error "Z3_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1973. #endif
  1974. #endif
  1975. #if NUM_Z_STEPPER_DRIVERS >= 4
  1976. #if !Z4_USE_ENDSTOP
  1977. #error "You must set Z4_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 4."
  1978. #elif Z4_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1979. #error "USE_XMIN_PLUG is required when Z4_USE_ENDSTOP is _XMIN_."
  1980. #elif Z4_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1981. #error "USE_XMAX_PLUG is required when Z4_USE_ENDSTOP is _XMAX_."
  1982. #elif Z4_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1983. #error "USE_YMIN_PLUG is required when Z4_USE_ENDSTOP is _YMIN_."
  1984. #elif Z4_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1985. #error "USE_YMAX_PLUG is required when Z4_USE_ENDSTOP is _YMAX_."
  1986. #elif Z4_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1987. #error "USE_ZMIN_PLUG is required when Z4_USE_ENDSTOP is _ZMIN_."
  1988. #elif Z4_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1989. #error "USE_ZMAX_PLUG is required when Z4_USE_ENDSTOP is _ZMAX_."
  1990. #elif !HAS_Z4_MIN && !HAS_Z4_MAX
  1991. #error "Z4_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1992. #endif
  1993. #endif
  1994. #endif
  1995. #if defined(ENDSTOP_NOISE_THRESHOLD) && !WITHIN(ENDSTOP_NOISE_THRESHOLD, 2, 7)
  1996. #error "ENDSTOP_NOISE_THRESHOLD must be an integer from 2 to 7."
  1997. #endif
  1998. /**
  1999. * emergency-command parser
  2000. */
  2001. #if ENABLED(EMERGENCY_PARSER) && defined(__AVR__) && defined(USBCON)
  2002. #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
  2003. #endif
  2004. /**
  2005. * I2C bus
  2006. */
  2007. #if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
  2008. #if I2C_SLAVE_ADDRESS < 8
  2009. #error "I2C_SLAVE_ADDRESS can't be less than 8. (Addresses 0 - 7 are reserved.)"
  2010. #elif I2C_SLAVE_ADDRESS > 127
  2011. #error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
  2012. #endif
  2013. #endif
  2014. /**
  2015. * G35 Assisted Tramming
  2016. */
  2017. #if ENABLED(ASSISTED_TRAMMING) && !HAS_BED_PROBE
  2018. #error "ASSISTED_TRAMMING requires a bed probe."
  2019. #endif
  2020. /**
  2021. * G38 Probe Target
  2022. */
  2023. #if ENABLED(G38_PROBE_TARGET)
  2024. #if !HAS_BED_PROBE
  2025. #error "G38_PROBE_TARGET requires a bed probe."
  2026. #elif !IS_CARTESIAN
  2027. #error "G38_PROBE_TARGET requires a Cartesian machine."
  2028. #endif
  2029. #endif
  2030. /**
  2031. * RGB_LED Requirements
  2032. */
  2033. #define _RGB_TEST (PINS_EXIST(RGB_LED_R, RGB_LED_G, RGB_LED_B))
  2034. #if ENABLED(PRINTER_EVENT_LEDS) && !HAS_COLOR_LEDS
  2035. #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9533, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED."
  2036. #elif ENABLED(RGB_LED)
  2037. #if !_RGB_TEST
  2038. #error "RGB_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, and RGB_LED_B_PIN."
  2039. #elif ENABLED(RGBW_LED)
  2040. #error "Please enable only one of RGB_LED and RGBW_LED."
  2041. #endif
  2042. #elif ENABLED(RGBW_LED)
  2043. #if !(_RGB_TEST && PIN_EXISTS(RGB_LED_W))
  2044. #error "RGBW_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, RGB_LED_B_PIN, and RGB_LED_W_PIN."
  2045. #endif
  2046. #endif
  2047. #undef _RGB_TEST
  2048. // NeoPixel requirements
  2049. #if ENABLED(NEOPIXEL_LED)
  2050. #if !PIN_EXISTS(NEOPIXEL) || NEOPIXEL_PIXELS == 0
  2051. #error "NEOPIXEL_LED requires NEOPIXEL_PIN and NEOPIXEL_PIXELS."
  2052. #elif ENABLED(NEOPIXEL2_SEPARATE) && !(defined(NEOPIXEL2_TYPE) && PIN_EXISTS(NEOPIXEL2) && NEOPIXEL2_PIXELS > 0)
  2053. #error "NEOPIXEL2_SEPARATE requires NEOPIXEL2_TYPE, NEOPIXEL2_PIN and NEOPIXEL2_PIXELS."
  2054. #elif ENABLED(NEO2_COLOR_PRESETS) && DISABLED(NEOPIXEL2_SEPARATE)
  2055. #error "NEO2_COLOR_PRESETS requires NEOPIXEL2_SEPARATE to be enabled."
  2056. #endif
  2057. #endif
  2058. #if DISABLED(NO_COMPILE_TIME_PWM)
  2059. #define _TEST_PWM(P) PWM_PIN(P)
  2060. #else
  2061. #define _TEST_PWM(P) 1 // pass
  2062. #endif
  2063. /**
  2064. * Auto Fan check for PWM pins
  2065. */
  2066. #if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255
  2067. #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255."
  2068. #if HAS_AUTO_FAN_0
  2069. static_assert(_TEST_PWM(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF);
  2070. #elif HAS_AUTO_FAN_1
  2071. static_assert(_TEST_PWM(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF);
  2072. #elif HAS_AUTO_FAN_2
  2073. static_assert(_TEST_PWM(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF);
  2074. #elif HAS_AUTO_FAN_3
  2075. static_assert(_TEST_PWM(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF);
  2076. #elif HAS_AUTO_FAN_4
  2077. static_assert(_TEST_PWM(E4_AUTO_FAN_PIN), "E4" AF_ERR_SUFF);
  2078. #elif HAS_AUTO_FAN_5
  2079. static_assert(_TEST_PWM(E5_AUTO_FAN_PIN), "E5" AF_ERR_SUFF);
  2080. #elif HAS_AUTO_FAN_6
  2081. static_assert(_TEST_PWM(E6_AUTO_FAN_PIN), "E6" AF_ERR_SUFF);
  2082. #elif HAS_AUTO_FAN_7
  2083. static_assert(_TEST_PWM(E7_AUTO_FAN_PIN), "E7" AF_ERR_SUFF);
  2084. #endif
  2085. #endif
  2086. /**
  2087. * Make sure only one EEPROM type is enabled
  2088. */
  2089. #if ENABLED(EEPROM_SETTINGS)
  2090. #if 1 < 0 \
  2091. + ENABLED(I2C_EEPROM) \
  2092. + ENABLED(SPI_EEPROM) \
  2093. + ENABLED(QSPI_EEPROM) \
  2094. + ENABLED(SDCARD_EEPROM_EMULATION) \
  2095. + ENABLED(FLASH_EEPROM_EMULATION) \
  2096. + ENABLED(SRAM_EEPROM_EMULATION) \
  2097. + ENABLED(IIC_BL24CXX_EEPROM)
  2098. #error "Please select only one method of EEPROM Persistent Storage."
  2099. #endif
  2100. #endif
  2101. /**
  2102. * Make sure features that need to write to the SD card can
  2103. */
  2104. #if ENABLED(SDCARD_READONLY) && ANY(POWER_LOSS_RECOVERY, BINARY_FILE_TRANSFER, SDCARD_EEPROM_EMULATION)
  2105. #undef SDCARD_READONLY
  2106. #if ENABLED(POWER_LOSS_RECOVERY)
  2107. #warning "Either disable SDCARD_READONLY or disable POWER_LOSS_RECOVERY."
  2108. #elif ENABLED(BINARY_FILE_TRANSFER)
  2109. #warning "Either disable SDCARD_READONLY or disable BINARY_FILE_TRANSFER."
  2110. #elif ENABLED(SDCARD_EEPROM_EMULATION)
  2111. #warning "Either disable SDCARD_READONLY or disable SDCARD_EEPROM_EMULATION."
  2112. #endif
  2113. #endif
  2114. #if ENABLED(SD_IGNORE_AT_STARTUP)
  2115. #if ENABLED(POWER_LOSS_RECOVERY)
  2116. #error "SD_IGNORE_AT_STARTUP is incompatible with POWER_LOSS_RECOVERY."
  2117. #elif ENABLED(SDCARD_EEPROM_EMULATION)
  2118. #error "SD_IGNORE_AT_STARTUP is incompatible with SDCARD_EEPROM_EMULATION."
  2119. #endif
  2120. #endif
  2121. /**
  2122. * Make sure only one display is enabled
  2123. */
  2124. #if 1 < 0 \
  2125. + ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
  2126. + ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) \
  2127. + ENABLED(ULTIPANEL) \
  2128. + ENABLED(ULTRA_LCD) \
  2129. + (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \
  2130. + (ENABLED(MINIPANEL) && NONE(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \
  2131. + (ENABLED(MKS_MINI_12864) && DISABLED(MKS_LCD12864)) \
  2132. + (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \
  2133. + (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \
  2134. + (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \
  2135. + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
  2136. + COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY) \
  2137. + COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY, DWIN_CREALITY_LCD) \
  2138. + COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) \
  2139. + COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
  2140. + COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
  2141. + COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R) \
  2142. + COUNT_ENABLED(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) \
  2143. + COUNT_ENABLED(VIKI2, miniVIKI) \
  2144. + COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \
  2145. + COUNT_ENABLED(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING) \
  2146. + ENABLED(AZSMZ_12864) \
  2147. + ENABLED(BQ_LCD_SMART_CONTROLLER) \
  2148. + ENABLED(CARTESIO_UI) \
  2149. + ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
  2150. + ENABLED(FF_INTERFACEBOARD) \
  2151. + ENABLED(FYSETC_242_OLED_12864) \
  2152. + ENABLED(G3D_PANEL) \
  2153. + ENABLED(LCD_FOR_MELZI) \
  2154. + ENABLED(LCD_I2C_PANELOLU2) \
  2155. + ENABLED(LCD_I2C_VIKI) \
  2156. + ENABLED(LCM1602) \
  2157. + ENABLED(LONGER_LK_TFT28) \
  2158. + ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) \
  2159. + ENABLED(MAKRPANEL) \
  2160. + ENABLED(MALYAN_LCD) \
  2161. + ENABLED(MKS_LCD12864) \
  2162. + ENABLED(OLED_PANEL_TINYBOY2) \
  2163. + ENABLED(OVERLORD_OLED) \
  2164. + ENABLED(PANEL_ONE) \
  2165. + ENABLED(RA_CONTROL_PANEL) \
  2166. + ENABLED(RADDS_DISPLAY) \
  2167. + ENABLED(REPRAPWORLD_GRAPHICAL_LCD) \
  2168. + ENABLED(RIGIDBOT_PANEL) \
  2169. + ENABLED(SAV_3DGLCD) \
  2170. + ENABLED(SAV_3DLCD) \
  2171. + ENABLED(SILVER_GATE_GLCD_CONTROLLER) \
  2172. + ENABLED(TFT_TRONXY_X5SA) \
  2173. + ENABLED(TOUCH_UI_FTDI_EVE) \
  2174. + ENABLED(U8GLIB_SH1106_EINSTART) \
  2175. + ENABLED(ULTI_CONTROLLER) \
  2176. + ENABLED(ULTIMAKERCONTROLLER) \
  2177. + ENABLED(ZONESTAR_LCD)
  2178. #error "Please select only one LCD controller option."
  2179. #endif
  2180. #undef IS_U8GLIB_SSD1306
  2181. #undef IS_EXTUI
  2182. #undef IS_LEGACY_TFT
  2183. #if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28)
  2184. #if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
  2185. #error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one."
  2186. #elif 1 < ENABLED(TFT_COLOR_UI) + ENABLED(TFT_CLASSIC_UI) + ENABLED(TFT_LVGL_UI)
  2187. #error "Please select only one of TFT_COLOR_UI, TFT_CLASSIC_UI, or TFT_LVGL_UI."
  2188. #endif
  2189. #elif ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
  2190. #error "TFT_(COLOR|CLASSIC|LVGL)_UI requires a TFT display to be enabled."
  2191. #endif
  2192. #if ENABLED(TFT_GENERIC) && NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
  2193. #error "TFT_GENERIC requires either TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI interface."
  2194. #endif
  2195. #if BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
  2196. #error "Please enable only one of TFT_INTERFACE_SPI or TFT_INTERFACE_SPI."
  2197. #endif
  2198. #if MANY(LCD_SCREEN_ROT_0, LCD_SCREEN_ROT_90, LCD_SCREEN_ROT_180, LCD_SCREEN_ROT_270)
  2199. #error "Please enable only one LCD_SCREEN_ROT_* option: 0, 90, 180, or 270."
  2200. #endif
  2201. #if MANY(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
  2202. #error "Please select only one of TFT_RES_480x320, TFT_RES_480x320, or TFT_RES_480x272."
  2203. #endif
  2204. #if HAS_TFT_LVGL_UI && DISABLED(TFT_RES_480x320)
  2205. #error "(FMSC|SPI)TFT_LVGL_UI requires TFT_RES_480x320."
  2206. #endif
  2207. #if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 3)
  2208. #error "GRAPHICAL_TFT_UPSCALE must be set to 2 or 3."
  2209. #endif
  2210. /**
  2211. * Some boards forbid the use of -1 Native USB
  2212. */
  2213. #if ENABLED(BOARD_NO_NATIVE_USB)
  2214. #undef BOARD_NO_NATIVE_USB
  2215. #if SERIAL_PORT == -1
  2216. #error "SERIAL_PORT is set to -1, but the MOTHERBOARD has no native USB support. Set SERIAL_PORT to a valid value for your board."
  2217. #elif SERIAL_PORT_2 == -1
  2218. #error "SERIAL_PORT_2 is set to -1, but the MOTHERBOARD has no native USB support. Set SERIAL_PORT_2 to a valid value for your board."
  2219. #elif LCD_SERIAL_PORT == -1
  2220. #error "LCD_SERIAL_PORT is set to -1, but the MOTHERBOARD has no native USB support. Set LCD_SERIAL_PORT to a valid value for your board."
  2221. #endif
  2222. #endif
  2223. /**
  2224. * Serial displays require a dedicated serial port
  2225. */
  2226. #ifdef LCD_SERIAL_PORT
  2227. #if LCD_SERIAL_PORT == SERIAL_PORT
  2228. #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT."
  2229. #elif defined(SERIAL_PORT_2) && LCD_SERIAL_PORT == SERIAL_PORT_2
  2230. #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2."
  2231. #endif
  2232. #else
  2233. #if HAS_DGUS_LCD
  2234. #error "The DGUS LCD requires LCD_SERIAL_PORT to be defined."
  2235. #elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
  2236. #error "The ANYCUBIC LCD requires LCD_SERIAL_PORT to be defined."
  2237. #elif ENABLED(MALYAN_LCD)
  2238. #error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined."
  2239. #endif
  2240. #endif
  2241. /**
  2242. * FYSETC Mini 12864 RGB backlighting required
  2243. */
  2244. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED)
  2245. #error "RGB_LED is required for FYSETC_MINI_12864 1.2 and 2.0."
  2246. #elif EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && DISABLED(LED_USER_PRESET_STARTUP)
  2247. #error "LED_USER_PRESET_STARTUP is required for FYSETC_MINI_12864 2.x displays."
  2248. #endif
  2249. /**
  2250. * Check existing CS pins against enabled TMC SPI drivers.
  2251. */
  2252. #define INVALID_TMC_SPI(ST) (AXIS_HAS_SPI(ST) && !PIN_EXISTS(ST##_CS))
  2253. #if INVALID_TMC_SPI(X)
  2254. #error "An SPI driven TMC driver on X requires X_CS_PIN."
  2255. #elif INVALID_TMC_SPI(X2)
  2256. #error "An SPI driven TMC driver on X2 requires X2_CS_PIN."
  2257. #elif INVALID_TMC_SPI(Y)
  2258. #error "An SPI driven TMC driver on Y requires Y_CS_PIN."
  2259. #elif INVALID_TMC_SPI(Y2)
  2260. #error "An SPI driven TMC driver on Y2 requires Y2_CS_PIN."
  2261. #elif INVALID_TMC_SPI(Z)
  2262. #error "An SPI driven TMC driver on Z requires Z_CS_PIN."
  2263. #elif INVALID_TMC_SPI(Z2)
  2264. #error "An SPI driven TMC driver on Z2 requires Z2_CS_PIN."
  2265. #elif INVALID_TMC_SPI(Z3)
  2266. #error "An SPI driven TMC driver on Z3 requires Z3_CS_PIN."
  2267. #elif INVALID_TMC_SPI(Z4)
  2268. #error "An SPI driven TMC driver on Z4 requires Z4_CS_PIN."
  2269. #elif INVALID_TMC_SPI(E0)
  2270. #error "An SPI driven TMC driver on E0 requires E0_CS_PIN."
  2271. #elif INVALID_TMC_SPI(E1)
  2272. #error "An SPI driven TMC driver on E1 requires E1_CS_PIN."
  2273. #elif INVALID_TMC_SPI(E2)
  2274. #error "An SPI driven TMC driver on E2 requires E2_CS_PIN."
  2275. #elif INVALID_TMC_SPI(E3)
  2276. #error "An SPI driven TMC driver on E3 requires E3_CS_PIN."
  2277. #elif INVALID_TMC_SPI(E4)
  2278. #error "An SPI driven TMC driver on E4 requires E4_CS_PIN."
  2279. #elif INVALID_TMC_SPI(E5)
  2280. #error "An SPI driven TMC driver on E5 requires E5_CS_PIN."
  2281. #elif INVALID_TMC_SPI(E6)
  2282. #error "An SPI driven TMC driver on E6 requires E6_CS_PIN."
  2283. #elif INVALID_TMC_SPI(E7)
  2284. #error "An SPI driven TMC driver on E7 requires E7_CS_PIN."
  2285. #endif
  2286. #undef INVALID_TMC_SPI
  2287. /**
  2288. * Check existing RX/TX pins against enable TMC UART drivers.
  2289. */
  2290. #define INVALID_TMC_UART(ST) (AXIS_HAS_UART(ST) && !(defined(ST##_HARDWARE_SERIAL) || (PINS_EXIST(ST##_SERIAL_RX, ST##_SERIAL_TX))))
  2291. #if INVALID_TMC_UART(X)
  2292. #error "TMC2208 or TMC2209 on X requires X_HARDWARE_SERIAL or X_SERIAL_(RX|TX)_PIN."
  2293. #elif INVALID_TMC_UART(X2)
  2294. #error "TMC2208 or TMC2209 on X2 requires X2_HARDWARE_SERIAL or X2_SERIAL_(RX|TX)_PIN."
  2295. #elif INVALID_TMC_UART(Y)
  2296. #error "TMC2208 or TMC2209 on Y requires Y_HARDWARE_SERIAL or Y_SERIAL_(RX|TX)_PIN."
  2297. #elif INVALID_TMC_UART(Y2)
  2298. #error "TMC2208 or TMC2209 on Y2 requires Y2_HARDWARE_SERIAL or Y2_SERIAL_(RX|TX)_PIN."
  2299. #elif INVALID_TMC_UART(Z)
  2300. #error "TMC2208 or TMC2209 on Z requires Z_HARDWARE_SERIAL or Z_SERIAL_(RX|TX)_PIN."
  2301. #elif INVALID_TMC_UART(Z2)
  2302. #error "TMC2208 or TMC2209 on Z2 requires Z2_HARDWARE_SERIAL or Z2_SERIAL_(RX|TX)_PIN."
  2303. #elif INVALID_TMC_UART(Z3)
  2304. #error "TMC2208 or TMC2209 on Z3 requires Z3_HARDWARE_SERIAL or Z3_SERIAL_(RX|TX)_PIN."
  2305. #elif INVALID_TMC_UART(Z4)
  2306. #error "TMC2208 or TMC2209 on Z4 requires Z4_HARDWARE_SERIAL or Z4_SERIAL_(RX|TX)_PIN."
  2307. #elif INVALID_TMC_UART(E0)
  2308. #error "TMC2208 or TMC2209 on E0 requires E0_HARDWARE_SERIAL or E0_SERIAL_(RX|TX)_PIN."
  2309. #elif INVALID_TMC_UART(E1)
  2310. #error "TMC2208 or TMC2209 on E1 requires E1_HARDWARE_SERIAL or E1_SERIAL_(RX|TX)_PIN."
  2311. #elif INVALID_TMC_UART(E2)
  2312. #error "TMC2208 or TMC2209 on E2 requires E2_HARDWARE_SERIAL or E2_SERIAL_(RX|TX)_PIN."
  2313. #elif INVALID_TMC_UART(E3)
  2314. #error "TMC2208 or TMC2209 on E3 requires E3_HARDWARE_SERIAL or E3_SERIAL_(RX|TX)_PIN."
  2315. #elif INVALID_TMC_UART(E4)
  2316. #error "TMC2208 or TMC2209 on E4 requires E4_HARDWARE_SERIAL or E4_SERIAL_(RX|TX)_PIN."
  2317. #elif INVALID_TMC_UART(E5)
  2318. #error "TMC2208 or TMC2209 on E5 requires E5_HARDWARE_SERIAL or E5_SERIAL_(RX|TX)_PIN."
  2319. #elif INVALID_TMC_UART(E6)
  2320. #error "TMC2208 or TMC2209 on E6 requires E6_HARDWARE_SERIAL or E6_SERIAL_(RX|TX)_PIN."
  2321. #elif INVALID_TMC_UART(E7)
  2322. #error "TMC2208 or TMC2209 on E7 requires E7_HARDWARE_SERIAL or E7_SERIAL_(RX|TX)_PIN."
  2323. #endif
  2324. #undef INVALID_TMC_UART
  2325. /**
  2326. * TMC2209 slave address values
  2327. */
  2328. #define INVALID_TMC_ADDRESS(ST) static_assert(0 <= ST##_SLAVE_ADDRESS && ST##_SLAVE_ADDRESS <= 3, "TMC2209 slave address must be 0, 1, 2 or 3")
  2329. #if AXIS_DRIVER_TYPE_X(TMC2209)
  2330. INVALID_TMC_ADDRESS(X);
  2331. #elif AXIS_DRIVER_TYPE_X2(TMC2209)
  2332. INVALID_TMC_ADDRESS(X2);
  2333. #elif AXIS_DRIVER_TYPE_Y(TMC2209)
  2334. INVALID_TMC_ADDRESS(Y);
  2335. #elif AXIS_DRIVER_TYPE_Y2(TMC2209)
  2336. INVALID_TMC_ADDRESS(Y2);
  2337. #elif AXIS_DRIVER_TYPE_Z(TMC2209)
  2338. INVALID_TMC_ADDRESS(Z);
  2339. #elif AXIS_DRIVER_TYPE_Z2(TMC2209)
  2340. INVALID_TMC_ADDRESS(Z2);
  2341. #elif AXIS_DRIVER_TYPE_Z3(TMC2209)
  2342. INVALID_TMC_ADDRESS(Z3);
  2343. #elif AXIS_DRIVER_TYPE_Z4(TMC2209)
  2344. INVALID_TMC_ADDRESS(Z4);
  2345. #elif AXIS_DRIVER_TYPE_E0(TMC2209)
  2346. INVALID_TMC_ADDRESS(E0);
  2347. #elif AXIS_DRIVER_TYPE_E1(TMC2209)
  2348. INVALID_TMC_ADDRESS(E1);
  2349. #elif AXIS_DRIVER_TYPE_E2(TMC2209)
  2350. INVALID_TMC_ADDRESS(E2);
  2351. #elif AXIS_DRIVER_TYPE_E3(TMC2209)
  2352. INVALID_TMC_ADDRESS(E3);
  2353. #elif AXIS_DRIVER_TYPE_E4(TMC2209)
  2354. INVALID_TMC_ADDRESS(E4);
  2355. #elif AXIS_DRIVER_TYPE_E5(TMC2209)
  2356. INVALID_TMC_ADDRESS(E5);
  2357. #elif AXIS_DRIVER_TYPE_E6(TMC2209)
  2358. INVALID_TMC_ADDRESS(E6);
  2359. #elif AXIS_DRIVER_TYPE_E7(TMC2209)
  2360. INVALID_TMC_ADDRESS(E7);
  2361. #endif
  2362. #undef INVALID_TMC_ADDRESS
  2363. #define _TMC_MICROSTEP_IS_VALID(MS) (MS == 0 || MS == 2 || MS == 4 || MS == 8 || MS == 16 || MS == 32 || MS == 64 || MS == 128 || MS == 256)
  2364. #define TMC_MICROSTEP_IS_VALID(M) (!AXIS_IS_TMC(M) || _TMC_MICROSTEP_IS_VALID(M##_MICROSTEPS))
  2365. #define INVALID_TMC_MS(ST) static_assert(0, "Invalid " STRINGIFY(ST) "_MICROSTEPS. Valid values are 0, 2, 4, 8, 16, 32, 64, 128, and 256.")
  2366. #if !TMC_MICROSTEP_IS_VALID(X)
  2367. INVALID_TMC_MS(X);
  2368. #elif !TMC_MICROSTEP_IS_VALID(Y)
  2369. INVALID_TMC_MS(Y)
  2370. #elif !TMC_MICROSTEP_IS_VALID(Z)
  2371. INVALID_TMC_MS(Z)
  2372. #elif !TMC_MICROSTEP_IS_VALID(X2)
  2373. INVALID_TMC_MS(X2);
  2374. #elif !TMC_MICROSTEP_IS_VALID(Y2)
  2375. INVALID_TMC_MS(Y2)
  2376. #elif !TMC_MICROSTEP_IS_VALID(Z2)
  2377. INVALID_TMC_MS(Z2)
  2378. #elif !TMC_MICROSTEP_IS_VALID(Z3)
  2379. INVALID_TMC_MS(Z3)
  2380. #elif !TMC_MICROSTEP_IS_VALID(Z4)
  2381. INVALID_TMC_MS(Z4)
  2382. #elif !TMC_MICROSTEP_IS_VALID(E0)
  2383. INVALID_TMC_MS(E0)
  2384. #elif !TMC_MICROSTEP_IS_VALID(E1)
  2385. INVALID_TMC_MS(E1)
  2386. #elif !TMC_MICROSTEP_IS_VALID(E2)
  2387. INVALID_TMC_MS(E2)
  2388. #elif !TMC_MICROSTEP_IS_VALID(E3)
  2389. INVALID_TMC_MS(E3)
  2390. #elif !TMC_MICROSTEP_IS_VALID(E4)
  2391. INVALID_TMC_MS(E4)
  2392. #elif !TMC_MICROSTEP_IS_VALID(E5)
  2393. INVALID_TMC_MS(E5)
  2394. #elif !TMC_MICROSTEP_IS_VALID(E6)
  2395. INVALID_TMC_MS(E6)
  2396. #elif !TMC_MICROSTEP_IS_VALID(E7)
  2397. INVALID_TMC_MS(E7)
  2398. #endif
  2399. #undef INVALID_TMC_MS
  2400. #undef TMC_MICROSTEP_IS_VALID
  2401. #undef _TMC_MICROSTEP_IS_VALID
  2402. #if ENABLED(DELTA) && (ENABLED(STEALTHCHOP_XY) != ENABLED(STEALTHCHOP_Z))
  2403. #error "STEALTHCHOP_XY and STEALTHCHOP_Z must be the same on DELTA."
  2404. #endif
  2405. #if ENABLED(SENSORLESS_HOMING)
  2406. // Require STEALTHCHOP for SENSORLESS_HOMING on DELTA as the transition from spreadCycle to stealthChop
  2407. // is necessary in order to reset the stallGuard indication between the initial movement of all three
  2408. // towers to +Z and the individual homing of each tower. This restriction can be removed once a means of
  2409. // clearing the stallGuard activated status is found.
  2410. // Stall detection DIAG = HIGH : TMC2209
  2411. // Stall detection DIAG = LOW : TMC2130/TMC2160/TMC2660/TMC5130/TMC5160
  2412. #define X_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(X,TMC2209)
  2413. #define Y_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Y,TMC2209)
  2414. #define Z_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Z,TMC2209)
  2415. #if NONE(SPI_ENDSTOPS, ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS)
  2416. #if X_SENSORLESS && X_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_XMIN)
  2417. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMIN (or ENDSTOPPULLUPS) when homing to X_MIN."
  2418. #elif X_SENSORLESS && X_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_XMAX)
  2419. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMAX (or ENDSTOPPULLUPS) when homing to X_MAX."
  2420. #elif Y_SENSORLESS && Y_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_YMIN)
  2421. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMIN (or ENDSTOPPULLUPS) when homing to Y_MIN."
  2422. #elif Y_SENSORLESS && Y_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_YMAX)
  2423. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMAX (or ENDSTOPPULLUPS) when homing to Y_MAX."
  2424. #elif Z_SENSORLESS && Z_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_ZMIN)
  2425. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) when homing to Z_MIN."
  2426. #elif Z_SENSORLESS && Z_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_ZMAX)
  2427. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) when homing to Z_MAX."
  2428. #endif
  2429. #endif
  2430. #if ENABLED(SPI_ENDSTOPS)
  2431. #if ENABLED(QUICK_HOME)
  2432. #warning "SPI_ENDSTOPS may be unreliable with QUICK_HOME. Adjust back-offs for better results."
  2433. #endif
  2434. #else
  2435. #if X_SENSORLESS && X_HOME_DIR < 0 && X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
  2436. #if X_ENDSTOP_INVERTING
  2437. #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = true when homing to X_MIN."
  2438. #else
  2439. #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to X_MIN."
  2440. #endif
  2441. #elif X_SENSORLESS && X_HOME_DIR > 0 && X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
  2442. #if X_ENDSTOP_INVERTING
  2443. #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = true when homing to X_MAX."
  2444. #else
  2445. #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to X_MAX."
  2446. #endif
  2447. #elif Y_SENSORLESS && Y_HOME_DIR < 0 && Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
  2448. #if Y_ENDSTOP_INVERTING
  2449. #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = true when homing to Y_MIN."
  2450. #else
  2451. #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MIN."
  2452. #endif
  2453. #elif Y_SENSORLESS && Y_HOME_DIR > 0 && Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
  2454. #if Y_ENDSTOP_INVERTING
  2455. #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = true when homing to Y_MAX."
  2456. #else
  2457. #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MAX."
  2458. #endif
  2459. #elif Z_SENSORLESS && Z_HOME_DIR < 0 && Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
  2460. #if Z_ENDSTOP_INVERTING
  2461. #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = true when homing to Z_MIN."
  2462. #else
  2463. #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Z_MIN."
  2464. #endif
  2465. #elif Z_SENSORLESS && Z_HOME_DIR > 0 && Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
  2466. #if Z_ENDSTOP_INVERTING
  2467. #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING = true when homing to Z_MAX."
  2468. #else
  2469. #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to Z_MAX."
  2470. #endif
  2471. #endif
  2472. #endif
  2473. #if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z)
  2474. #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z."
  2475. #elif ENDSTOP_NOISE_THRESHOLD
  2476. #error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD."
  2477. #elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS)
  2478. #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes."
  2479. #endif
  2480. #undef X_ENDSTOP_INVERTING
  2481. #undef Y_ENDSTOP_INVERTING
  2482. #undef Z_ENDSTOP_INVERTING
  2483. #endif
  2484. // Sensorless probing requirements
  2485. #if ENABLED(SENSORLESS_PROBING)
  2486. #if ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS)
  2487. #error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes."
  2488. #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  2489. #error "SENSORLESS_PROBING cannot be used with Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN."
  2490. #elif ENABLED(USE_PROBE_FOR_Z_HOMING)
  2491. #error "SENSORLESS_PROBING cannot be used with USE_PROBE_FOR_Z_HOMING."
  2492. #elif !Z_SENSORLESS
  2493. #error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z."
  2494. #endif
  2495. #endif
  2496. // Sensorless homing is required for both combined steppers in an H-bot
  2497. #if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
  2498. #error "CoreXY requires both X and Y to use sensorless homing if either one does."
  2499. #elif CORE_IS_XZ && X_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE
  2500. #error "CoreXZ requires both X and Z to use sensorless homing if either one does."
  2501. #elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE
  2502. #error "CoreYZ requires both Y and Z to use sensorless homing if either one does."
  2503. #elif ENABLED(MARKFORGED_XY) && X_SENSORLESS != Y_SENSORLESS
  2504. #error "MARKFORGED_XY requires both X and Y to use sensorless homing if either one does."
  2505. #endif
  2506. // Other TMC feature requirements
  2507. #if ENABLED(HYBRID_THRESHOLD) && !STEALTHCHOP_ENABLED
  2508. #error "Enable STEALTHCHOP_(XY|Z|E) to use HYBRID_THRESHOLD."
  2509. #elif ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
  2510. #error "SENSORLESS_HOMING requires TMC2130, TMC2160, TMC2209, TMC2660, or TMC5160 stepper drivers."
  2511. #elif ENABLED(SENSORLESS_PROBING) && !HAS_STALLGUARD
  2512. #error "SENSORLESS_PROBING requires TMC2130, TMC2160, TMC2209, TMC2660, or TMC5160 stepper drivers."
  2513. #elif STEALTHCHOP_ENABLED && !HAS_STEALTHCHOP
  2514. #error "STEALTHCHOP requires TMC2130, TMC2160, TMC2208, TMC2209, or TMC5160 stepper drivers."
  2515. #endif
  2516. /**
  2517. * TMC SPI Chaining
  2518. */
  2519. #define IN_CHAIN(A) ((A##_CHAIN_POS > 0) && !HAS_L64XX)
  2520. #if IN_CHAIN(X ) || IN_CHAIN(Y ) || IN_CHAIN(Z ) || IN_CHAIN(X2) || IN_CHAIN(Y2) || IN_CHAIN(Z2) || IN_CHAIN(Z3) || IN_CHAIN(Z4) \
  2521. || IN_CHAIN(E0) || IN_CHAIN(E1) || IN_CHAIN(E2) || IN_CHAIN(E3) || IN_CHAIN(E4) || IN_CHAIN(E5) || IN_CHAIN(E6) || IN_CHAIN(E7)
  2522. #define BAD_CHAIN(A) (IN_CHAIN(A) && !PIN_EXISTS(A##_CS))
  2523. #if BAD_CHAIN(X ) || BAD_CHAIN(Y ) || BAD_CHAIN(Z ) || BAD_CHAIN(X2) || BAD_CHAIN(Y2) || BAD_CHAIN(Z2) || BAD_CHAIN(Z3) || BAD_CHAIN(Z4) \
  2524. || BAD_CHAIN(E0) || BAD_CHAIN(E1) || BAD_CHAIN(E2) || BAD_CHAIN(E3) || BAD_CHAIN(E4) || BAD_CHAIN(E5) || BAD_CHAIN(E6) || BAD_CHAIN(E7)
  2525. #error "All chained TMC drivers need a CS pin."
  2526. #else
  2527. #if IN_CHAIN(X)
  2528. #define CS_COMPARE X_CS_PIN
  2529. #elif IN_CHAIN(Y)
  2530. #define CS_COMPARE Y_CS_PIN
  2531. #elif IN_CHAIN(Z)
  2532. #define CS_COMPARE Z_CS_PIN
  2533. #elif IN_CHAIN(X2)
  2534. #define CS_COMPARE X2_CS_PIN
  2535. #elif IN_CHAIN(Y2)
  2536. #define CS_COMPARE Y2_CS_PIN
  2537. #elif IN_CHAIN(Z2)
  2538. #define CS_COMPARE Z2_CS_PIN
  2539. #elif IN_CHAIN(Z3)
  2540. #define CS_COMPARE Z3_CS_PIN
  2541. #elif IN_CHAIN(E0)
  2542. #define CS_COMPARE E0_CS_PIN
  2543. #elif IN_CHAIN(E1)
  2544. #define CS_COMPARE E1_CS_PIN
  2545. #elif IN_CHAIN(E2)
  2546. #define CS_COMPARE E2_CS_PIN
  2547. #elif IN_CHAIN(E3)
  2548. #define CS_COMPARE E3_CS_PIN
  2549. #elif IN_CHAIN(E4)
  2550. #define CS_COMPARE E4_CS_PIN
  2551. #elif IN_CHAIN(E5)
  2552. #define CS_COMPARE E5_CS_PIN
  2553. #elif IN_CHAIN(E6)
  2554. #define CS_COMPARE E6_CS_PIN
  2555. #elif IN_CHAIN(E7)
  2556. #define CS_COMPARE E7_CS_PIN
  2557. #endif
  2558. #define BAD_CS_PIN(A) (IN_CHAIN(A) && A##_CS_PIN != CS_COMPARE)
  2559. #if BAD_CS_PIN(X ) || BAD_CS_PIN(Y ) || BAD_CS_PIN(Z ) || BAD_CS_PIN(X2) || BAD_CS_PIN(Y2) || BAD_CS_PIN(Z2) || BAD_CS_PIN(Z3) || BAD_CS_PIN(Z4) \
  2560. || BAD_CS_PIN(E0) || BAD_CS_PIN(E1) || BAD_CS_PIN(E2) || BAD_CS_PIN(E3) || BAD_CS_PIN(E4) || BAD_CS_PIN(E5) || BAD_CS_PIN(E6) || BAD_CS_PIN(E7)
  2561. #error "All chained TMC drivers must use the same CS pin."
  2562. #endif
  2563. #undef BAD_CS_PIN
  2564. #undef CS_COMPARE
  2565. #endif
  2566. #undef BAD_CHAIN
  2567. #endif
  2568. #undef IN_CHAIN
  2569. /**
  2570. * Digipot requirement
  2571. */
  2572. #if HAS_MOTOR_CURRENT_I2C
  2573. #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
  2574. #error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451."
  2575. #elif !MB(MKS_SBASE) \
  2576. && (!defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1))
  2577. #error "DIGIPOT_MCP4018/4451 requires DIGIPOTS_I2C_SDA_* pins to be defined."
  2578. #endif
  2579. #endif
  2580. /**
  2581. * Check per-axis initializers for errors
  2582. */
  2583. constexpr float sanity_arr_1[] = DEFAULT_AXIS_STEPS_PER_UNIT,
  2584. sanity_arr_2[] = DEFAULT_MAX_FEEDRATE,
  2585. sanity_arr_3[] = DEFAULT_MAX_ACCELERATION;
  2586. #define _ARR_TEST(N,I) (sanity_arr_##N[_MIN(I,int(COUNT(sanity_arr_##N))-1)] > 0)
  2587. static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires X, Y, Z and E elements.");
  2588. static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)");
  2589. static_assert( _ARR_TEST(1,0) && _ARR_TEST(1,1) && _ARR_TEST(1,2)
  2590. && _ARR_TEST(1,3) && _ARR_TEST(1,4) && _ARR_TEST(1,5)
  2591. && _ARR_TEST(1,6) && _ARR_TEST(1,7) && _ARR_TEST(1,8),
  2592. "DEFAULT_AXIS_STEPS_PER_UNIT values must be positive.");
  2593. static_assert(COUNT(sanity_arr_2) >= XYZE, "DEFAULT_MAX_FEEDRATE requires X, Y, Z and E elements.");
  2594. static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)");
  2595. static_assert( _ARR_TEST(2,0) && _ARR_TEST(2,1) && _ARR_TEST(2,2)
  2596. && _ARR_TEST(2,3) && _ARR_TEST(2,4) && _ARR_TEST(2,5)
  2597. && _ARR_TEST(2,6) && _ARR_TEST(2,7) && _ARR_TEST(2,8),
  2598. "DEFAULT_MAX_FEEDRATE values must be positive.");
  2599. static_assert(COUNT(sanity_arr_3) >= XYZE, "DEFAULT_MAX_ACCELERATION requires X, Y, Z and E elements.");
  2600. static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)");
  2601. static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
  2602. && _ARR_TEST(3,3) && _ARR_TEST(3,4) && _ARR_TEST(3,5)
  2603. && _ARR_TEST(3,6) && _ARR_TEST(3,7) && _ARR_TEST(3,8),
  2604. "DEFAULT_MAX_ACCELERATION values must be positive.");
  2605. #if ENABLED(LIMITED_MAX_ACCEL_EDITING)
  2606. #ifdef MAX_ACCEL_EDIT_VALUES
  2607. constexpr float sanity_arr_4[] = MAX_ACCEL_EDIT_VALUES;
  2608. static_assert(COUNT(sanity_arr_4) >= XYZE, "MAX_ACCEL_EDIT_VALUES requires X, Y, Z and E elements.");
  2609. static_assert(COUNT(sanity_arr_4) <= XYZE, "MAX_ACCEL_EDIT_VALUES has too many elements. X, Y, Z and E elements only.");
  2610. static_assert( _ARR_TEST(4,0) && _ARR_TEST(4,1) && _ARR_TEST(4,2)
  2611. && _ARR_TEST(4,3) && _ARR_TEST(4,4) && _ARR_TEST(4,5)
  2612. && _ARR_TEST(4,6) && _ARR_TEST(4,7) && _ARR_TEST(4,8),
  2613. "MAX_ACCEL_EDIT_VALUES values must be positive.");
  2614. #endif
  2615. #endif
  2616. #if ENABLED(LIMITED_MAX_FR_EDITING)
  2617. #ifdef MAX_FEEDRATE_EDIT_VALUES
  2618. constexpr float sanity_arr_5[] = MAX_FEEDRATE_EDIT_VALUES;
  2619. static_assert(COUNT(sanity_arr_5) >= XYZE, "MAX_FEEDRATE_EDIT_VALUES requires X, Y, Z and E elements.");
  2620. static_assert(COUNT(sanity_arr_5) <= XYZE, "MAX_FEEDRATE_EDIT_VALUES has too many elements. X, Y, Z and E elements only.");
  2621. static_assert( _ARR_TEST(5,0) && _ARR_TEST(5,1) && _ARR_TEST(5,2)
  2622. && _ARR_TEST(5,3) && _ARR_TEST(5,4) && _ARR_TEST(5,5)
  2623. && _ARR_TEST(5,6) && _ARR_TEST(5,7) && _ARR_TEST(5,8),
  2624. "MAX_FEEDRATE_EDIT_VALUES values must be positive.");
  2625. #endif
  2626. #endif
  2627. #if ENABLED(LIMITED_JERK_EDITING)
  2628. #ifdef MAX_JERK_EDIT_VALUES
  2629. constexpr float sanity_arr_6[] = MAX_JERK_EDIT_VALUES;
  2630. static_assert(COUNT(sanity_arr_6) >= XYZE, "MAX_JERK_EDIT_VALUES requires X, Y, Z and E elements.");
  2631. static_assert(COUNT(sanity_arr_6) <= XYZE, "MAX_JERK_EDIT_VALUES has too many elements. X, Y, Z and E elements only.");
  2632. static_assert( _ARR_TEST(6,0) && _ARR_TEST(6,1) && _ARR_TEST(6,2)
  2633. && _ARR_TEST(6,3) && _ARR_TEST(6,4) && _ARR_TEST(6,5)
  2634. && _ARR_TEST(6,6) && _ARR_TEST(6,7) && _ARR_TEST(6,8),
  2635. "MAX_JERK_EDIT_VALUES values must be positive.");
  2636. #endif
  2637. #endif
  2638. #undef _ARR_TEST
  2639. #if BOTH(CNC_COORDINATE_SYSTEMS, NO_WORKSPACE_OFFSETS)
  2640. #error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS."
  2641. #endif
  2642. #if !BLOCK_BUFFER_SIZE || !IS_POWER_OF_2(BLOCK_BUFFER_SIZE)
  2643. #error "BLOCK_BUFFER_SIZE must be a power of 2."
  2644. #elif BLOCK_BUFFER_SIZE > 64
  2645. #error "A very large BLOCK_BUFFER_SIZE is not needed and takes longer to drain the buffer on pause / cancel."
  2646. #endif
  2647. #if ENABLED(LED_CONTROL_MENU) && !IS_ULTIPANEL
  2648. #error "LED_CONTROL_MENU requires an LCD controller."
  2649. #endif
  2650. #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) && DISABLED(NEOPIXEL_LED)
  2651. #error "CASE_LIGHT_USE_NEOPIXEL requires NEOPIXEL_LED."
  2652. #endif
  2653. #if ENABLED(SKEW_CORRECTION)
  2654. #if !defined(XY_SKEW_FACTOR) && !(defined(XY_DIAG_AC) && defined(XY_DIAG_BD) && defined(XY_SIDE_AD))
  2655. #error "SKEW_CORRECTION requires XY_SKEW_FACTOR or XY_DIAG_AC, XY_DIAG_BD, XY_SIDE_AD."
  2656. #endif
  2657. #if ENABLED(SKEW_CORRECTION_FOR_Z)
  2658. #if !defined(XZ_SKEW_FACTOR) && !(defined(XZ_DIAG_AC) && defined(XZ_DIAG_BD) && defined(XZ_SIDE_AD))
  2659. #error "SKEW_CORRECTION requires XZ_SKEW_FACTOR or XZ_DIAG_AC, XZ_DIAG_BD, XZ_SIDE_AD."
  2660. #endif
  2661. #if !defined(YZ_SKEW_FACTOR) && !(defined(YZ_DIAG_AC) && defined(YZ_DIAG_BD) && defined(YZ_SIDE_AD))
  2662. #error "SKEW_CORRECTION requires YZ_SKEW_FACTOR or YZ_DIAG_AC, YZ_DIAG_BD, YZ_SIDE_AD."
  2663. #endif
  2664. #endif
  2665. #endif
  2666. #if ENABLED(BACKUP_POWER_SUPPLY) && !PIN_EXISTS(POWER_LOSS)
  2667. #error "BACKUP_POWER_SUPPLY requires a POWER_LOSS_PIN."
  2668. #endif
  2669. #if BOTH(POWER_LOSS_PULLUP, POWER_LOSS_PULLDOWN)
  2670. #error "You can't enable POWER_LOSS_PULLUP and POWER_LOSS_PULLDOWN at the same time."
  2671. #endif
  2672. #if ENABLED(Z_STEPPER_AUTO_ALIGN)
  2673. #if NUM_Z_STEPPER_DRIVERS <= 1
  2674. #error "Z_STEPPER_AUTO_ALIGN requires NUM_Z_STEPPER_DRIVERS greater than 1."
  2675. #elif !HAS_BED_PROBE
  2676. #error "Z_STEPPER_AUTO_ALIGN requires a Z-bed probe."
  2677. #elif ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
  2678. static_assert(WITHIN(Z_STEPPER_ALIGN_AMP, 0.5, 2.0), "Z_STEPPER_ALIGN_AMP must be between 0.5 and 2.0.");
  2679. #if NUM_Z_STEPPER_DRIVERS < 3
  2680. #error "Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS requires NUM_Z_STEPPER_DRIVERS to be 3 or 4."
  2681. #endif
  2682. #endif
  2683. #endif
  2684. #if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
  2685. #if NONE(HAS_MOTOR_CURRENT_DAC, HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC, HAS_TRINAMIC_CONFIG, HAS_MOTOR_CURRENT_PWM)
  2686. #error "It is highly recommended to have adjustable current drivers to prevent damage. Disable this line to continue anyway."
  2687. #elif !defined(GANTRY_CALIBRATION_CURRENT)
  2688. #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_CURRENT to be set."
  2689. #elif !defined(GANTRY_CALIBRATION_EXTRA_HEIGHT)
  2690. #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_EXTRA_HEIGHT to be set."
  2691. #elif !defined(GANTRY_CALIBRATION_FEEDRATE)
  2692. #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_FEEDRATE to be set."
  2693. #endif
  2694. #if defined(GANTRY_CALIBRATION_SAFE_POSITION) && !defined(GANTRY_CALIBRATION_XY_PARK_FEEDRATE)
  2695. #error "GANTRY_CALIBRATION_SAFE_POSITION Requires GANTRY_CALIBRATION_XY_PARK_FEEDRATE to be set."
  2696. #endif
  2697. #endif
  2698. #if BOTH(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
  2699. #error "You cannot use Z_STEPPER_AUTO_ALIGN and MECHANICAL_GANTRY_CALIBRATION at the same time."
  2700. #endif
  2701. #if ENABLED(PRINTCOUNTER) && DISABLED(EEPROM_SETTINGS)
  2702. #error "PRINTCOUNTER requires EEPROM_SETTINGS."
  2703. #endif
  2704. #if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR)
  2705. #error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT."
  2706. #endif
  2707. #if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__)
  2708. #error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board."
  2709. #endif
  2710. #if ENABLED(GCODE_MACROS) && !WITHIN(GCODE_MACROS_SLOTS, 1, 10)
  2711. #error "GCODE_MACROS_SLOTS must be a number from 1 to 10."
  2712. #endif
  2713. #if ENABLED(CUSTOM_USER_MENUS)
  2714. #ifdef USER_GCODE_1
  2715. constexpr char _chr1 = USER_GCODE_1[strlen(USER_GCODE_1) - 1];
  2716. static_assert(_chr1 != '\n' && _chr1 != '\r', "USER_GCODE_1 cannot have a newline at the end. Please remove it.");
  2717. #endif
  2718. #ifdef USER_GCODE_2
  2719. constexpr char _chr2 = USER_GCODE_2[strlen(USER_GCODE_2) - 1];
  2720. static_assert(_chr2 != '\n' && _chr2 != '\r', "USER_GCODE_2 cannot have a newline at the end. Please remove it.");
  2721. #endif
  2722. #ifdef USER_GCODE_3
  2723. constexpr char _chr3 = USER_GCODE_3[strlen(USER_GCODE_3) - 1];
  2724. static_assert(_chr3 != '\n' && _chr3 != '\r', "USER_GCODE_3 cannot have a newline at the end. Please remove it.");
  2725. #endif
  2726. #ifdef USER_GCODE_4
  2727. constexpr char _chr4 = USER_GCODE_4[strlen(USER_GCODE_4) - 1];
  2728. static_assert(_chr4 != '\n' && _chr4 != '\r', "USER_GCODE_4 cannot have a newline at the end. Please remove it.");
  2729. #endif
  2730. #ifdef USER_GCODE_5
  2731. constexpr char _chr5 = USER_GCODE_5[strlen(USER_GCODE_5) - 1];
  2732. static_assert(_chr5 != '\n' && _chr5 != '\r', "USER_GCODE_5 cannot have a newline at the end. Please remove it.");
  2733. #endif
  2734. #ifdef USER_GCODE_6
  2735. constexpr char _chr6 = USER_GCODE_6[strlen(USER_GCODE_6) - 1];
  2736. static_assert(_chr6 != '\n' && _chr6 != '\r', "USER_GCODE_6 cannot have a newline at the end. Please remove it.");
  2737. #endif
  2738. #ifdef USER_GCODE_7
  2739. constexpr char _chr7 = USER_GCODE_7[strlen(USER_GCODE_7) - 1];
  2740. static_assert(_chr7 != '\n' && _chr7 != '\r', "USER_GCODE_7 cannot have a newline at the end. Please remove it.");
  2741. #endif
  2742. #ifdef USER_GCODE_8
  2743. constexpr char _chr8 = USER_GCODE_8[strlen(USER_GCODE_8) - 1];
  2744. static_assert(_chr8 != '\n' && _chr8 != '\r', "USER_GCODE_8 cannot have a newline at the end. Please remove it.");
  2745. #endif
  2746. #ifdef USER_GCODE_9
  2747. constexpr char _chr9 = USER_GCODE_9[strlen(USER_GCODE_9) - 1];
  2748. static_assert(_chr9 != '\n' && _chr9 != '\r', "USER_GCODE_9 cannot have a newline at the end. Please remove it.");
  2749. #endif
  2750. #ifdef USER_GCODE_10
  2751. constexpr char _chr10 = USER_GCODE_10[strlen(USER_GCODE_10) - 1];
  2752. static_assert(_chr10 != '\n' && _chr10 != '\r', "USER_GCODE_10 cannot have a newline at the end. Please remove it.");
  2753. #endif
  2754. #ifdef USER_GCODE_11
  2755. constexpr char _chr11 = USER_GCODE_11[strlen(USER_GCODE_11) - 1];
  2756. static_assert(_chr11 != '\n' && _chr11 != '\r', "USER_GCODE_11 cannot have a newline at the end. Please remove it.");
  2757. #endif
  2758. #ifdef USER_GCODE_12
  2759. constexpr char _chr12 = USER_GCODE_12[strlen(USER_GCODE_12) - 1];
  2760. static_assert(_chr12 != '\n' && _chr12 != '\r', "USER_GCODE_12 cannot have a newline at the end. Please remove it.");
  2761. #endif
  2762. #ifdef USER_GCODE_13
  2763. constexpr char _chr13 = USER_GCODE_13[strlen(USER_GCODE_13) - 1];
  2764. static_assert(_chr13 != '\n' && _chr13 != '\r', "USER_GCODE_13 cannot have a newline at the end. Please remove it.");
  2765. #endif
  2766. #ifdef USER_GCODE_14
  2767. constexpr char _chr14 = USER_GCODE_14[strlen(USER_GCODE_14) - 1];
  2768. static_assert(_chr14 != '\n' && _chr14 != '\r', "USER_GCODE_14 cannot have a newline at the end. Please remove it.");
  2769. #endif
  2770. #ifdef USER_GCODE_15
  2771. constexpr char _chr15 = USER_GCODE_15[strlen(USER_GCODE_15) - 1];
  2772. static_assert(_chr15 != '\n' && _chr15 != '\r', "USER_GCODE_15 cannot have a newline at the end. Please remove it.");
  2773. #endif
  2774. #ifdef USER_GCODE_16
  2775. constexpr char _chr16 = USER_GCODE_16[strlen(USER_GCODE_16) - 1];
  2776. static_assert(_chr16 != '\n' && _chr16 != '\r', "USER_GCODE_16 cannot have a newline at the end. Please remove it.");
  2777. #endif
  2778. #ifdef USER_GCODE_17
  2779. constexpr char _chr17 = USER_GCODE_17[strlen(USER_GCODE_17) - 1];
  2780. static_assert(_chr17 != '\n' && _chr17 != '\r', "USER_GCODE_17 cannot have a newline at the end. Please remove it.");
  2781. #endif
  2782. #ifdef USER_GCODE_18
  2783. constexpr char _chr18 = USER_GCODE_18[strlen(USER_GCODE_18) - 1];
  2784. static_assert(_chr18 != '\n' && _chr18 != '\r', "USER_GCODE_18 cannot have a newline at the end. Please remove it.");
  2785. #endif
  2786. #ifdef USER_GCODE_19
  2787. constexpr char _chr19 = USER_GCODE_19[strlen(USER_GCODE_19) - 1];
  2788. static_assert(_chr19 != '\n' && _chr19 != '\r', "USER_GCODE_19 cannot have a newline at the end. Please remove it.");
  2789. #endif
  2790. #ifdef USER_GCODE_20
  2791. constexpr char _chr20 = USER_GCODE_20[strlen(USER_GCODE_20) - 1];
  2792. static_assert(_chr20 != '\n' && _chr20 != '\r', "USER_GCODE_20 cannot have a newline at the end. Please remove it.");
  2793. #endif
  2794. #ifdef USER_GCODE_21
  2795. constexpr char _chr21 = USER_GCODE_21[strlen(USER_GCODE_21) - 1];
  2796. static_assert(_chr21 != '\n' && _chr21 != '\r', "USER_GCODE_21 cannot have a newline at the end. Please remove it.");
  2797. #endif
  2798. #ifdef USER_GCODE_22
  2799. constexpr char _chr22 = USER_GCODE_22[strlen(USER_GCODE_22) - 1];
  2800. static_assert(_chr22 != '\n' && _chr22 != '\r', "USER_GCODE_22 cannot have a newline at the end. Please remove it.");
  2801. #endif
  2802. #ifdef USER_GCODE_23
  2803. constexpr char _chr23 = USER_GCODE_23[strlen(USER_GCODE_23) - 1];
  2804. static_assert(_chr23 != '\n' && _chr23 != '\r', "USER_GCODE_23 cannot have a newline at the end. Please remove it.");
  2805. #endif
  2806. #ifdef USER_GCODE_24
  2807. constexpr char _chr24 = USER_GCODE_24[strlen(USER_GCODE_24) - 1];
  2808. static_assert(_chr24 != '\n' && _chr24 != '\r', "USER_GCODE_24 cannot have a newline at the end. Please remove it.");
  2809. #endif
  2810. #ifdef USER_GCODE_25
  2811. constexpr char _chr25 = USER_GCODE_25[strlen(USER_GCODE_25) - 1];
  2812. static_assert(_chr25 != '\n' && _chr25 != '\r', "USER_GCODE_25 cannot have a newline at the end. Please remove it.");
  2813. #endif
  2814. #endif
  2815. #if ENABLED(BACKLASH_COMPENSATION)
  2816. #ifndef BACKLASH_DISTANCE_MM
  2817. #error "BACKLASH_COMPENSATION requires BACKLASH_DISTANCE_MM."
  2818. #elif !defined(BACKLASH_CORRECTION)
  2819. #error "BACKLASH_COMPENSATION requires BACKLASH_CORRECTION."
  2820. #elif ENABLED(MARKFORGED_XY)
  2821. constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
  2822. static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
  2823. "BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " on a MarkForged system.");
  2824. #elif IS_CORE
  2825. constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
  2826. static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
  2827. "BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " with your CORE system.");
  2828. #endif
  2829. #endif
  2830. #if ENABLED(GRADIENT_MIX) && MIXING_VIRTUAL_TOOLS < 2
  2831. #error "GRADIENT_MIX requires 2 or more MIXING_VIRTUAL_TOOLS."
  2832. #endif
  2833. /**
  2834. * Photo G-code requirements
  2835. */
  2836. #if ENABLED(PHOTO_GCODE)
  2837. #if (PIN_EXISTS(CHDK) + PIN_EXISTS(PHOTOGRAPH) + defined(PHOTO_SWITCH_POSITION)) > 1
  2838. #error "Please define only one of CHDK_PIN, PHOTOGRAPH_PIN, or PHOTO_SWITCH_POSITION."
  2839. #elif defined(PHOTO_SWITCH_POSITION) && !defined(PHOTO_POSITION)
  2840. #error "PHOTO_SWITCH_POSITION requires PHOTO_POSITION."
  2841. #elif PIN_EXISTS(CHDK) && defined(CHDK_DELAY)
  2842. #error "CHDK_DELAY has been replaced by PHOTO_SWITCH_MS."
  2843. #elif PIN_EXISTS(CHDK) && !defined(PHOTO_SWITCH_MS)
  2844. #error "PHOTO_SWITCH_MS is required with CHDK_PIN."
  2845. #elif defined(PHOTO_RETRACT_MM)
  2846. static_assert(PHOTO_RETRACT_MM + 0 >= 0, "PHOTO_RETRACT_MM must be >= 0.");
  2847. #endif
  2848. #endif
  2849. /**
  2850. * Advanced PRINTCOUNTER settings
  2851. */
  2852. #if ENABLED(PRINTCOUNTER)
  2853. #if defined(SERVICE_INTERVAL_1) != defined(SERVICE_NAME_1)
  2854. #error "Both SERVICE_NAME_1 and SERVICE_INTERVAL_1 are required."
  2855. #elif defined(SERVICE_INTERVAL_2) != defined(SERVICE_NAME_2)
  2856. #error "Both SERVICE_NAME_2 and SERVICE_INTERVAL_2 are required."
  2857. #elif defined(SERVICE_INTERVAL_3) != defined(SERVICE_NAME_3)
  2858. #error "Both SERVICE_NAME_3 and SERVICE_INTERVAL_3 are required."
  2859. #endif
  2860. #endif
  2861. /**
  2862. * Require soft endstops for certain setups
  2863. */
  2864. #if !BOTH(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
  2865. #if ENABLED(DUAL_X_CARRIAGE)
  2866. #error "DUAL_X_CARRIAGE requires both MIN_ and MAX_SOFTWARE_ENDSTOPS."
  2867. #elif HAS_HOTEND_OFFSET
  2868. #error "MIN_ and MAX_SOFTWARE_ENDSTOPS are both required with offset hotends."
  2869. #endif
  2870. #endif
  2871. /**
  2872. * Ensure this option is set intentionally
  2873. */
  2874. #if ENABLED(PSU_CONTROL)
  2875. #ifndef PSU_ACTIVE_STATE
  2876. #error "PSU_CONTROL requires PSU_ACTIVE_STATE to be defined as 'HIGH' or 'LOW'."
  2877. #elif !PIN_EXISTS(PS_ON)
  2878. #error "PSU_CONTROL requires PS_ON_PIN."
  2879. #elif POWER_OFF_DELAY < 0
  2880. #error "POWER_OFF_DELAY must be a positive value."
  2881. #endif
  2882. #endif
  2883. #if HAS_CUTTER
  2884. #ifndef CUTTER_POWER_UNIT
  2885. #error "CUTTER_POWER_UNIT is required with a spindle or laser."
  2886. #elif !CUTTER_UNIT_IS(PWM255) && !CUTTER_UNIT_IS(PERCENT) && !CUTTER_UNIT_IS(RPM) && !CUTTER_UNIT_IS(SERVO)
  2887. #error "CUTTER_POWER_UNIT must be PWM255, PERCENT, RPM, or SERVO."
  2888. #endif
  2889. #if ENABLED(LASER_POWER_INLINE)
  2890. #if ENABLED(SPINDLE_CHANGE_DIR)
  2891. #error "SPINDLE_CHANGE_DIR and LASER_POWER_INLINE are incompatible."
  2892. #elif ENABLED(LASER_MOVE_G0_OFF) && DISABLED(LASER_MOVE_POWER)
  2893. #error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER."
  2894. #endif
  2895. #if ENABLED(LASER_POWER_INLINE_TRAPEZOID)
  2896. #if DISABLED(SPINDLE_LASER_PWM)
  2897. #error "LASER_POWER_INLINE_TRAPEZOID requires SPINDLE_LASER_PWM to function."
  2898. #elif ENABLED(S_CURVE_ACCELERATION)
  2899. //#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
  2900. // #define LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
  2901. // #warning "Combining LASER_POWER_INLINE_TRAPEZOID with S_CURVE_ACCELERATION may result in unintended behavior."
  2902. //#endif
  2903. #endif
  2904. #endif
  2905. #if ENABLED(LASER_POWER_INLINE_INVERT)
  2906. //#ifndef LASER_POWER_INLINE_INVERT_WARN
  2907. // #define LASER_POWER_INLINE_INVERT_WARN
  2908. // #warning "Enabling LASER_POWER_INLINE_INVERT means that `M5` won't kill the laser immediately; use `M5 I` instead."
  2909. //#endif
  2910. #endif
  2911. #else
  2912. #if SPINDLE_LASER_POWERUP_DELAY < 1
  2913. #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0."
  2914. #elif SPINDLE_LASER_POWERDOWN_DELAY < 1
  2915. #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0."
  2916. #elif ENABLED(LASER_MOVE_POWER)
  2917. #error "LASER_MOVE_POWER requires LASER_POWER_INLINE."
  2918. #elif ANY(LASER_POWER_INLINE_TRAPEZOID, LASER_POWER_INLINE_INVERT, LASER_MOVE_G0_OFF, LASER_MOVE_POWER)
  2919. #error "Enabled an inline laser feature without inline laser power being enabled."
  2920. #endif
  2921. #endif
  2922. #define _PIN_CONFLICT(P) (PIN_EXISTS(P) && P##_PIN == SPINDLE_LASER_PWM_PIN)
  2923. #if BOTH(SPINDLE_FEATURE, LASER_FEATURE)
  2924. #error "Enable only one of SPINDLE_FEATURE or LASER_FEATURE."
  2925. #elif !PIN_EXISTS(SPINDLE_LASER_ENA) && DISABLED(SPINDLE_SERVO)
  2926. #error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power."
  2927. #elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR)
  2928. #error "SPINDLE_DIR_PIN is required for SPINDLE_CHANGE_DIR."
  2929. #elif ENABLED(SPINDLE_LASER_PWM)
  2930. #if !defined(SPINDLE_LASER_PWM_PIN) || SPINDLE_LASER_PWM_PIN < 0
  2931. #error "SPINDLE_LASER_PWM_PIN is required for SPINDLE_LASER_PWM."
  2932. #elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN)
  2933. #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin."
  2934. #elif !defined(SPINDLE_LASER_PWM_INVERT)
  2935. #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE."
  2936. #elif !(defined(SPEED_POWER_INTERCEPT) && defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP))
  2937. #error "SPINDLE_LASER_PWM equation constant(s) missing."
  2938. #elif _PIN_CONFLICT(X_MIN)
  2939. #error "SPINDLE_LASER_PWM pin conflicts with X_MIN_PIN."
  2940. #elif _PIN_CONFLICT(X_MAX)
  2941. #error "SPINDLE_LASER_PWM pin conflicts with X_MAX_PIN."
  2942. #elif _PIN_CONFLICT(Z_STEP)
  2943. #error "SPINDLE_LASER_PWM pin conflicts with Z_STEP_PIN."
  2944. #elif _PIN_CONFLICT(CASE_LIGHT)
  2945. #error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN."
  2946. #elif _PIN_CONFLICT(E0_AUTO_FAN)
  2947. #error "SPINDLE_LASER_PWM_PIN conflicts with E0_AUTO_FAN_PIN."
  2948. #elif _PIN_CONFLICT(E1_AUTO_FAN)
  2949. #error "SPINDLE_LASER_PWM_PIN conflicts with E1_AUTO_FAN_PIN."
  2950. #elif _PIN_CONFLICT(E2_AUTO_FAN)
  2951. #error "SPINDLE_LASER_PWM_PIN conflicts with E2_AUTO_FAN_PIN."
  2952. #elif _PIN_CONFLICT(E3_AUTO_FAN)
  2953. #error "SPINDLE_LASER_PWM_PIN conflicts with E3_AUTO_FAN_PIN."
  2954. #elif _PIN_CONFLICT(E4_AUTO_FAN)
  2955. #error "SPINDLE_LASER_PWM_PIN conflicts with E4_AUTO_FAN_PIN."
  2956. #elif _PIN_CONFLICT(E5_AUTO_FAN)
  2957. #error "SPINDLE_LASER_PWM_PIN conflicts with E5_AUTO_FAN_PIN."
  2958. #elif _PIN_CONFLICT(E6_AUTO_FAN)
  2959. #error "SPINDLE_LASER_PWM_PIN conflicts with E6_AUTO_FAN_PIN."
  2960. #elif _PIN_CONFLICT(E7_AUTO_FAN)
  2961. #error "SPINDLE_LASER_PWM_PIN conflicts with E7_AUTO_FAN_PIN."
  2962. #elif _PIN_CONFLICT(FAN)
  2963. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN_PIN."
  2964. #elif _PIN_CONFLICT(FAN1)
  2965. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN1_PIN."
  2966. #elif _PIN_CONFLICT(FAN2)
  2967. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN2_PIN."
  2968. #elif _PIN_CONFLICT(FAN3)
  2969. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN3_PIN."
  2970. #elif _PIN_CONFLICT(FAN4)
  2971. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN4_PIN."
  2972. #elif _PIN_CONFLICT(FAN5)
  2973. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN5_PIN."
  2974. #elif _PIN_CONFLICT(FAN6)
  2975. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN6_PIN."
  2976. #elif _PIN_CONFLICT(FAN7)
  2977. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN7_PIN."
  2978. #elif _PIN_CONFLICT(CONTROLLERFAN)
  2979. #error "SPINDLE_LASER_PWM_PIN conflicts with CONTROLLERFAN_PIN."
  2980. #elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_XY)
  2981. #error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_XY."
  2982. #elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_Z)
  2983. #error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_Z."
  2984. #elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_E)
  2985. #error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_E."
  2986. #endif
  2987. #endif
  2988. #undef _PIN_CONFLICT
  2989. #endif
  2990. #if !HAS_MARLINUI_U8GLIB
  2991. #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
  2992. #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
  2993. #endif
  2994. #endif
  2995. #if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && ADC_BUTTON_DEBOUNCE_DELAY < 16
  2996. #error "ADC_BUTTON_DEBOUNCE_DELAY must be greater than 16."
  2997. #endif
  2998. /**
  2999. * Check to make sure MONITOR_DRIVER_STATUS isn't enabled
  3000. * on boards where TMC drivers share the SPI bus with SD.
  3001. */
  3002. #if HAS_TMC_SPI && ALL(MONITOR_DRIVER_STATUS, SDSUPPORT, USES_SHARED_SPI)
  3003. #error "MONITOR_DRIVER_STATUS and SDSUPPORT cannot be used together on boards with shared SPI."
  3004. #endif
  3005. // G60/G61 Position Save
  3006. #if SAVED_POSITIONS > 256
  3007. #error "SAVED_POSITIONS must be an integer from 0 to 256."
  3008. #endif
  3009. /**
  3010. * Stepper Chunk support
  3011. */
  3012. #if BOTH(DIRECT_STEPPING, LIN_ADVANCE)
  3013. #error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible."
  3014. #endif
  3015. /**
  3016. * Touch Buttons
  3017. */
  3018. #if ENABLED(TOUCH_SCREEN)
  3019. #ifndef TOUCH_CALIBRATION_X
  3020. #error "TOUCH_CALIBRATION_X must be defined with TOUCH_SCREEN."
  3021. #endif
  3022. #ifndef TOUCH_CALIBRATION_Y
  3023. #error "TOUCH_CALIBRATION_Y must be defined with TOUCH_SCREEN."
  3024. #endif
  3025. #ifndef TOUCH_OFFSET_X
  3026. #error "TOUCH_OFFSET_X must be defined with TOUCH_SCREEN."
  3027. #endif
  3028. #ifndef TOUCH_OFFSET_Y
  3029. #error "TOUCH_OFFSET_Y must be defined with TOUCH_SCREEN."
  3030. #endif
  3031. #endif
  3032. /**
  3033. * Sanity check for WIFI
  3034. */
  3035. #if EITHER(ESP3D_WIFISUPPORT, WIFISUPPORT) && DISABLED(ARDUINO_ARCH_ESP32)
  3036. #error "ESP3D_WIFISUPPORT or WIFISUPPORT requires an ESP32 MOTHERBOARD."
  3037. #endif
  3038. /**
  3039. * Sanity Check for Password Feature
  3040. */
  3041. #if ENABLED(PASSWORD_FEATURE)
  3042. #if NONE(HAS_LCD_MENU, PASSWORD_UNLOCK_GCODE, PASSWORD_CHANGE_GCODE)
  3043. #error "Without PASSWORD_UNLOCK_GCODE, PASSWORD_CHANGE_GCODE, or a supported LCD there's no way to unlock the printer or set a password."
  3044. #elif DISABLED(EEPROM_SETTINGS)
  3045. #warning "PASSWORD_FEATURE settings will be lost on power-off without EEPROM_SETTINGS."
  3046. #endif
  3047. #endif
  3048. /**
  3049. * Sanity check for valid stepper driver types
  3050. */
  3051. #define _BAD_DRIVER(A) (defined(A##_DRIVER_TYPE) && !_DRIVER_ID(A##_DRIVER_TYPE))
  3052. #if _BAD_DRIVER(X)
  3053. #error "X_DRIVER_TYPE is not recognized."
  3054. #endif
  3055. #if _BAD_DRIVER(Y)
  3056. #error "Y_DRIVER_TYPE is not recognized."
  3057. #endif
  3058. #if _BAD_DRIVER(Z)
  3059. #error "Z_DRIVER_TYPE is not recognized."
  3060. #endif
  3061. #if _BAD_DRIVER(X2)
  3062. #error "X2_DRIVER_TYPE is not recognized."
  3063. #endif
  3064. #if _BAD_DRIVER(Y2)
  3065. #error "Y2_DRIVER_TYPE is not recognized."
  3066. #endif
  3067. #if _BAD_DRIVER(Z2)
  3068. #error "Z2_DRIVER_TYPE is not recognized."
  3069. #endif
  3070. #if _BAD_DRIVER(Z3)
  3071. #error "Z3_DRIVER_TYPE is not recognized."
  3072. #endif
  3073. #if _BAD_DRIVER(Z4)
  3074. #error "Z4_DRIVER_TYPE is not recognized."
  3075. #endif
  3076. #if _BAD_DRIVER(E0)
  3077. #error "E0_DRIVER_TYPE is not recognized."
  3078. #endif
  3079. #if _BAD_DRIVER(E1)
  3080. #error "E1_DRIVER_TYPE is not recognized."
  3081. #endif
  3082. #if _BAD_DRIVER(E2)
  3083. #error "E2_DRIVER_TYPE is not recognized."
  3084. #endif
  3085. #if _BAD_DRIVER(E3)
  3086. #error "E3_DRIVER_TYPE is not recognized."
  3087. #endif
  3088. #if _BAD_DRIVER(E4)
  3089. #error "E4_DRIVER_TYPE is not recognized."
  3090. #endif
  3091. #if _BAD_DRIVER(E5)
  3092. #error "E5_DRIVER_TYPE is not recognized."
  3093. #endif
  3094. #if _BAD_DRIVER(E6)
  3095. #error "E6_DRIVER_TYPE is not recognized."
  3096. #endif
  3097. #if _BAD_DRIVER(E7)
  3098. #error "E7_DRIVER_TYPE is not recognized."
  3099. #endif
  3100. #undef _BAD_DRIVER
  3101. // Misc. Cleanup
  3102. #undef _TEST_PWM