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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333
  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. #if ENABLED(PROBE_ACTIVATION_SWITCH)
  1333. #ifndef PROBE_ACTIVATION_SWITCH_STATE
  1334. #error "PROBE_ACTIVATION_SWITCH_STATE is required for PROBE_ACTIVATION_SWITCH."
  1335. #elif !PIN_EXISTS(PROBE_ACTIVATION_SWITCH)
  1336. #error "A PROBE_ACTIVATION_SWITCH_PIN is required for PROBE_ACTIVATION_SWITCH."
  1337. #endif
  1338. #endif
  1339. #else
  1340. /**
  1341. * Require some kind of probe for bed leveling and probe testing
  1342. */
  1343. #if HAS_ABL_NOT_UBL && !PROBE_SELECTED
  1344. #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."
  1345. #endif
  1346. #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
  1347. #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."
  1348. #endif
  1349. #endif
  1350. /**
  1351. * Allow only one bed leveling option to be defined
  1352. */
  1353. #if MANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
  1354. #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."
  1355. #endif
  1356. /**
  1357. * Bed Leveling Requirements
  1358. */
  1359. #if ENABLED(AUTO_BED_LEVELING_UBL)
  1360. /**
  1361. * Unified Bed Leveling
  1362. */
  1363. #if IS_SCARA
  1364. #error "AUTO_BED_LEVELING_UBL does not yet support SCARA printers."
  1365. #elif DISABLED(EEPROM_SETTINGS)
  1366. #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS."
  1367. #elif !WITHIN(GRID_MAX_POINTS_X, 3, 15) || !WITHIN(GRID_MAX_POINTS_Y, 3, 15)
  1368. #error "GRID_MAX_POINTS_[XY] must be a whole number between 3 and 15."
  1369. #endif
  1370. #elif HAS_ABL_NOT_UBL
  1371. /**
  1372. * Auto Bed Leveling
  1373. */
  1374. /**
  1375. * Delta and SCARA have limited bed leveling options
  1376. */
  1377. #if IS_SCARA && DISABLED(AUTO_BED_LEVELING_BILINEAR)
  1378. #error "SCARA machines can only use the AUTO_BED_LEVELING_BILINEAR leveling option."
  1379. #endif
  1380. #elif ENABLED(MESH_BED_LEVELING)
  1381. // Mesh Bed Leveling
  1382. #if ENABLED(DELTA)
  1383. #error "MESH_BED_LEVELING is not compatible with DELTA printers."
  1384. #elif GRID_MAX_POINTS_X > 9 || GRID_MAX_POINTS_Y > 9
  1385. #error "GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y must be less than 10 for MBL."
  1386. #endif
  1387. #endif
  1388. #if ALL(HAS_LEVELING, RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28)
  1389. #error "Only enable RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28, but not both."
  1390. #endif
  1391. #if HAS_MESH && HAS_CLASSIC_JERK
  1392. static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling.");
  1393. #endif
  1394. #if ENABLED(G26_MESH_VALIDATION)
  1395. #if !EXTRUDERS
  1396. #error "G26_MESH_VALIDATION requires at least one extruder."
  1397. #elif !HAS_MESH
  1398. #error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL."
  1399. #endif
  1400. #endif
  1401. #if ENABLED(MESH_EDIT_GFX_OVERLAY) && !BOTH(AUTO_BED_LEVELING_UBL, HAS_MARLINUI_U8GLIB)
  1402. #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD."
  1403. #endif
  1404. #if ENABLED(G29_RETRY_AND_RECOVER)
  1405. #if ENABLED(AUTO_BED_LEVELING_UBL)
  1406. #error "G29_RETRY_AND_RECOVER is not compatible with UBL."
  1407. #elif ENABLED(MESH_BED_LEVELING)
  1408. #error "G29_RETRY_AND_RECOVER is not compatible with MESH_BED_LEVELING."
  1409. #endif
  1410. #endif
  1411. /**
  1412. * LCD_BED_LEVELING requirements
  1413. */
  1414. #if ENABLED(LCD_BED_LEVELING)
  1415. #if !HAS_LCD_MENU
  1416. #error "LCD_BED_LEVELING requires a programmable LCD controller."
  1417. #elif !(ENABLED(MESH_BED_LEVELING) || HAS_ABL_NOT_UBL)
  1418. #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or AUTO_BED_LEVELING."
  1419. #endif
  1420. #endif
  1421. #if BOTH(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
  1422. #error "Disable PREHEAT_BEFORE_LEVELING when using PREHEAT_BEFORE_PROBING."
  1423. #endif
  1424. /**
  1425. * Homing
  1426. */
  1427. constexpr float hbm[] = HOMING_BUMP_MM;
  1428. static_assert(COUNT(hbm) == XYZ, "HOMING_BUMP_MM requires X, Y, and Z elements.");
  1429. static_assert(hbm[X_AXIS] >= 0, "HOMING_BUMP_MM.X must be greater than or equal to 0.");
  1430. static_assert(hbm[Y_AXIS] >= 0, "HOMING_BUMP_MM.Y must be greater than or equal to 0.");
  1431. static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal to 0.");
  1432. #if ENABLED(CODEPENDENT_XY_HOMING)
  1433. #if ENABLED(QUICK_HOME)
  1434. #error "QUICK_HOME is incompatible with CODEPENDENT_XY_HOMING."
  1435. #elif IS_KINEMATIC
  1436. #error "CODEPENDENT_XY_HOMING requires a Cartesian setup."
  1437. #endif
  1438. #endif
  1439. /**
  1440. * Make sure Z_SAFE_HOMING point is reachable
  1441. */
  1442. #if ENABLED(Z_SAFE_HOMING)
  1443. 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.");
  1444. 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.");
  1445. #endif
  1446. /**
  1447. * Make sure DISABLE_[XYZ] compatible with selected homing options
  1448. */
  1449. #if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z)
  1450. #if EITHER(HOME_AFTER_DEACTIVATE, Z_SAFE_HOMING)
  1451. #error "DISABLE_[XYZ] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING."
  1452. #endif
  1453. #endif
  1454. /**
  1455. * Filament Width Sensor
  1456. */
  1457. #if ENABLED(FILAMENT_WIDTH_SENSOR)
  1458. #if !HAS_FILAMENT_WIDTH_SENSOR
  1459. #error "FILAMENT_WIDTH_SENSOR requires a FILWIDTH_PIN to be defined."
  1460. #elif ENABLED(NO_VOLUMETRICS)
  1461. #error "FILAMENT_WIDTH_SENSOR requires NO_VOLUMETRICS to be disabled."
  1462. #endif
  1463. #endif
  1464. /**
  1465. * System Power Sensor
  1466. */
  1467. #if ENABLED(POWER_MONITOR_CURRENT) && !PIN_EXISTS(POWER_MONITOR_CURRENT)
  1468. #error "POWER_MONITOR_CURRENT requires a valid POWER_MONITOR_CURRENT_PIN."
  1469. #elif ENABLED(POWER_MONITOR_VOLTAGE) && !PIN_EXISTS(POWER_MONITOR_VOLTAGE)
  1470. #error "POWER_MONITOR_VOLTAGE requires POWER_MONITOR_VOLTAGE_PIN to be defined."
  1471. #elif BOTH(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE) && POWER_MONITOR_CURRENT_PIN == POWER_MONITOR_VOLTAGE_PIN
  1472. #error "POWER_MONITOR_CURRENT_PIN and POWER_MONITOR_VOLTAGE_PIN must be different."
  1473. #endif
  1474. /**
  1475. * Volumetric Extruder Limit
  1476. */
  1477. #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
  1478. #if ENABLED(NO_VOLUMETRICS)
  1479. #error "VOLUMETRIC_EXTRUDER_LIMIT requires NO_VOLUMETRICS to be disabled."
  1480. #elif MIN_STEPS_PER_SEGMENT > 1
  1481. #error "VOLUMETRIC_EXTRUDER_LIMIT is not compatible with MIN_STEPS_PER_SEGMENT greater than 1."
  1482. #endif
  1483. #endif
  1484. /**
  1485. * ULTIPANEL encoder
  1486. */
  1487. #if IS_ULTIPANEL && NONE(IS_NEWPANEL, SR_LCD_2W_NL) && !defined(SHIFT_CLK)
  1488. #error "ULTIPANEL controllers require some kind of encoder."
  1489. #endif
  1490. #if ENCODER_PULSES_PER_STEP < 0
  1491. #error "ENCODER_PULSES_PER_STEP should not be negative, use REVERSE_MENU_DIRECTION instead."
  1492. #endif
  1493. /**
  1494. * SAV_3DGLCD display options
  1495. */
  1496. #if ENABLED(SAV_3DGLCD)
  1497. #if NONE(U8GLIB_SSD1306, U8GLIB_SH1106)
  1498. #error "Enable a SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106."
  1499. #elif BOTH(U8GLIB_SSD1306, U8GLIB_SH1106)
  1500. #error "Only enable one SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106."
  1501. #endif
  1502. #endif
  1503. /**
  1504. * Allen Key
  1505. * Deploying the Allen Key probe uses big moves in z direction. Too dangerous for an unhomed z-axis.
  1506. */
  1507. #if BOTH(Z_PROBE_ALLEN_KEY, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && (Z_HOME_DIR < 0)
  1508. #error "You can't home to a Z min endstop with a Z_PROBE_ALLEN_KEY."
  1509. #endif
  1510. /**
  1511. * Dual X Carriage requirements
  1512. */
  1513. #if ENABLED(DUAL_X_CARRIAGE)
  1514. #if EXTRUDERS < 2
  1515. #error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
  1516. #elif ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
  1517. #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, COREZX, or MARKFORGED_XY."
  1518. #elif !GOOD_AXIS_PINS(X2)
  1519. #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
  1520. #elif !HAS_X_MAX
  1521. #error "DUAL_X_CARRIAGE requires USE_XMAX_PLUG and an X Max Endstop."
  1522. #elif !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS)
  1523. #error "DUAL_X_CARRIAGE requires X2_HOME_POS, X2_MIN_POS, and X2_MAX_POS."
  1524. #elif X_HOME_DIR != -1 || X2_HOME_DIR != 1
  1525. #error "DUAL_X_CARRIAGE requires X_HOME_DIR -1 and X2_HOME_DIR 1."
  1526. #endif
  1527. #endif
  1528. #undef GOOD_AXIS_PINS
  1529. /**
  1530. * Make sure auto fan pins don't conflict with the fan pin
  1531. */
  1532. #if HAS_AUTO_FAN
  1533. #if HAS_FAN0
  1534. #if E0_AUTO_FAN_PIN == FAN_PIN
  1535. #error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN."
  1536. #elif E1_AUTO_FAN_PIN == FAN_PIN
  1537. #error "You cannot set E1_AUTO_FAN_PIN equal to FAN_PIN."
  1538. #elif E2_AUTO_FAN_PIN == FAN_PIN
  1539. #error "You cannot set E2_AUTO_FAN_PIN equal to FAN_PIN."
  1540. #elif E3_AUTO_FAN_PIN == FAN_PIN
  1541. #error "You cannot set E3_AUTO_FAN_PIN equal to FAN_PIN."
  1542. #endif
  1543. #endif
  1544. #endif
  1545. #if HAS_FAN0 && CONTROLLER_FAN_PIN == FAN_PIN
  1546. #error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
  1547. #endif
  1548. #if ENABLED(USE_CONTROLLER_FAN)
  1549. #if !HAS_CONTROLLER_FAN
  1550. #error "USE_CONTROLLER_FAN requires a CONTROLLER_FAN_PIN. Define in Configuration_adv.h."
  1551. #elif E0_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1552. #error "You cannot set E0_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1553. #elif E1_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1554. #error "You cannot set E1_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1555. #elif E2_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1556. #error "You cannot set E2_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1557. #elif E3_AUTO_FAN_PIN == CONTROLLER_FAN_PIN
  1558. #error "You cannot set E3_AUTO_FAN_PIN equal to CONTROLLER_FAN_PIN."
  1559. #endif
  1560. #endif
  1561. /**
  1562. * Case Light requirements
  1563. */
  1564. #if ENABLED(CASE_LIGHT_ENABLE)
  1565. #if !PIN_EXISTS(CASE_LIGHT)
  1566. #error "CASE_LIGHT_ENABLE requires CASE_LIGHT_PIN to be defined."
  1567. #elif CASE_LIGHT_PIN == FAN_PIN
  1568. #error "CASE_LIGHT_PIN conflicts with FAN_PIN. Resolve before continuing."
  1569. #endif
  1570. #endif
  1571. /**
  1572. * Required custom thermistor settings
  1573. */
  1574. #if HEATER_0_USER_THERMISTOR && !(defined(HOTEND0_PULLUP_RESISTOR_OHMS) && defined(HOTEND0_RESISTANCE_25C_OHMS) && defined(HOTEND0_BETA))
  1575. #error "TEMP_SENSOR_0 1000 requires HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS and HOTEND0_BETA in Configuration_adv.h."
  1576. #elif HEATER_1_USER_THERMISTOR && !(defined(HOTEND1_PULLUP_RESISTOR_OHMS) && defined(HOTEND1_RESISTANCE_25C_OHMS) && defined(HOTEND1_BETA))
  1577. #error "TEMP_SENSOR_1 1000 requires HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS and HOTEND1_BETA in Configuration_adv.h."
  1578. #elif HEATER_2_USER_THERMISTOR && !(defined(HOTEND2_PULLUP_RESISTOR_OHMS) && defined(HOTEND2_RESISTANCE_25C_OHMS) && defined(HOTEND2_BETA))
  1579. #error "TEMP_SENSOR_2 1000 requires HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS and HOTEND2_BETA in Configuration_adv.h."
  1580. #elif HEATER_3_USER_THERMISTOR && !(defined(HOTEND3_PULLUP_RESISTOR_OHMS) && defined(HOTEND3_RESISTANCE_25C_OHMS) && defined(HOTEND3_BETA))
  1581. #error "TEMP_SENSOR_3 1000 requires HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS and HOTEND3_BETA in Configuration_adv.h."
  1582. #elif HEATER_4_USER_THERMISTOR && !(defined(HOTEND4_PULLUP_RESISTOR_OHMS) && defined(HOTEND4_RESISTANCE_25C_OHMS) && defined(HOTEND4_BETA))
  1583. #error "TEMP_SENSOR_4 1000 requires HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS and HOTEND4_BETA in Configuration_adv.h."
  1584. #elif HEATER_5_USER_THERMISTOR && !(defined(HOTEND5_PULLUP_RESISTOR_OHMS) && defined(HOTEND5_RESISTANCE_25C_OHMS) && defined(HOTEND5_BETA))
  1585. #error "TEMP_SENSOR_5 1000 requires HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS and HOTEND5_BETA in Configuration_adv.h."
  1586. #elif HEATER_6_USER_THERMISTOR && !(defined(HOTEND6_PULLUP_RESISTOR_OHMS) && defined(HOTEND6_RESISTANCE_25C_OHMS) && defined(HOTEND6_BETA))
  1587. #error "TEMP_SENSOR_6 1000 requires HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS and HOTEND6_BETA in Configuration_adv.h."
  1588. #elif HEATER_7_USER_THERMISTOR && !(defined(HOTEND7_PULLUP_RESISTOR_OHMS) && defined(HOTEND7_RESISTANCE_25C_OHMS) && defined(HOTEND7_BETA))
  1589. #error "TEMP_SENSOR_7 1000 requires HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS and HOTEND7_BETA in Configuration_adv.h."
  1590. #elif HEATER_BED_USER_THERMISTOR && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA))
  1591. #error "TEMP_SENSOR_BED 1000 requires BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS and BED_BETA in Configuration_adv.h."
  1592. #elif HEATER_CHAMBER_USER_THERMISTOR && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA))
  1593. #error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
  1594. #endif
  1595. /**
  1596. * Pins and Sensor IDs must be set for each heater
  1597. */
  1598. #if HEATER_0_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS)
  1599. #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
  1600. #elif HAS_HOTEND && !HAS_TEMP_HOTEND && !HEATER_0_DUMMY_THERMISTOR
  1601. #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
  1602. #elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
  1603. #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."
  1604. #endif
  1605. #if HAS_MULTI_HOTEND
  1606. #if HEATER_1_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS2)
  1607. #error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board."
  1608. #elif TEMP_SENSOR_1 == 0
  1609. #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
  1610. #elif !ANY_PIN(TEMP_1, MAX6675_SS2) && !HEATER_1_DUMMY_THERMISTOR
  1611. #error "TEMP_1_PIN not defined for this board."
  1612. #elif ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
  1613. #error "HOTENDS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT."
  1614. #endif
  1615. #if HOTENDS > 2
  1616. #if TEMP_SENSOR_2 == 0
  1617. #error "TEMP_SENSOR_2 is required with 3 or more HOTENDS."
  1618. #elif !HAS_HEATER_2
  1619. #error "HEATER_2_PIN not defined for this board."
  1620. #elif !PIN_EXISTS(TEMP_2) && !HEATER_2_DUMMY_THERMISTOR
  1621. #error "TEMP_2_PIN not defined for this board."
  1622. #endif
  1623. #if HOTENDS > 3
  1624. #if TEMP_SENSOR_3 == 0
  1625. #error "TEMP_SENSOR_3 is required with 4 or more HOTENDS."
  1626. #elif !HAS_HEATER_3
  1627. #error "HEATER_3_PIN not defined for this board."
  1628. #elif !PIN_EXISTS(TEMP_3) && !HEATER_3_DUMMY_THERMISTOR
  1629. #error "TEMP_3_PIN not defined for this board."
  1630. #endif
  1631. #if HOTENDS > 4
  1632. #if TEMP_SENSOR_4 == 0
  1633. #error "TEMP_SENSOR_4 is required with 5 or more HOTENDS."
  1634. #elif !HAS_HEATER_4
  1635. #error "HEATER_4_PIN not defined for this board."
  1636. #elif !PIN_EXISTS(TEMP_4) && !HEATER_4_DUMMY_THERMISTOR
  1637. #error "TEMP_4_PIN not defined for this board."
  1638. #endif
  1639. #if HOTENDS > 5
  1640. #if TEMP_SENSOR_5 == 0
  1641. #error "TEMP_SENSOR_5 is required with 6 HOTENDS."
  1642. #elif !HAS_HEATER_5
  1643. #error "HEATER_5_PIN not defined for this board."
  1644. #elif !PIN_EXISTS(TEMP_5) && !HEATER_5_DUMMY_THERMISTOR
  1645. #error "TEMP_5_PIN not defined for this board."
  1646. #endif
  1647. #if HOTENDS > 6
  1648. #if TEMP_SENSOR_6 == 0
  1649. #error "TEMP_SENSOR_6 is required with 6 HOTENDS."
  1650. #elif !HAS_HEATER_6
  1651. #error "HEATER_6_PIN not defined for this board."
  1652. #elif !PIN_EXISTS(TEMP_6) && !HEATER_6_DUMMY_THERMISTOR
  1653. #error "TEMP_6_PIN not defined for this board."
  1654. #endif
  1655. #if HOTENDS > 7
  1656. #if TEMP_SENSOR_7 == 0
  1657. #error "TEMP_SENSOR_7 is required with 7 HOTENDS."
  1658. #elif !HAS_HEATER_7
  1659. #error "HEATER_7_PIN not defined for this board."
  1660. #elif !PIN_EXISTS(TEMP_7) && !HEATER_7_DUMMY_THERMISTOR
  1661. #error "TEMP_7_PIN not defined for this board."
  1662. #endif
  1663. #elif TEMP_SENSOR_7 != 0
  1664. #error "TEMP_SENSOR_7 shouldn't be set with only 7 HOTENDS."
  1665. #endif
  1666. #elif TEMP_SENSOR_6 != 0
  1667. #error "TEMP_SENSOR_6 shouldn't be set with only 6 HOTENDS."
  1668. #elif TEMP_SENSOR_7 != 0
  1669. #error "TEMP_SENSOR_7 shouldn't be set with only 6 HOTENDS."
  1670. #endif
  1671. #elif TEMP_SENSOR_5 != 0
  1672. #error "TEMP_SENSOR_5 shouldn't be set with only 5 HOTENDS."
  1673. #elif TEMP_SENSOR_6 != 0
  1674. #error "TEMP_SENSOR_6 shouldn't be set with only 5 HOTENDS."
  1675. #elif TEMP_SENSOR_7 != 0
  1676. #error "TEMP_SENSOR_7 shouldn't be set with only 5 HOTENDS."
  1677. #endif
  1678. #elif TEMP_SENSOR_4 != 0
  1679. #error "TEMP_SENSOR_4 shouldn't be set with only 4 HOTENDS."
  1680. #elif TEMP_SENSOR_5 != 0
  1681. #error "TEMP_SENSOR_5 shouldn't be set with only 4 HOTENDS."
  1682. #elif TEMP_SENSOR_6 != 0
  1683. #error "TEMP_SENSOR_6 shouldn't be set with only 4 HOTENDS."
  1684. #elif TEMP_SENSOR_7 != 0
  1685. #error "TEMP_SENSOR_7 shouldn't be set with only 4 HOTENDS."
  1686. #endif
  1687. #elif TEMP_SENSOR_3 != 0
  1688. #error "TEMP_SENSOR_3 shouldn't be set with only 3 HOTENDS."
  1689. #elif TEMP_SENSOR_4 != 0
  1690. #error "TEMP_SENSOR_4 shouldn't be set with only 3 HOTENDS."
  1691. #elif TEMP_SENSOR_5 != 0
  1692. #error "TEMP_SENSOR_5 shouldn't be set with only 3 HOTENDS."
  1693. #elif TEMP_SENSOR_6 != 0
  1694. #error "TEMP_SENSOR_6 shouldn't be set with only 3 HOTENDS."
  1695. #elif TEMP_SENSOR_7 != 0
  1696. #error "TEMP_SENSOR_7 shouldn't be set with only 3 HOTENDS."
  1697. #endif
  1698. #elif TEMP_SENSOR_2 != 0
  1699. #error "TEMP_SENSOR_2 shouldn't be set with only 2 HOTENDS."
  1700. #elif TEMP_SENSOR_3 != 0
  1701. #error "TEMP_SENSOR_3 shouldn't be set with only 2 HOTENDS."
  1702. #elif TEMP_SENSOR_4 != 0
  1703. #error "TEMP_SENSOR_4 shouldn't be set with only 2 HOTENDS."
  1704. #elif TEMP_SENSOR_5 != 0
  1705. #error "TEMP_SENSOR_5 shouldn't be set with only 2 HOTENDS."
  1706. #elif TEMP_SENSOR_6 != 0
  1707. #error "TEMP_SENSOR_6 shouldn't be set with only 2 HOTENDS."
  1708. #elif TEMP_SENSOR_7 != 0
  1709. #error "TEMP_SENSOR_7 shouldn't be set with only 2 HOTENDS."
  1710. #endif
  1711. #elif TEMP_SENSOR_1 != 0 && DISABLED(TEMP_SENSOR_1_AS_REDUNDANT)
  1712. #error "TEMP_SENSOR_1 shouldn't be set with only 1 HOTEND."
  1713. #elif TEMP_SENSOR_2 != 0
  1714. #error "TEMP_SENSOR_2 shouldn't be set with only 1 HOTEND."
  1715. #elif TEMP_SENSOR_3 != 0
  1716. #error "TEMP_SENSOR_3 shouldn't be set with only 1 HOTEND."
  1717. #elif TEMP_SENSOR_4 != 0
  1718. #error "TEMP_SENSOR_4 shouldn't be set with only 1 HOTEND."
  1719. #elif TEMP_SENSOR_5 != 0
  1720. #error "TEMP_SENSOR_5 shouldn't be set with only 1 HOTEND."
  1721. #elif TEMP_SENSOR_6 != 0
  1722. #error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND."
  1723. #elif TEMP_SENSOR_7 != 0
  1724. #error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND."
  1725. #endif
  1726. #if TEMP_SENSOR_CHAMBER && !PIN_EXISTS(TEMP_CHAMBER)
  1727. #error "TEMP_SENSOR_CHAMBER requires TEMP_CHAMBER_PIN."
  1728. #endif
  1729. #if ENABLED(CHAMBER_FAN) && !(defined(CHAMBER_FAN_MODE) && WITHIN(CHAMBER_FAN_MODE, 0, 2))
  1730. #error "CHAMBER_FAN_MODE must be between 0 and 2."
  1731. #endif
  1732. #if ENABLED(CHAMBER_VENT)
  1733. #ifndef CHAMBER_VENT_SERVO_NR
  1734. #error "CHAMBER_VENT_SERVO_NR is required for CHAMBER SERVO."
  1735. #elif !NUM_SERVOS
  1736. #error "NUM_SERVOS is required for a Heated Chamber vent servo (CHAMBER_VENT_SERVO_NR)."
  1737. #elif CHAMBER_VENT_SERVO_NR >= NUM_SERVOS
  1738. #error "CHAMBER_VENT_SERVO_NR must be smaller than NUM_SERVOS."
  1739. #elif HAS_Z_SERVO_PROBE && CHAMBER_VENT_SERVO_NR == Z_PROBE_SERVO_NR
  1740. #error "CHAMBER SERVO is already used by BLTOUCH."
  1741. #elif CHAMBER_VENT_SERVO_NR == 0 && !PIN_EXISTS(SERVO0)
  1742. #error "SERVO0_PIN must be defined for your Heated Chamber vent servo."
  1743. #elif CHAMBER_VENT_SERVO_NR == 1 && !PIN_EXISTS(SERVO1)
  1744. #error "SERVO1_PIN must be defined for your Heated Chamber vent servo."
  1745. #elif CHAMBER_VENT_SERVO_NR == 2 && !PIN_EXISTS(SERVO2)
  1746. #error "SERVO2_PIN must be defined for your Heated Chamber vent servo."
  1747. #elif CHAMBER_VENT_SERVO_NR == 3 && !PIN_EXISTS(SERVO3)
  1748. #error "SERVO3_PIN must be defined for your Heated Chamber vent servo."
  1749. #endif
  1750. #endif
  1751. #if TEMP_SENSOR_PROBE
  1752. #if !PIN_EXISTS(TEMP_PROBE)
  1753. #error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
  1754. #elif !HAS_TEMP_ADC_PROBE
  1755. #error "TEMP_PROBE_PIN must be an ADC pin."
  1756. #elif !ENABLED(FIX_MOUNTED_PROBE)
  1757. #error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
  1758. #endif
  1759. #endif
  1760. #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) && TEMP_SENSOR_1 == 0
  1761. #error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
  1762. #endif
  1763. #if MAX6675_0_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_0) && defined(MAX31865_CALIBRATION_OHMS_0))
  1764. #error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0 is MAX31865."
  1765. #elif MAX6675_1_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_1) && defined(MAX31865_CALIBRATION_OHMS_1))
  1766. #error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1 is MAX31865."
  1767. #endif
  1768. /**
  1769. * Test Heater, Temp Sensor, and Extruder Pins
  1770. */
  1771. #if !HAS_HEATER_0 && EXTRUDERS
  1772. #error "HEATER_0_PIN not defined for this board."
  1773. #elif !ANY_PIN(TEMP_0, MAX6675_SS)
  1774. #error "TEMP_0_PIN not defined for this board."
  1775. #elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR))
  1776. #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
  1777. #elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
  1778. #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
  1779. #elif EXTRUDERS && TEMP_SENSOR_0 == 0
  1780. #error "TEMP_SENSOR_0 is required if there are any extruders."
  1781. #endif
  1782. /**
  1783. * Temperature status LEDs
  1784. */
  1785. #if ENABLED(TEMP_STAT_LEDS) && !ANY_PIN(STAT_LED_RED, STAT_LED_BLUE)
  1786. #error "TEMP_STAT_LEDS requires STAT_LED_RED_PIN or STAT_LED_BLUE_PIN, preferably both."
  1787. #endif
  1788. /**
  1789. * LED Control Menu
  1790. */
  1791. #if ENABLED(LED_CONTROL_MENU) && !HAS_COLOR_LEDS
  1792. #error "LED_CONTROL_MENU requires BLINKM, RGB_LED, RGBW_LED, PCA9533, PCA9632, or NEOPIXEL_LED."
  1793. #endif
  1794. /**
  1795. * LED Backlight Timeout
  1796. */
  1797. #if defined(LED_BACKLIGHT_TIMEOUT) && !(ENABLED(PSU_CONTROL) && ANY(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864))
  1798. #error "LED_BACKLIGHT_TIMEOUT requires a FYSETC Mini Panel and a Power Switch."
  1799. #endif
  1800. /**
  1801. * Basic multi hotend duplication mode
  1802. */
  1803. #if ENABLED(MULTI_NOZZLE_DUPLICATION)
  1804. #if HOTENDS < 2
  1805. #error "MULTI_NOZZLE_DUPLICATION requires 2 or more hotends."
  1806. #elif ENABLED(DUAL_X_CARRIAGE)
  1807. #error "MULTI_NOZZLE_DUPLICATION is incompatible with DUAL_X_CARRIAGE."
  1808. #elif ENABLED(SINGLENOZZLE)
  1809. #error "MULTI_NOZZLE_DUPLICATION is incompatible with SINGLENOZZLE."
  1810. #elif ENABLED(MIXING_EXTRUDER)
  1811. #error "MULTI_NOZZLE_DUPLICATION is incompatible with MIXING_EXTRUDER."
  1812. #elif ENABLED(SWITCHING_EXTRUDER)
  1813. #error "MULTI_NOZZLE_DUPLICATION is incompatible with SWITCHING_EXTRUDER."
  1814. #endif
  1815. #endif
  1816. /**
  1817. * Test Extruder Stepper Pins
  1818. */
  1819. #if E_STEPPERS
  1820. #if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
  1821. #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
  1822. #endif
  1823. #if E_STEPPERS > 1
  1824. #if !(PINS_EXIST(E1_STEP, E1_DIR) && HAS_E1_ENABLE)
  1825. #error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board."
  1826. #endif
  1827. #if E_STEPPERS > 2
  1828. #if !(PINS_EXIST(E2_STEP, E2_DIR) && HAS_E2_ENABLE)
  1829. #error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board."
  1830. #endif
  1831. #if E_STEPPERS > 3
  1832. #if !(PINS_EXIST(E3_STEP, E3_DIR) && HAS_E3_ENABLE)
  1833. #error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board."
  1834. #endif
  1835. #if E_STEPPERS > 4
  1836. #if !(PINS_EXIST(E4_STEP, E4_DIR) && HAS_E4_ENABLE)
  1837. #error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board."
  1838. #endif
  1839. #if E_STEPPERS > 5
  1840. #if !(PINS_EXIST(E5_STEP, E5_DIR) && HAS_E5_ENABLE)
  1841. #error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board."
  1842. #endif
  1843. #if E_STEPPERS > 6
  1844. #if !(PINS_EXIST(E6_STEP, E6_DIR) && HAS_E6_ENABLE)
  1845. #error "E6_STEP_PIN, E6_DIR_PIN, or E6_ENABLE_PIN not defined for this board."
  1846. #endif
  1847. #if E_STEPPERS > 7
  1848. #if !(PINS_EXIST(E7_STEP, E7_DIR) && HAS_E7_ENABLE)
  1849. #error "E7_STEP_PIN, E7_DIR_PIN, or E7_ENABLE_PIN not defined for this board."
  1850. #endif
  1851. #endif // E_STEPPERS > 7
  1852. #endif // E_STEPPERS > 6
  1853. #endif // E_STEPPERS > 5
  1854. #endif // E_STEPPERS > 4
  1855. #endif // E_STEPPERS > 3
  1856. #endif // E_STEPPERS > 2
  1857. #endif // E_STEPPERS > 1
  1858. #endif // E_STEPPERS
  1859. /**
  1860. * Endstop Tests
  1861. */
  1862. #define _PLUG_UNUSED_TEST(A,P) (DISABLED(USE_##P##MIN_PLUG, USE_##P##MAX_PLUG) \
  1863. && !(ENABLED(A##_DUAL_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) \
  1864. && !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) )
  1865. #define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z))
  1866. // At least 3 endstop plugs must be used
  1867. #if _AXIS_PLUG_UNUSED_TEST(X)
  1868. #error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG."
  1869. #endif
  1870. #if _AXIS_PLUG_UNUSED_TEST(Y)
  1871. #error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG."
  1872. #endif
  1873. #if _AXIS_PLUG_UNUSED_TEST(Z)
  1874. #error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
  1875. #endif
  1876. // Delta and Cartesian use 3 homing endstops
  1877. #if NONE(IS_SCARA, SPI_ENDSTOPS)
  1878. #if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
  1879. #error "Enable USE_XMIN_PLUG when homing X to MIN."
  1880. #elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
  1881. #error "Enable USE_XMAX_PLUG when homing X to MAX."
  1882. #elif Y_HOME_DIR < 0 && DISABLED(USE_YMIN_PLUG)
  1883. #error "Enable USE_YMIN_PLUG when homing Y to MIN."
  1884. #elif Y_HOME_DIR > 0 && DISABLED(USE_YMAX_PLUG)
  1885. #error "Enable USE_YMAX_PLUG when homing Y to MAX."
  1886. #endif
  1887. #endif
  1888. // Z homing direction and plug usage flags
  1889. #if Z_HOME_DIR < 0 && NONE(USE_ZMIN_PLUG, HOMING_Z_WITH_PROBE)
  1890. #error "Enable USE_ZMIN_PLUG when homing Z to MIN."
  1891. #elif Z_HOME_DIR > 0 && ENABLED(USE_PROBE_FOR_Z_HOMING)
  1892. #error "Z_HOME_DIR must be -1 when homing Z with the probe."
  1893. #elif BOTH(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS)
  1894. #error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING."
  1895. #elif Z_HOME_DIR > 0 && DISABLED(USE_ZMAX_PLUG)
  1896. #error "Enable USE_ZMAX_PLUG when homing Z to MAX."
  1897. #endif
  1898. #if BOTH(HOME_Z_FIRST, USE_PROBE_FOR_Z_HOMING)
  1899. #error "HOME_Z_FIRST can't be used when homing Z with a probe."
  1900. #endif
  1901. // Dual/multiple endstops requirements
  1902. #if ENABLED(X_DUAL_ENDSTOPS)
  1903. #if !X2_USE_ENDSTOP
  1904. #error "You must set X2_USE_ENDSTOP with X_DUAL_ENDSTOPS."
  1905. #elif X2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1906. #error "USE_XMIN_PLUG is required when X2_USE_ENDSTOP is _XMIN_."
  1907. #elif X2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1908. #error "USE_XMAX_PLUG is required when X2_USE_ENDSTOP is _XMAX_."
  1909. #elif X2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1910. #error "USE_YMIN_PLUG is required when X2_USE_ENDSTOP is _YMIN_."
  1911. #elif X2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1912. #error "USE_YMAX_PLUG is required when X2_USE_ENDSTOP is _YMAX_."
  1913. #elif X2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1914. #error "USE_ZMIN_PLUG is required when X2_USE_ENDSTOP is _ZMIN_."
  1915. #elif X2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1916. #error "USE_ZMAX_PLUG is required when X2_USE_ENDSTOP is _ZMAX_."
  1917. #elif !HAS_X2_MIN && !HAS_X2_MAX
  1918. #error "X2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1919. #elif ENABLED(DELTA)
  1920. #error "X_DUAL_ENDSTOPS is not compatible with DELTA."
  1921. #endif
  1922. #endif
  1923. #if ENABLED(Y_DUAL_ENDSTOPS)
  1924. #if !Y2_USE_ENDSTOP
  1925. #error "You must set Y2_USE_ENDSTOP with Y_DUAL_ENDSTOPS."
  1926. #elif Y2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1927. #error "USE_XMIN_PLUG is required when Y2_USE_ENDSTOP is _XMIN_."
  1928. #elif Y2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1929. #error "USE_XMAX_PLUG is required when Y2_USE_ENDSTOP is _XMAX_."
  1930. #elif Y2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1931. #error "USE_YMIN_PLUG is required when Y2_USE_ENDSTOP is _YMIN_."
  1932. #elif Y2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1933. #error "USE_YMAX_PLUG is required when Y2_USE_ENDSTOP is _YMAX_."
  1934. #elif Y2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1935. #error "USE_ZMIN_PLUG is required when Y2_USE_ENDSTOP is _ZMIN_."
  1936. #elif Y2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1937. #error "USE_ZMAX_PLUG is required when Y2_USE_ENDSTOP is _ZMAX_."
  1938. #elif !HAS_Y2_MIN && !HAS_Y2_MAX
  1939. #error "Y2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1940. #elif ENABLED(DELTA)
  1941. #error "Y_DUAL_ENDSTOPS is not compatible with DELTA."
  1942. #endif
  1943. #endif
  1944. #if ENABLED(Z_MULTI_ENDSTOPS)
  1945. #if !Z2_USE_ENDSTOP
  1946. #error "You must set Z2_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 2."
  1947. #elif Z2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1948. #error "USE_XMIN_PLUG is required when Z2_USE_ENDSTOP is _XMIN_."
  1949. #elif Z2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1950. #error "USE_XMAX_PLUG is required when Z2_USE_ENDSTOP is _XMAX_."
  1951. #elif Z2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1952. #error "USE_YMIN_PLUG is required when Z2_USE_ENDSTOP is _YMIN_."
  1953. #elif Z2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1954. #error "USE_YMAX_PLUG is required when Z2_USE_ENDSTOP is _YMAX_."
  1955. #elif Z2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1956. #error "USE_ZMIN_PLUG is required when Z2_USE_ENDSTOP is _ZMIN_."
  1957. #elif Z2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1958. #error "USE_ZMAX_PLUG is required when Z2_USE_ENDSTOP is _ZMAX_."
  1959. #elif !HAS_Z2_MIN && !HAS_Z2_MAX
  1960. #error "Z2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1961. #elif ENABLED(DELTA)
  1962. #error "Z_MULTI_ENDSTOPS is not compatible with DELTA."
  1963. #endif
  1964. #if NUM_Z_STEPPER_DRIVERS >= 3
  1965. #if !Z3_USE_ENDSTOP
  1966. #error "You must set Z3_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 3."
  1967. #elif Z3_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1968. #error "USE_XMIN_PLUG is required when Z3_USE_ENDSTOP is _XMIN_."
  1969. #elif Z3_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1970. #error "USE_XMAX_PLUG is required when Z3_USE_ENDSTOP is _XMAX_."
  1971. #elif Z3_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1972. #error "USE_YMIN_PLUG is required when Z3_USE_ENDSTOP is _YMIN_."
  1973. #elif Z3_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1974. #error "USE_YMAX_PLUG is required when Z3_USE_ENDSTOP is _YMAX_."
  1975. #elif Z3_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1976. #error "USE_ZMIN_PLUG is required when Z3_USE_ENDSTOP is _ZMIN_."
  1977. #elif Z3_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1978. #error "USE_ZMAX_PLUG is required when Z3_USE_ENDSTOP is _ZMAX_."
  1979. #elif !HAS_Z3_MIN && !HAS_Z3_MAX
  1980. #error "Z3_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  1981. #endif
  1982. #endif
  1983. #if NUM_Z_STEPPER_DRIVERS >= 4
  1984. #if !Z4_USE_ENDSTOP
  1985. #error "You must set Z4_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 4."
  1986. #elif Z4_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
  1987. #error "USE_XMIN_PLUG is required when Z4_USE_ENDSTOP is _XMIN_."
  1988. #elif Z4_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
  1989. #error "USE_XMAX_PLUG is required when Z4_USE_ENDSTOP is _XMAX_."
  1990. #elif Z4_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
  1991. #error "USE_YMIN_PLUG is required when Z4_USE_ENDSTOP is _YMIN_."
  1992. #elif Z4_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
  1993. #error "USE_YMAX_PLUG is required when Z4_USE_ENDSTOP is _YMAX_."
  1994. #elif Z4_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
  1995. #error "USE_ZMIN_PLUG is required when Z4_USE_ENDSTOP is _ZMIN_."
  1996. #elif Z4_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
  1997. #error "USE_ZMAX_PLUG is required when Z4_USE_ENDSTOP is _ZMAX_."
  1998. #elif !HAS_Z4_MIN && !HAS_Z4_MAX
  1999. #error "Z4_USE_ENDSTOP has been assigned to a nonexistent endstop!"
  2000. #endif
  2001. #endif
  2002. #endif
  2003. #if defined(ENDSTOP_NOISE_THRESHOLD) && !WITHIN(ENDSTOP_NOISE_THRESHOLD, 2, 7)
  2004. #error "ENDSTOP_NOISE_THRESHOLD must be an integer from 2 to 7."
  2005. #endif
  2006. /**
  2007. * emergency-command parser
  2008. */
  2009. #if ENABLED(EMERGENCY_PARSER) && defined(__AVR__) && defined(USBCON)
  2010. #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
  2011. #endif
  2012. /**
  2013. * I2C bus
  2014. */
  2015. #if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
  2016. #if I2C_SLAVE_ADDRESS < 8
  2017. #error "I2C_SLAVE_ADDRESS can't be less than 8. (Addresses 0 - 7 are reserved.)"
  2018. #elif I2C_SLAVE_ADDRESS > 127
  2019. #error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
  2020. #endif
  2021. #endif
  2022. /**
  2023. * G35 Assisted Tramming
  2024. */
  2025. #if ENABLED(ASSISTED_TRAMMING) && !HAS_BED_PROBE
  2026. #error "ASSISTED_TRAMMING requires a bed probe."
  2027. #endif
  2028. /**
  2029. * G38 Probe Target
  2030. */
  2031. #if ENABLED(G38_PROBE_TARGET)
  2032. #if !HAS_BED_PROBE
  2033. #error "G38_PROBE_TARGET requires a bed probe."
  2034. #elif !IS_CARTESIAN
  2035. #error "G38_PROBE_TARGET requires a Cartesian machine."
  2036. #endif
  2037. #endif
  2038. /**
  2039. * RGB_LED Requirements
  2040. */
  2041. #define _RGB_TEST (PINS_EXIST(RGB_LED_R, RGB_LED_G, RGB_LED_B))
  2042. #if ENABLED(PRINTER_EVENT_LEDS) && !HAS_COLOR_LEDS
  2043. #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9533, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED."
  2044. #elif ENABLED(RGB_LED)
  2045. #if !_RGB_TEST
  2046. #error "RGB_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, and RGB_LED_B_PIN."
  2047. #elif ENABLED(RGBW_LED)
  2048. #error "Please enable only one of RGB_LED and RGBW_LED."
  2049. #endif
  2050. #elif ENABLED(RGBW_LED)
  2051. #if !(_RGB_TEST && PIN_EXISTS(RGB_LED_W))
  2052. #error "RGBW_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, RGB_LED_B_PIN, and RGB_LED_W_PIN."
  2053. #endif
  2054. #endif
  2055. #undef _RGB_TEST
  2056. // NeoPixel requirements
  2057. #if ENABLED(NEOPIXEL_LED)
  2058. #if !PIN_EXISTS(NEOPIXEL) || NEOPIXEL_PIXELS == 0
  2059. #error "NEOPIXEL_LED requires NEOPIXEL_PIN and NEOPIXEL_PIXELS."
  2060. #elif ENABLED(NEOPIXEL2_SEPARATE) && !(defined(NEOPIXEL2_TYPE) && PIN_EXISTS(NEOPIXEL2) && NEOPIXEL2_PIXELS > 0)
  2061. #error "NEOPIXEL2_SEPARATE requires NEOPIXEL2_TYPE, NEOPIXEL2_PIN and NEOPIXEL2_PIXELS."
  2062. #elif ENABLED(NEO2_COLOR_PRESETS) && DISABLED(NEOPIXEL2_SEPARATE)
  2063. #error "NEO2_COLOR_PRESETS requires NEOPIXEL2_SEPARATE to be enabled."
  2064. #endif
  2065. #endif
  2066. #if DISABLED(NO_COMPILE_TIME_PWM)
  2067. #define _TEST_PWM(P) PWM_PIN(P)
  2068. #else
  2069. #define _TEST_PWM(P) 1 // pass
  2070. #endif
  2071. /**
  2072. * Auto Fan check for PWM pins
  2073. */
  2074. #if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255
  2075. #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255."
  2076. #if HAS_AUTO_FAN_0
  2077. static_assert(_TEST_PWM(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF);
  2078. #elif HAS_AUTO_FAN_1
  2079. static_assert(_TEST_PWM(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF);
  2080. #elif HAS_AUTO_FAN_2
  2081. static_assert(_TEST_PWM(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF);
  2082. #elif HAS_AUTO_FAN_3
  2083. static_assert(_TEST_PWM(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF);
  2084. #elif HAS_AUTO_FAN_4
  2085. static_assert(_TEST_PWM(E4_AUTO_FAN_PIN), "E4" AF_ERR_SUFF);
  2086. #elif HAS_AUTO_FAN_5
  2087. static_assert(_TEST_PWM(E5_AUTO_FAN_PIN), "E5" AF_ERR_SUFF);
  2088. #elif HAS_AUTO_FAN_6
  2089. static_assert(_TEST_PWM(E6_AUTO_FAN_PIN), "E6" AF_ERR_SUFF);
  2090. #elif HAS_AUTO_FAN_7
  2091. static_assert(_TEST_PWM(E7_AUTO_FAN_PIN), "E7" AF_ERR_SUFF);
  2092. #endif
  2093. #endif
  2094. /**
  2095. * Make sure only one EEPROM type is enabled
  2096. */
  2097. #if ENABLED(EEPROM_SETTINGS)
  2098. #if 1 < 0 \
  2099. + ENABLED(I2C_EEPROM) \
  2100. + ENABLED(SPI_EEPROM) \
  2101. + ENABLED(QSPI_EEPROM) \
  2102. + ENABLED(SDCARD_EEPROM_EMULATION) \
  2103. + ENABLED(FLASH_EEPROM_EMULATION) \
  2104. + ENABLED(SRAM_EEPROM_EMULATION) \
  2105. + ENABLED(IIC_BL24CXX_EEPROM)
  2106. #error "Please select only one method of EEPROM Persistent Storage."
  2107. #endif
  2108. #endif
  2109. /**
  2110. * Make sure features that need to write to the SD card can
  2111. */
  2112. #if ENABLED(SDCARD_READONLY) && ANY(POWER_LOSS_RECOVERY, BINARY_FILE_TRANSFER, SDCARD_EEPROM_EMULATION)
  2113. #undef SDCARD_READONLY
  2114. #if ENABLED(POWER_LOSS_RECOVERY)
  2115. #warning "Either disable SDCARD_READONLY or disable POWER_LOSS_RECOVERY."
  2116. #elif ENABLED(BINARY_FILE_TRANSFER)
  2117. #warning "Either disable SDCARD_READONLY or disable BINARY_FILE_TRANSFER."
  2118. #elif ENABLED(SDCARD_EEPROM_EMULATION)
  2119. #warning "Either disable SDCARD_READONLY or disable SDCARD_EEPROM_EMULATION."
  2120. #endif
  2121. #endif
  2122. #if ENABLED(SD_IGNORE_AT_STARTUP)
  2123. #if ENABLED(POWER_LOSS_RECOVERY)
  2124. #error "SD_IGNORE_AT_STARTUP is incompatible with POWER_LOSS_RECOVERY."
  2125. #elif ENABLED(SDCARD_EEPROM_EMULATION)
  2126. #error "SD_IGNORE_AT_STARTUP is incompatible with SDCARD_EEPROM_EMULATION."
  2127. #endif
  2128. #endif
  2129. /**
  2130. * Make sure only one display is enabled
  2131. */
  2132. #if 1 < 0 \
  2133. + ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
  2134. + ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) \
  2135. + ENABLED(ULTIPANEL) \
  2136. + ENABLED(ULTRA_LCD) \
  2137. + (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \
  2138. + (ENABLED(MINIPANEL) && NONE(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \
  2139. + (ENABLED(MKS_MINI_12864) && DISABLED(MKS_LCD12864)) \
  2140. + (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \
  2141. + (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \
  2142. + (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \
  2143. + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
  2144. + COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY) \
  2145. + COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY, DWIN_CREALITY_LCD) \
  2146. + 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) \
  2147. + COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
  2148. + COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
  2149. + 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, ANET_ET4_TFT28, ANET_ET5_TFT35) \
  2150. + COUNT_ENABLED(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) \
  2151. + COUNT_ENABLED(VIKI2, miniVIKI) \
  2152. + COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \
  2153. + COUNT_ENABLED(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING) \
  2154. + ENABLED(AZSMZ_12864) \
  2155. + ENABLED(BQ_LCD_SMART_CONTROLLER) \
  2156. + ENABLED(CARTESIO_UI) \
  2157. + ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
  2158. + ENABLED(FF_INTERFACEBOARD) \
  2159. + ENABLED(FYSETC_242_OLED_12864) \
  2160. + ENABLED(G3D_PANEL) \
  2161. + ENABLED(LCD_FOR_MELZI) \
  2162. + ENABLED(LCD_I2C_PANELOLU2) \
  2163. + ENABLED(LCD_I2C_VIKI) \
  2164. + ENABLED(LCM1602) \
  2165. + ENABLED(LONGER_LK_TFT28) \
  2166. + ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) \
  2167. + ENABLED(MAKRPANEL) \
  2168. + ENABLED(MALYAN_LCD) \
  2169. + ENABLED(MKS_LCD12864) \
  2170. + ENABLED(OLED_PANEL_TINYBOY2) \
  2171. + ENABLED(OVERLORD_OLED) \
  2172. + ENABLED(PANEL_ONE) \
  2173. + ENABLED(RA_CONTROL_PANEL) \
  2174. + ENABLED(RADDS_DISPLAY) \
  2175. + ENABLED(REPRAPWORLD_GRAPHICAL_LCD) \
  2176. + ENABLED(RIGIDBOT_PANEL) \
  2177. + ENABLED(SAV_3DGLCD) \
  2178. + ENABLED(SAV_3DLCD) \
  2179. + ENABLED(SILVER_GATE_GLCD_CONTROLLER) \
  2180. + ENABLED(TFT_TRONXY_X5SA) \
  2181. + ENABLED(TOUCH_UI_FTDI_EVE) \
  2182. + ENABLED(U8GLIB_SH1106_EINSTART) \
  2183. + ENABLED(ULTI_CONTROLLER) \
  2184. + ENABLED(ULTIMAKERCONTROLLER) \
  2185. + ENABLED(ZONESTAR_LCD)
  2186. #error "Please select only one LCD controller option."
  2187. #endif
  2188. #undef IS_U8GLIB_SSD1306
  2189. #undef IS_EXTUI
  2190. #undef IS_LEGACY_TFT
  2191. #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, ANET_ET4_TFT28, ANET_ET5_TFT35)
  2192. #if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
  2193. #error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one."
  2194. #elif 1 < ENABLED(TFT_COLOR_UI) + ENABLED(TFT_CLASSIC_UI) + ENABLED(TFT_LVGL_UI)
  2195. #error "Please select only one of TFT_COLOR_UI, TFT_CLASSIC_UI, or TFT_LVGL_UI."
  2196. #endif
  2197. #elif ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
  2198. #error "TFT_(COLOR|CLASSIC|LVGL)_UI requires a TFT display to be enabled."
  2199. #endif
  2200. #if ENABLED(TFT_GENERIC) && NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
  2201. #error "TFT_GENERIC requires either TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI interface."
  2202. #endif
  2203. #if BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
  2204. #error "Please enable only one of TFT_INTERFACE_SPI or TFT_INTERFACE_SPI."
  2205. #endif
  2206. #if MANY(LCD_SCREEN_ROT_0, LCD_SCREEN_ROT_90, LCD_SCREEN_ROT_180, LCD_SCREEN_ROT_270)
  2207. #error "Please enable only one LCD_SCREEN_ROT_* option: 0, 90, 180, or 270."
  2208. #endif
  2209. #if MANY(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
  2210. #error "Please select only one of TFT_RES_480x320, TFT_RES_480x320, or TFT_RES_480x272."
  2211. #endif
  2212. #if HAS_TFT_LVGL_UI && DISABLED(TFT_RES_480x320)
  2213. #error "(FMSC|SPI)TFT_LVGL_UI requires TFT_RES_480x320."
  2214. #endif
  2215. #if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 3)
  2216. #error "GRAPHICAL_TFT_UPSCALE must be set to 2 or 3."
  2217. #endif
  2218. /**
  2219. * Some boards forbid the use of -1 Native USB
  2220. */
  2221. #if ENABLED(BOARD_NO_NATIVE_USB)
  2222. #undef BOARD_NO_NATIVE_USB
  2223. #if SERIAL_PORT == -1
  2224. #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."
  2225. #elif SERIAL_PORT_2 == -1
  2226. #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."
  2227. #elif LCD_SERIAL_PORT == -1
  2228. #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."
  2229. #endif
  2230. #endif
  2231. /**
  2232. * Serial displays require a dedicated serial port
  2233. */
  2234. #ifdef LCD_SERIAL_PORT
  2235. #if LCD_SERIAL_PORT == SERIAL_PORT
  2236. #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT."
  2237. #elif defined(SERIAL_PORT_2) && LCD_SERIAL_PORT == SERIAL_PORT_2
  2238. #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2."
  2239. #endif
  2240. #else
  2241. #if HAS_DGUS_LCD
  2242. #error "The DGUS LCD requires LCD_SERIAL_PORT to be defined."
  2243. #elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
  2244. #error "The ANYCUBIC LCD requires LCD_SERIAL_PORT to be defined."
  2245. #elif ENABLED(MALYAN_LCD)
  2246. #error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined."
  2247. #endif
  2248. #endif
  2249. /**
  2250. * FYSETC Mini 12864 RGB backlighting required
  2251. */
  2252. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED)
  2253. #error "RGB_LED is required for FYSETC_MINI_12864 1.2 and 2.0."
  2254. #elif EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && DISABLED(LED_USER_PRESET_STARTUP)
  2255. #error "LED_USER_PRESET_STARTUP is required for FYSETC_MINI_12864 2.x displays."
  2256. #endif
  2257. /**
  2258. * Check existing CS pins against enabled TMC SPI drivers.
  2259. */
  2260. #define INVALID_TMC_SPI(ST) (AXIS_HAS_SPI(ST) && !PIN_EXISTS(ST##_CS))
  2261. #if INVALID_TMC_SPI(X)
  2262. #error "An SPI driven TMC driver on X requires X_CS_PIN."
  2263. #elif INVALID_TMC_SPI(X2)
  2264. #error "An SPI driven TMC driver on X2 requires X2_CS_PIN."
  2265. #elif INVALID_TMC_SPI(Y)
  2266. #error "An SPI driven TMC driver on Y requires Y_CS_PIN."
  2267. #elif INVALID_TMC_SPI(Y2)
  2268. #error "An SPI driven TMC driver on Y2 requires Y2_CS_PIN."
  2269. #elif INVALID_TMC_SPI(Z)
  2270. #error "An SPI driven TMC driver on Z requires Z_CS_PIN."
  2271. #elif INVALID_TMC_SPI(Z2)
  2272. #error "An SPI driven TMC driver on Z2 requires Z2_CS_PIN."
  2273. #elif INVALID_TMC_SPI(Z3)
  2274. #error "An SPI driven TMC driver on Z3 requires Z3_CS_PIN."
  2275. #elif INVALID_TMC_SPI(Z4)
  2276. #error "An SPI driven TMC driver on Z4 requires Z4_CS_PIN."
  2277. #elif INVALID_TMC_SPI(E0)
  2278. #error "An SPI driven TMC driver on E0 requires E0_CS_PIN."
  2279. #elif INVALID_TMC_SPI(E1)
  2280. #error "An SPI driven TMC driver on E1 requires E1_CS_PIN."
  2281. #elif INVALID_TMC_SPI(E2)
  2282. #error "An SPI driven TMC driver on E2 requires E2_CS_PIN."
  2283. #elif INVALID_TMC_SPI(E3)
  2284. #error "An SPI driven TMC driver on E3 requires E3_CS_PIN."
  2285. #elif INVALID_TMC_SPI(E4)
  2286. #error "An SPI driven TMC driver on E4 requires E4_CS_PIN."
  2287. #elif INVALID_TMC_SPI(E5)
  2288. #error "An SPI driven TMC driver on E5 requires E5_CS_PIN."
  2289. #elif INVALID_TMC_SPI(E6)
  2290. #error "An SPI driven TMC driver on E6 requires E6_CS_PIN."
  2291. #elif INVALID_TMC_SPI(E7)
  2292. #error "An SPI driven TMC driver on E7 requires E7_CS_PIN."
  2293. #endif
  2294. #undef INVALID_TMC_SPI
  2295. /**
  2296. * Check existing RX/TX pins against enable TMC UART drivers.
  2297. */
  2298. #define INVALID_TMC_UART(ST) (AXIS_HAS_UART(ST) && !(defined(ST##_HARDWARE_SERIAL) || (PINS_EXIST(ST##_SERIAL_RX, ST##_SERIAL_TX))))
  2299. #if INVALID_TMC_UART(X)
  2300. #error "TMC2208 or TMC2209 on X requires X_HARDWARE_SERIAL or X_SERIAL_(RX|TX)_PIN."
  2301. #elif INVALID_TMC_UART(X2)
  2302. #error "TMC2208 or TMC2209 on X2 requires X2_HARDWARE_SERIAL or X2_SERIAL_(RX|TX)_PIN."
  2303. #elif INVALID_TMC_UART(Y)
  2304. #error "TMC2208 or TMC2209 on Y requires Y_HARDWARE_SERIAL or Y_SERIAL_(RX|TX)_PIN."
  2305. #elif INVALID_TMC_UART(Y2)
  2306. #error "TMC2208 or TMC2209 on Y2 requires Y2_HARDWARE_SERIAL or Y2_SERIAL_(RX|TX)_PIN."
  2307. #elif INVALID_TMC_UART(Z)
  2308. #error "TMC2208 or TMC2209 on Z requires Z_HARDWARE_SERIAL or Z_SERIAL_(RX|TX)_PIN."
  2309. #elif INVALID_TMC_UART(Z2)
  2310. #error "TMC2208 or TMC2209 on Z2 requires Z2_HARDWARE_SERIAL or Z2_SERIAL_(RX|TX)_PIN."
  2311. #elif INVALID_TMC_UART(Z3)
  2312. #error "TMC2208 or TMC2209 on Z3 requires Z3_HARDWARE_SERIAL or Z3_SERIAL_(RX|TX)_PIN."
  2313. #elif INVALID_TMC_UART(Z4)
  2314. #error "TMC2208 or TMC2209 on Z4 requires Z4_HARDWARE_SERIAL or Z4_SERIAL_(RX|TX)_PIN."
  2315. #elif INVALID_TMC_UART(E0)
  2316. #error "TMC2208 or TMC2209 on E0 requires E0_HARDWARE_SERIAL or E0_SERIAL_(RX|TX)_PIN."
  2317. #elif INVALID_TMC_UART(E1)
  2318. #error "TMC2208 or TMC2209 on E1 requires E1_HARDWARE_SERIAL or E1_SERIAL_(RX|TX)_PIN."
  2319. #elif INVALID_TMC_UART(E2)
  2320. #error "TMC2208 or TMC2209 on E2 requires E2_HARDWARE_SERIAL or E2_SERIAL_(RX|TX)_PIN."
  2321. #elif INVALID_TMC_UART(E3)
  2322. #error "TMC2208 or TMC2209 on E3 requires E3_HARDWARE_SERIAL or E3_SERIAL_(RX|TX)_PIN."
  2323. #elif INVALID_TMC_UART(E4)
  2324. #error "TMC2208 or TMC2209 on E4 requires E4_HARDWARE_SERIAL or E4_SERIAL_(RX|TX)_PIN."
  2325. #elif INVALID_TMC_UART(E5)
  2326. #error "TMC2208 or TMC2209 on E5 requires E5_HARDWARE_SERIAL or E5_SERIAL_(RX|TX)_PIN."
  2327. #elif INVALID_TMC_UART(E6)
  2328. #error "TMC2208 or TMC2209 on E6 requires E6_HARDWARE_SERIAL or E6_SERIAL_(RX|TX)_PIN."
  2329. #elif INVALID_TMC_UART(E7)
  2330. #error "TMC2208 or TMC2209 on E7 requires E7_HARDWARE_SERIAL or E7_SERIAL_(RX|TX)_PIN."
  2331. #endif
  2332. #undef INVALID_TMC_UART
  2333. /**
  2334. * TMC2209 slave address values
  2335. */
  2336. #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")
  2337. #if AXIS_DRIVER_TYPE_X(TMC2209)
  2338. INVALID_TMC_ADDRESS(X);
  2339. #elif AXIS_DRIVER_TYPE_X2(TMC2209)
  2340. INVALID_TMC_ADDRESS(X2);
  2341. #elif AXIS_DRIVER_TYPE_Y(TMC2209)
  2342. INVALID_TMC_ADDRESS(Y);
  2343. #elif AXIS_DRIVER_TYPE_Y2(TMC2209)
  2344. INVALID_TMC_ADDRESS(Y2);
  2345. #elif AXIS_DRIVER_TYPE_Z(TMC2209)
  2346. INVALID_TMC_ADDRESS(Z);
  2347. #elif AXIS_DRIVER_TYPE_Z2(TMC2209)
  2348. INVALID_TMC_ADDRESS(Z2);
  2349. #elif AXIS_DRIVER_TYPE_Z3(TMC2209)
  2350. INVALID_TMC_ADDRESS(Z3);
  2351. #elif AXIS_DRIVER_TYPE_Z4(TMC2209)
  2352. INVALID_TMC_ADDRESS(Z4);
  2353. #elif AXIS_DRIVER_TYPE_E0(TMC2209)
  2354. INVALID_TMC_ADDRESS(E0);
  2355. #elif AXIS_DRIVER_TYPE_E1(TMC2209)
  2356. INVALID_TMC_ADDRESS(E1);
  2357. #elif AXIS_DRIVER_TYPE_E2(TMC2209)
  2358. INVALID_TMC_ADDRESS(E2);
  2359. #elif AXIS_DRIVER_TYPE_E3(TMC2209)
  2360. INVALID_TMC_ADDRESS(E3);
  2361. #elif AXIS_DRIVER_TYPE_E4(TMC2209)
  2362. INVALID_TMC_ADDRESS(E4);
  2363. #elif AXIS_DRIVER_TYPE_E5(TMC2209)
  2364. INVALID_TMC_ADDRESS(E5);
  2365. #elif AXIS_DRIVER_TYPE_E6(TMC2209)
  2366. INVALID_TMC_ADDRESS(E6);
  2367. #elif AXIS_DRIVER_TYPE_E7(TMC2209)
  2368. INVALID_TMC_ADDRESS(E7);
  2369. #endif
  2370. #undef INVALID_TMC_ADDRESS
  2371. #define _TMC_MICROSTEP_IS_VALID(MS) (MS == 0 || MS == 2 || MS == 4 || MS == 8 || MS == 16 || MS == 32 || MS == 64 || MS == 128 || MS == 256)
  2372. #define TMC_MICROSTEP_IS_VALID(M) (!AXIS_IS_TMC(M) || _TMC_MICROSTEP_IS_VALID(M##_MICROSTEPS))
  2373. #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.")
  2374. #if !TMC_MICROSTEP_IS_VALID(X)
  2375. INVALID_TMC_MS(X);
  2376. #elif !TMC_MICROSTEP_IS_VALID(Y)
  2377. INVALID_TMC_MS(Y)
  2378. #elif !TMC_MICROSTEP_IS_VALID(Z)
  2379. INVALID_TMC_MS(Z)
  2380. #elif !TMC_MICROSTEP_IS_VALID(X2)
  2381. INVALID_TMC_MS(X2);
  2382. #elif !TMC_MICROSTEP_IS_VALID(Y2)
  2383. INVALID_TMC_MS(Y2)
  2384. #elif !TMC_MICROSTEP_IS_VALID(Z2)
  2385. INVALID_TMC_MS(Z2)
  2386. #elif !TMC_MICROSTEP_IS_VALID(Z3)
  2387. INVALID_TMC_MS(Z3)
  2388. #elif !TMC_MICROSTEP_IS_VALID(Z4)
  2389. INVALID_TMC_MS(Z4)
  2390. #elif !TMC_MICROSTEP_IS_VALID(E0)
  2391. INVALID_TMC_MS(E0)
  2392. #elif !TMC_MICROSTEP_IS_VALID(E1)
  2393. INVALID_TMC_MS(E1)
  2394. #elif !TMC_MICROSTEP_IS_VALID(E2)
  2395. INVALID_TMC_MS(E2)
  2396. #elif !TMC_MICROSTEP_IS_VALID(E3)
  2397. INVALID_TMC_MS(E3)
  2398. #elif !TMC_MICROSTEP_IS_VALID(E4)
  2399. INVALID_TMC_MS(E4)
  2400. #elif !TMC_MICROSTEP_IS_VALID(E5)
  2401. INVALID_TMC_MS(E5)
  2402. #elif !TMC_MICROSTEP_IS_VALID(E6)
  2403. INVALID_TMC_MS(E6)
  2404. #elif !TMC_MICROSTEP_IS_VALID(E7)
  2405. INVALID_TMC_MS(E7)
  2406. #endif
  2407. #undef INVALID_TMC_MS
  2408. #undef TMC_MICROSTEP_IS_VALID
  2409. #undef _TMC_MICROSTEP_IS_VALID
  2410. #if ENABLED(DELTA) && (ENABLED(STEALTHCHOP_XY) != ENABLED(STEALTHCHOP_Z))
  2411. #error "STEALTHCHOP_XY and STEALTHCHOP_Z must be the same on DELTA."
  2412. #endif
  2413. #if ENABLED(SENSORLESS_HOMING)
  2414. // Require STEALTHCHOP for SENSORLESS_HOMING on DELTA as the transition from spreadCycle to stealthChop
  2415. // is necessary in order to reset the stallGuard indication between the initial movement of all three
  2416. // towers to +Z and the individual homing of each tower. This restriction can be removed once a means of
  2417. // clearing the stallGuard activated status is found.
  2418. // Stall detection DIAG = HIGH : TMC2209
  2419. // Stall detection DIAG = LOW : TMC2130/TMC2160/TMC2660/TMC5130/TMC5160
  2420. #define X_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(X,TMC2209)
  2421. #define Y_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Y,TMC2209)
  2422. #define Z_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Z,TMC2209)
  2423. #if NONE(SPI_ENDSTOPS, ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS)
  2424. #if X_SENSORLESS && X_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_XMIN)
  2425. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMIN (or ENDSTOPPULLUPS) when homing to X_MIN."
  2426. #elif X_SENSORLESS && X_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_XMAX)
  2427. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMAX (or ENDSTOPPULLUPS) when homing to X_MAX."
  2428. #elif Y_SENSORLESS && Y_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_YMIN)
  2429. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMIN (or ENDSTOPPULLUPS) when homing to Y_MIN."
  2430. #elif Y_SENSORLESS && Y_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_YMAX)
  2431. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMAX (or ENDSTOPPULLUPS) when homing to Y_MAX."
  2432. #elif Z_SENSORLESS && Z_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_ZMIN)
  2433. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) when homing to Z_MIN."
  2434. #elif Z_SENSORLESS && Z_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_ZMAX)
  2435. #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) when homing to Z_MAX."
  2436. #endif
  2437. #endif
  2438. #if ENABLED(SPI_ENDSTOPS)
  2439. #if ENABLED(QUICK_HOME)
  2440. #warning "SPI_ENDSTOPS may be unreliable with QUICK_HOME. Adjust back-offs for better results."
  2441. #endif
  2442. #else
  2443. #if X_SENSORLESS && X_HOME_DIR < 0 && X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
  2444. #if X_ENDSTOP_INVERTING
  2445. #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = true when homing to X_MIN."
  2446. #else
  2447. #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to X_MIN."
  2448. #endif
  2449. #elif X_SENSORLESS && X_HOME_DIR > 0 && X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
  2450. #if X_ENDSTOP_INVERTING
  2451. #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = true when homing to X_MAX."
  2452. #else
  2453. #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to X_MAX."
  2454. #endif
  2455. #elif Y_SENSORLESS && Y_HOME_DIR < 0 && Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
  2456. #if Y_ENDSTOP_INVERTING
  2457. #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = true when homing to Y_MIN."
  2458. #else
  2459. #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MIN."
  2460. #endif
  2461. #elif Y_SENSORLESS && Y_HOME_DIR > 0 && Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
  2462. #if Y_ENDSTOP_INVERTING
  2463. #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = true when homing to Y_MAX."
  2464. #else
  2465. #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MAX."
  2466. #endif
  2467. #elif Z_SENSORLESS && Z_HOME_DIR < 0 && Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
  2468. #if Z_ENDSTOP_INVERTING
  2469. #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = true when homing to Z_MIN."
  2470. #else
  2471. #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Z_MIN."
  2472. #endif
  2473. #elif Z_SENSORLESS && Z_HOME_DIR > 0 && Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
  2474. #if Z_ENDSTOP_INVERTING
  2475. #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING = true when homing to Z_MAX."
  2476. #else
  2477. #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to Z_MAX."
  2478. #endif
  2479. #endif
  2480. #endif
  2481. #if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z)
  2482. #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z."
  2483. #elif ENDSTOP_NOISE_THRESHOLD
  2484. #error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD."
  2485. #elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS)
  2486. #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes."
  2487. #endif
  2488. #undef X_ENDSTOP_INVERTING
  2489. #undef Y_ENDSTOP_INVERTING
  2490. #undef Z_ENDSTOP_INVERTING
  2491. #endif
  2492. // Sensorless probing requirements
  2493. #if ENABLED(SENSORLESS_PROBING)
  2494. #if ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS)
  2495. #error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes."
  2496. #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  2497. #error "SENSORLESS_PROBING cannot be used with Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN."
  2498. #elif ENABLED(USE_PROBE_FOR_Z_HOMING)
  2499. #error "SENSORLESS_PROBING cannot be used with USE_PROBE_FOR_Z_HOMING."
  2500. #elif !Z_SENSORLESS
  2501. #error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z."
  2502. #endif
  2503. #endif
  2504. // Sensorless homing is required for both combined steppers in an H-bot
  2505. #if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
  2506. #error "CoreXY requires both X and Y to use sensorless homing if either one does."
  2507. #elif CORE_IS_XZ && X_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE
  2508. #error "CoreXZ requires both X and Z to use sensorless homing if either one does."
  2509. #elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE
  2510. #error "CoreYZ requires both Y and Z to use sensorless homing if either one does."
  2511. #elif ENABLED(MARKFORGED_XY) && X_SENSORLESS != Y_SENSORLESS
  2512. #error "MARKFORGED_XY requires both X and Y to use sensorless homing if either one does."
  2513. #endif
  2514. // Other TMC feature requirements
  2515. #if ENABLED(HYBRID_THRESHOLD) && !STEALTHCHOP_ENABLED
  2516. #error "Enable STEALTHCHOP_(XY|Z|E) to use HYBRID_THRESHOLD."
  2517. #elif ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
  2518. #error "SENSORLESS_HOMING requires TMC2130, TMC2160, TMC2209, TMC2660, or TMC5160 stepper drivers."
  2519. #elif ENABLED(SENSORLESS_PROBING) && !HAS_STALLGUARD
  2520. #error "SENSORLESS_PROBING requires TMC2130, TMC2160, TMC2209, TMC2660, or TMC5160 stepper drivers."
  2521. #elif STEALTHCHOP_ENABLED && !HAS_STEALTHCHOP
  2522. #error "STEALTHCHOP requires TMC2130, TMC2160, TMC2208, TMC2209, or TMC5160 stepper drivers."
  2523. #endif
  2524. /**
  2525. * TMC SPI Chaining
  2526. */
  2527. #define IN_CHAIN(A) ((A##_CHAIN_POS > 0) && !HAS_L64XX)
  2528. #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) \
  2529. || IN_CHAIN(E0) || IN_CHAIN(E1) || IN_CHAIN(E2) || IN_CHAIN(E3) || IN_CHAIN(E4) || IN_CHAIN(E5) || IN_CHAIN(E6) || IN_CHAIN(E7)
  2530. #define BAD_CHAIN(A) (IN_CHAIN(A) && !PIN_EXISTS(A##_CS))
  2531. #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) \
  2532. || BAD_CHAIN(E0) || BAD_CHAIN(E1) || BAD_CHAIN(E2) || BAD_CHAIN(E3) || BAD_CHAIN(E4) || BAD_CHAIN(E5) || BAD_CHAIN(E6) || BAD_CHAIN(E7)
  2533. #error "All chained TMC drivers need a CS pin."
  2534. #else
  2535. #if IN_CHAIN(X)
  2536. #define CS_COMPARE X_CS_PIN
  2537. #elif IN_CHAIN(Y)
  2538. #define CS_COMPARE Y_CS_PIN
  2539. #elif IN_CHAIN(Z)
  2540. #define CS_COMPARE Z_CS_PIN
  2541. #elif IN_CHAIN(X2)
  2542. #define CS_COMPARE X2_CS_PIN
  2543. #elif IN_CHAIN(Y2)
  2544. #define CS_COMPARE Y2_CS_PIN
  2545. #elif IN_CHAIN(Z2)
  2546. #define CS_COMPARE Z2_CS_PIN
  2547. #elif IN_CHAIN(Z3)
  2548. #define CS_COMPARE Z3_CS_PIN
  2549. #elif IN_CHAIN(E0)
  2550. #define CS_COMPARE E0_CS_PIN
  2551. #elif IN_CHAIN(E1)
  2552. #define CS_COMPARE E1_CS_PIN
  2553. #elif IN_CHAIN(E2)
  2554. #define CS_COMPARE E2_CS_PIN
  2555. #elif IN_CHAIN(E3)
  2556. #define CS_COMPARE E3_CS_PIN
  2557. #elif IN_CHAIN(E4)
  2558. #define CS_COMPARE E4_CS_PIN
  2559. #elif IN_CHAIN(E5)
  2560. #define CS_COMPARE E5_CS_PIN
  2561. #elif IN_CHAIN(E6)
  2562. #define CS_COMPARE E6_CS_PIN
  2563. #elif IN_CHAIN(E7)
  2564. #define CS_COMPARE E7_CS_PIN
  2565. #endif
  2566. #define BAD_CS_PIN(A) (IN_CHAIN(A) && A##_CS_PIN != CS_COMPARE)
  2567. #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) \
  2568. || 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)
  2569. #error "All chained TMC drivers must use the same CS pin."
  2570. #endif
  2571. #undef BAD_CS_PIN
  2572. #undef CS_COMPARE
  2573. #endif
  2574. #undef BAD_CHAIN
  2575. #endif
  2576. #undef IN_CHAIN
  2577. /**
  2578. * Digipot requirement
  2579. */
  2580. #if HAS_MOTOR_CURRENT_I2C
  2581. #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
  2582. #error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451."
  2583. #elif !MB(MKS_SBASE) \
  2584. && (!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))
  2585. #error "DIGIPOT_MCP4018/4451 requires DIGIPOTS_I2C_SDA_* pins to be defined."
  2586. #endif
  2587. #endif
  2588. /**
  2589. * Check per-axis initializers for errors
  2590. */
  2591. constexpr float sanity_arr_1[] = DEFAULT_AXIS_STEPS_PER_UNIT,
  2592. sanity_arr_2[] = DEFAULT_MAX_FEEDRATE,
  2593. sanity_arr_3[] = DEFAULT_MAX_ACCELERATION;
  2594. #define _ARR_TEST(N,I) (sanity_arr_##N[_MIN(I,int(COUNT(sanity_arr_##N))-1)] > 0)
  2595. static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires X, Y, Z and E elements.");
  2596. 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?)");
  2597. static_assert( _ARR_TEST(1,0) && _ARR_TEST(1,1) && _ARR_TEST(1,2)
  2598. && _ARR_TEST(1,3) && _ARR_TEST(1,4) && _ARR_TEST(1,5)
  2599. && _ARR_TEST(1,6) && _ARR_TEST(1,7) && _ARR_TEST(1,8),
  2600. "DEFAULT_AXIS_STEPS_PER_UNIT values must be positive.");
  2601. static_assert(COUNT(sanity_arr_2) >= XYZE, "DEFAULT_MAX_FEEDRATE requires X, Y, Z and E elements.");
  2602. static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)");
  2603. static_assert( _ARR_TEST(2,0) && _ARR_TEST(2,1) && _ARR_TEST(2,2)
  2604. && _ARR_TEST(2,3) && _ARR_TEST(2,4) && _ARR_TEST(2,5)
  2605. && _ARR_TEST(2,6) && _ARR_TEST(2,7) && _ARR_TEST(2,8),
  2606. "DEFAULT_MAX_FEEDRATE values must be positive.");
  2607. static_assert(COUNT(sanity_arr_3) >= XYZE, "DEFAULT_MAX_ACCELERATION requires X, Y, Z and E elements.");
  2608. static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)");
  2609. static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
  2610. && _ARR_TEST(3,3) && _ARR_TEST(3,4) && _ARR_TEST(3,5)
  2611. && _ARR_TEST(3,6) && _ARR_TEST(3,7) && _ARR_TEST(3,8),
  2612. "DEFAULT_MAX_ACCELERATION values must be positive.");
  2613. #if ENABLED(LIMITED_MAX_ACCEL_EDITING)
  2614. #ifdef MAX_ACCEL_EDIT_VALUES
  2615. constexpr float sanity_arr_4[] = MAX_ACCEL_EDIT_VALUES;
  2616. static_assert(COUNT(sanity_arr_4) >= XYZE, "MAX_ACCEL_EDIT_VALUES requires X, Y, Z and E elements.");
  2617. static_assert(COUNT(sanity_arr_4) <= XYZE, "MAX_ACCEL_EDIT_VALUES has too many elements. X, Y, Z and E elements only.");
  2618. static_assert( _ARR_TEST(4,0) && _ARR_TEST(4,1) && _ARR_TEST(4,2)
  2619. && _ARR_TEST(4,3) && _ARR_TEST(4,4) && _ARR_TEST(4,5)
  2620. && _ARR_TEST(4,6) && _ARR_TEST(4,7) && _ARR_TEST(4,8),
  2621. "MAX_ACCEL_EDIT_VALUES values must be positive.");
  2622. #endif
  2623. #endif
  2624. #if ENABLED(LIMITED_MAX_FR_EDITING)
  2625. #ifdef MAX_FEEDRATE_EDIT_VALUES
  2626. constexpr float sanity_arr_5[] = MAX_FEEDRATE_EDIT_VALUES;
  2627. static_assert(COUNT(sanity_arr_5) >= XYZE, "MAX_FEEDRATE_EDIT_VALUES requires X, Y, Z and E elements.");
  2628. static_assert(COUNT(sanity_arr_5) <= XYZE, "MAX_FEEDRATE_EDIT_VALUES has too many elements. X, Y, Z and E elements only.");
  2629. static_assert( _ARR_TEST(5,0) && _ARR_TEST(5,1) && _ARR_TEST(5,2)
  2630. && _ARR_TEST(5,3) && _ARR_TEST(5,4) && _ARR_TEST(5,5)
  2631. && _ARR_TEST(5,6) && _ARR_TEST(5,7) && _ARR_TEST(5,8),
  2632. "MAX_FEEDRATE_EDIT_VALUES values must be positive.");
  2633. #endif
  2634. #endif
  2635. #if ENABLED(LIMITED_JERK_EDITING)
  2636. #ifdef MAX_JERK_EDIT_VALUES
  2637. constexpr float sanity_arr_6[] = MAX_JERK_EDIT_VALUES;
  2638. static_assert(COUNT(sanity_arr_6) >= XYZE, "MAX_JERK_EDIT_VALUES requires X, Y, Z and E elements.");
  2639. static_assert(COUNT(sanity_arr_6) <= XYZE, "MAX_JERK_EDIT_VALUES has too many elements. X, Y, Z and E elements only.");
  2640. static_assert( _ARR_TEST(6,0) && _ARR_TEST(6,1) && _ARR_TEST(6,2)
  2641. && _ARR_TEST(6,3) && _ARR_TEST(6,4) && _ARR_TEST(6,5)
  2642. && _ARR_TEST(6,6) && _ARR_TEST(6,7) && _ARR_TEST(6,8),
  2643. "MAX_JERK_EDIT_VALUES values must be positive.");
  2644. #endif
  2645. #endif
  2646. #undef _ARR_TEST
  2647. #if BOTH(CNC_COORDINATE_SYSTEMS, NO_WORKSPACE_OFFSETS)
  2648. #error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS."
  2649. #endif
  2650. #if !BLOCK_BUFFER_SIZE || !IS_POWER_OF_2(BLOCK_BUFFER_SIZE)
  2651. #error "BLOCK_BUFFER_SIZE must be a power of 2."
  2652. #elif BLOCK_BUFFER_SIZE > 64
  2653. #error "A very large BLOCK_BUFFER_SIZE is not needed and takes longer to drain the buffer on pause / cancel."
  2654. #endif
  2655. #if ENABLED(LED_CONTROL_MENU) && !IS_ULTIPANEL
  2656. #error "LED_CONTROL_MENU requires an LCD controller."
  2657. #endif
  2658. #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) && DISABLED(NEOPIXEL_LED)
  2659. #error "CASE_LIGHT_USE_NEOPIXEL requires NEOPIXEL_LED."
  2660. #endif
  2661. #if ENABLED(SKEW_CORRECTION)
  2662. #if !defined(XY_SKEW_FACTOR) && !(defined(XY_DIAG_AC) && defined(XY_DIAG_BD) && defined(XY_SIDE_AD))
  2663. #error "SKEW_CORRECTION requires XY_SKEW_FACTOR or XY_DIAG_AC, XY_DIAG_BD, XY_SIDE_AD."
  2664. #endif
  2665. #if ENABLED(SKEW_CORRECTION_FOR_Z)
  2666. #if !defined(XZ_SKEW_FACTOR) && !(defined(XZ_DIAG_AC) && defined(XZ_DIAG_BD) && defined(XZ_SIDE_AD))
  2667. #error "SKEW_CORRECTION requires XZ_SKEW_FACTOR or XZ_DIAG_AC, XZ_DIAG_BD, XZ_SIDE_AD."
  2668. #endif
  2669. #if !defined(YZ_SKEW_FACTOR) && !(defined(YZ_DIAG_AC) && defined(YZ_DIAG_BD) && defined(YZ_SIDE_AD))
  2670. #error "SKEW_CORRECTION requires YZ_SKEW_FACTOR or YZ_DIAG_AC, YZ_DIAG_BD, YZ_SIDE_AD."
  2671. #endif
  2672. #endif
  2673. #endif
  2674. #if ENABLED(BACKUP_POWER_SUPPLY) && !PIN_EXISTS(POWER_LOSS)
  2675. #error "BACKUP_POWER_SUPPLY requires a POWER_LOSS_PIN."
  2676. #endif
  2677. #if BOTH(POWER_LOSS_PULLUP, POWER_LOSS_PULLDOWN)
  2678. #error "You can't enable POWER_LOSS_PULLUP and POWER_LOSS_PULLDOWN at the same time."
  2679. #endif
  2680. #if ENABLED(Z_STEPPER_AUTO_ALIGN)
  2681. #if NUM_Z_STEPPER_DRIVERS <= 1
  2682. #error "Z_STEPPER_AUTO_ALIGN requires NUM_Z_STEPPER_DRIVERS greater than 1."
  2683. #elif !HAS_BED_PROBE
  2684. #error "Z_STEPPER_AUTO_ALIGN requires a Z-bed probe."
  2685. #elif ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
  2686. static_assert(WITHIN(Z_STEPPER_ALIGN_AMP, 0.5, 2.0), "Z_STEPPER_ALIGN_AMP must be between 0.5 and 2.0.");
  2687. #if NUM_Z_STEPPER_DRIVERS < 3
  2688. #error "Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS requires NUM_Z_STEPPER_DRIVERS to be 3 or 4."
  2689. #endif
  2690. #endif
  2691. #endif
  2692. #if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
  2693. #if NONE(HAS_MOTOR_CURRENT_DAC, HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC, HAS_TRINAMIC_CONFIG, HAS_MOTOR_CURRENT_PWM)
  2694. #error "It is highly recommended to have adjustable current drivers to prevent damage. Disable this line to continue anyway."
  2695. #elif !defined(GANTRY_CALIBRATION_CURRENT)
  2696. #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_CURRENT to be set."
  2697. #elif !defined(GANTRY_CALIBRATION_EXTRA_HEIGHT)
  2698. #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_EXTRA_HEIGHT to be set."
  2699. #elif !defined(GANTRY_CALIBRATION_FEEDRATE)
  2700. #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_FEEDRATE to be set."
  2701. #endif
  2702. #if defined(GANTRY_CALIBRATION_SAFE_POSITION) && !defined(GANTRY_CALIBRATION_XY_PARK_FEEDRATE)
  2703. #error "GANTRY_CALIBRATION_SAFE_POSITION Requires GANTRY_CALIBRATION_XY_PARK_FEEDRATE to be set."
  2704. #endif
  2705. #endif
  2706. #if BOTH(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
  2707. #error "You cannot use Z_STEPPER_AUTO_ALIGN and MECHANICAL_GANTRY_CALIBRATION at the same time."
  2708. #endif
  2709. #if ENABLED(PRINTCOUNTER) && DISABLED(EEPROM_SETTINGS)
  2710. #error "PRINTCOUNTER requires EEPROM_SETTINGS."
  2711. #endif
  2712. #if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR)
  2713. #error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT."
  2714. #endif
  2715. #if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__)
  2716. #error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board."
  2717. #endif
  2718. #if ENABLED(GCODE_MACROS) && !WITHIN(GCODE_MACROS_SLOTS, 1, 10)
  2719. #error "GCODE_MACROS_SLOTS must be a number from 1 to 10."
  2720. #endif
  2721. #if ENABLED(CUSTOM_USER_MENUS)
  2722. #ifdef USER_GCODE_1
  2723. constexpr char _chr1 = USER_GCODE_1[strlen(USER_GCODE_1) - 1];
  2724. static_assert(_chr1 != '\n' && _chr1 != '\r', "USER_GCODE_1 cannot have a newline at the end. Please remove it.");
  2725. #endif
  2726. #ifdef USER_GCODE_2
  2727. constexpr char _chr2 = USER_GCODE_2[strlen(USER_GCODE_2) - 1];
  2728. static_assert(_chr2 != '\n' && _chr2 != '\r', "USER_GCODE_2 cannot have a newline at the end. Please remove it.");
  2729. #endif
  2730. #ifdef USER_GCODE_3
  2731. constexpr char _chr3 = USER_GCODE_3[strlen(USER_GCODE_3) - 1];
  2732. static_assert(_chr3 != '\n' && _chr3 != '\r', "USER_GCODE_3 cannot have a newline at the end. Please remove it.");
  2733. #endif
  2734. #ifdef USER_GCODE_4
  2735. constexpr char _chr4 = USER_GCODE_4[strlen(USER_GCODE_4) - 1];
  2736. static_assert(_chr4 != '\n' && _chr4 != '\r', "USER_GCODE_4 cannot have a newline at the end. Please remove it.");
  2737. #endif
  2738. #ifdef USER_GCODE_5
  2739. constexpr char _chr5 = USER_GCODE_5[strlen(USER_GCODE_5) - 1];
  2740. static_assert(_chr5 != '\n' && _chr5 != '\r', "USER_GCODE_5 cannot have a newline at the end. Please remove it.");
  2741. #endif
  2742. #ifdef USER_GCODE_6
  2743. constexpr char _chr6 = USER_GCODE_6[strlen(USER_GCODE_6) - 1];
  2744. static_assert(_chr6 != '\n' && _chr6 != '\r', "USER_GCODE_6 cannot have a newline at the end. Please remove it.");
  2745. #endif
  2746. #ifdef USER_GCODE_7
  2747. constexpr char _chr7 = USER_GCODE_7[strlen(USER_GCODE_7) - 1];
  2748. static_assert(_chr7 != '\n' && _chr7 != '\r', "USER_GCODE_7 cannot have a newline at the end. Please remove it.");
  2749. #endif
  2750. #ifdef USER_GCODE_8
  2751. constexpr char _chr8 = USER_GCODE_8[strlen(USER_GCODE_8) - 1];
  2752. static_assert(_chr8 != '\n' && _chr8 != '\r', "USER_GCODE_8 cannot have a newline at the end. Please remove it.");
  2753. #endif
  2754. #ifdef USER_GCODE_9
  2755. constexpr char _chr9 = USER_GCODE_9[strlen(USER_GCODE_9) - 1];
  2756. static_assert(_chr9 != '\n' && _chr9 != '\r', "USER_GCODE_9 cannot have a newline at the end. Please remove it.");
  2757. #endif
  2758. #ifdef USER_GCODE_10
  2759. constexpr char _chr10 = USER_GCODE_10[strlen(USER_GCODE_10) - 1];
  2760. static_assert(_chr10 != '\n' && _chr10 != '\r', "USER_GCODE_10 cannot have a newline at the end. Please remove it.");
  2761. #endif
  2762. #ifdef USER_GCODE_11
  2763. constexpr char _chr11 = USER_GCODE_11[strlen(USER_GCODE_11) - 1];
  2764. static_assert(_chr11 != '\n' && _chr11 != '\r', "USER_GCODE_11 cannot have a newline at the end. Please remove it.");
  2765. #endif
  2766. #ifdef USER_GCODE_12
  2767. constexpr char _chr12 = USER_GCODE_12[strlen(USER_GCODE_12) - 1];
  2768. static_assert(_chr12 != '\n' && _chr12 != '\r', "USER_GCODE_12 cannot have a newline at the end. Please remove it.");
  2769. #endif
  2770. #ifdef USER_GCODE_13
  2771. constexpr char _chr13 = USER_GCODE_13[strlen(USER_GCODE_13) - 1];
  2772. static_assert(_chr13 != '\n' && _chr13 != '\r', "USER_GCODE_13 cannot have a newline at the end. Please remove it.");
  2773. #endif
  2774. #ifdef USER_GCODE_14
  2775. constexpr char _chr14 = USER_GCODE_14[strlen(USER_GCODE_14) - 1];
  2776. static_assert(_chr14 != '\n' && _chr14 != '\r', "USER_GCODE_14 cannot have a newline at the end. Please remove it.");
  2777. #endif
  2778. #ifdef USER_GCODE_15
  2779. constexpr char _chr15 = USER_GCODE_15[strlen(USER_GCODE_15) - 1];
  2780. static_assert(_chr15 != '\n' && _chr15 != '\r', "USER_GCODE_15 cannot have a newline at the end. Please remove it.");
  2781. #endif
  2782. #ifdef USER_GCODE_16
  2783. constexpr char _chr16 = USER_GCODE_16[strlen(USER_GCODE_16) - 1];
  2784. static_assert(_chr16 != '\n' && _chr16 != '\r', "USER_GCODE_16 cannot have a newline at the end. Please remove it.");
  2785. #endif
  2786. #ifdef USER_GCODE_17
  2787. constexpr char _chr17 = USER_GCODE_17[strlen(USER_GCODE_17) - 1];
  2788. static_assert(_chr17 != '\n' && _chr17 != '\r', "USER_GCODE_17 cannot have a newline at the end. Please remove it.");
  2789. #endif
  2790. #ifdef USER_GCODE_18
  2791. constexpr char _chr18 = USER_GCODE_18[strlen(USER_GCODE_18) - 1];
  2792. static_assert(_chr18 != '\n' && _chr18 != '\r', "USER_GCODE_18 cannot have a newline at the end. Please remove it.");
  2793. #endif
  2794. #ifdef USER_GCODE_19
  2795. constexpr char _chr19 = USER_GCODE_19[strlen(USER_GCODE_19) - 1];
  2796. static_assert(_chr19 != '\n' && _chr19 != '\r', "USER_GCODE_19 cannot have a newline at the end. Please remove it.");
  2797. #endif
  2798. #ifdef USER_GCODE_20
  2799. constexpr char _chr20 = USER_GCODE_20[strlen(USER_GCODE_20) - 1];
  2800. static_assert(_chr20 != '\n' && _chr20 != '\r', "USER_GCODE_20 cannot have a newline at the end. Please remove it.");
  2801. #endif
  2802. #ifdef USER_GCODE_21
  2803. constexpr char _chr21 = USER_GCODE_21[strlen(USER_GCODE_21) - 1];
  2804. static_assert(_chr21 != '\n' && _chr21 != '\r', "USER_GCODE_21 cannot have a newline at the end. Please remove it.");
  2805. #endif
  2806. #ifdef USER_GCODE_22
  2807. constexpr char _chr22 = USER_GCODE_22[strlen(USER_GCODE_22) - 1];
  2808. static_assert(_chr22 != '\n' && _chr22 != '\r', "USER_GCODE_22 cannot have a newline at the end. Please remove it.");
  2809. #endif
  2810. #ifdef USER_GCODE_23
  2811. constexpr char _chr23 = USER_GCODE_23[strlen(USER_GCODE_23) - 1];
  2812. static_assert(_chr23 != '\n' && _chr23 != '\r', "USER_GCODE_23 cannot have a newline at the end. Please remove it.");
  2813. #endif
  2814. #ifdef USER_GCODE_24
  2815. constexpr char _chr24 = USER_GCODE_24[strlen(USER_GCODE_24) - 1];
  2816. static_assert(_chr24 != '\n' && _chr24 != '\r', "USER_GCODE_24 cannot have a newline at the end. Please remove it.");
  2817. #endif
  2818. #ifdef USER_GCODE_25
  2819. constexpr char _chr25 = USER_GCODE_25[strlen(USER_GCODE_25) - 1];
  2820. static_assert(_chr25 != '\n' && _chr25 != '\r', "USER_GCODE_25 cannot have a newline at the end. Please remove it.");
  2821. #endif
  2822. #endif
  2823. #if ENABLED(BACKLASH_COMPENSATION)
  2824. #ifndef BACKLASH_DISTANCE_MM
  2825. #error "BACKLASH_COMPENSATION requires BACKLASH_DISTANCE_MM."
  2826. #elif !defined(BACKLASH_CORRECTION)
  2827. #error "BACKLASH_COMPENSATION requires BACKLASH_CORRECTION."
  2828. #elif ENABLED(MARKFORGED_XY)
  2829. constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
  2830. static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
  2831. "BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " on a MarkForged system.");
  2832. #elif IS_CORE
  2833. constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
  2834. static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
  2835. "BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " with your CORE system.");
  2836. #endif
  2837. #endif
  2838. #if ENABLED(GRADIENT_MIX) && MIXING_VIRTUAL_TOOLS < 2
  2839. #error "GRADIENT_MIX requires 2 or more MIXING_VIRTUAL_TOOLS."
  2840. #endif
  2841. /**
  2842. * Photo G-code requirements
  2843. */
  2844. #if ENABLED(PHOTO_GCODE)
  2845. #if (PIN_EXISTS(CHDK) + PIN_EXISTS(PHOTOGRAPH) + defined(PHOTO_SWITCH_POSITION)) > 1
  2846. #error "Please define only one of CHDK_PIN, PHOTOGRAPH_PIN, or PHOTO_SWITCH_POSITION."
  2847. #elif defined(PHOTO_SWITCH_POSITION) && !defined(PHOTO_POSITION)
  2848. #error "PHOTO_SWITCH_POSITION requires PHOTO_POSITION."
  2849. #elif PIN_EXISTS(CHDK) && defined(CHDK_DELAY)
  2850. #error "CHDK_DELAY has been replaced by PHOTO_SWITCH_MS."
  2851. #elif PIN_EXISTS(CHDK) && !defined(PHOTO_SWITCH_MS)
  2852. #error "PHOTO_SWITCH_MS is required with CHDK_PIN."
  2853. #elif defined(PHOTO_RETRACT_MM)
  2854. static_assert(PHOTO_RETRACT_MM + 0 >= 0, "PHOTO_RETRACT_MM must be >= 0.");
  2855. #endif
  2856. #endif
  2857. /**
  2858. * Advanced PRINTCOUNTER settings
  2859. */
  2860. #if ENABLED(PRINTCOUNTER)
  2861. #if defined(SERVICE_INTERVAL_1) != defined(SERVICE_NAME_1)
  2862. #error "Both SERVICE_NAME_1 and SERVICE_INTERVAL_1 are required."
  2863. #elif defined(SERVICE_INTERVAL_2) != defined(SERVICE_NAME_2)
  2864. #error "Both SERVICE_NAME_2 and SERVICE_INTERVAL_2 are required."
  2865. #elif defined(SERVICE_INTERVAL_3) != defined(SERVICE_NAME_3)
  2866. #error "Both SERVICE_NAME_3 and SERVICE_INTERVAL_3 are required."
  2867. #endif
  2868. #endif
  2869. /**
  2870. * Require soft endstops for certain setups
  2871. */
  2872. #if !BOTH(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
  2873. #if ENABLED(DUAL_X_CARRIAGE)
  2874. #error "DUAL_X_CARRIAGE requires both MIN_ and MAX_SOFTWARE_ENDSTOPS."
  2875. #elif HAS_HOTEND_OFFSET
  2876. #error "MIN_ and MAX_SOFTWARE_ENDSTOPS are both required with offset hotends."
  2877. #endif
  2878. #endif
  2879. /**
  2880. * Ensure this option is set intentionally
  2881. */
  2882. #if ENABLED(PSU_CONTROL)
  2883. #ifndef PSU_ACTIVE_STATE
  2884. #error "PSU_CONTROL requires PSU_ACTIVE_STATE to be defined as 'HIGH' or 'LOW'."
  2885. #elif !PIN_EXISTS(PS_ON)
  2886. #error "PSU_CONTROL requires PS_ON_PIN."
  2887. #elif POWER_OFF_DELAY < 0
  2888. #error "POWER_OFF_DELAY must be a positive value."
  2889. #endif
  2890. #endif
  2891. #if HAS_CUTTER
  2892. #ifndef CUTTER_POWER_UNIT
  2893. #error "CUTTER_POWER_UNIT is required with a spindle or laser."
  2894. #elif !CUTTER_UNIT_IS(PWM255) && !CUTTER_UNIT_IS(PERCENT) && !CUTTER_UNIT_IS(RPM) && !CUTTER_UNIT_IS(SERVO)
  2895. #error "CUTTER_POWER_UNIT must be PWM255, PERCENT, RPM, or SERVO."
  2896. #endif
  2897. #if ENABLED(LASER_POWER_INLINE)
  2898. #if ENABLED(SPINDLE_CHANGE_DIR)
  2899. #error "SPINDLE_CHANGE_DIR and LASER_POWER_INLINE are incompatible."
  2900. #elif ENABLED(LASER_MOVE_G0_OFF) && DISABLED(LASER_MOVE_POWER)
  2901. #error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER."
  2902. #endif
  2903. #if ENABLED(LASER_POWER_INLINE_TRAPEZOID)
  2904. #if DISABLED(SPINDLE_LASER_PWM)
  2905. #error "LASER_POWER_INLINE_TRAPEZOID requires SPINDLE_LASER_PWM to function."
  2906. #elif ENABLED(S_CURVE_ACCELERATION)
  2907. //#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
  2908. // #define LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN
  2909. // #warning "Combining LASER_POWER_INLINE_TRAPEZOID with S_CURVE_ACCELERATION may result in unintended behavior."
  2910. //#endif
  2911. #endif
  2912. #endif
  2913. #if ENABLED(LASER_POWER_INLINE_INVERT)
  2914. //#ifndef LASER_POWER_INLINE_INVERT_WARN
  2915. // #define LASER_POWER_INLINE_INVERT_WARN
  2916. // #warning "Enabling LASER_POWER_INLINE_INVERT means that `M5` won't kill the laser immediately; use `M5 I` instead."
  2917. //#endif
  2918. #endif
  2919. #else
  2920. #if SPINDLE_LASER_POWERUP_DELAY < 1
  2921. #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0."
  2922. #elif SPINDLE_LASER_POWERDOWN_DELAY < 1
  2923. #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0."
  2924. #elif ENABLED(LASER_MOVE_POWER)
  2925. #error "LASER_MOVE_POWER requires LASER_POWER_INLINE."
  2926. #elif ANY(LASER_POWER_INLINE_TRAPEZOID, LASER_POWER_INLINE_INVERT, LASER_MOVE_G0_OFF, LASER_MOVE_POWER)
  2927. #error "Enabled an inline laser feature without inline laser power being enabled."
  2928. #endif
  2929. #endif
  2930. #define _PIN_CONFLICT(P) (PIN_EXISTS(P) && P##_PIN == SPINDLE_LASER_PWM_PIN)
  2931. #if BOTH(SPINDLE_FEATURE, LASER_FEATURE)
  2932. #error "Enable only one of SPINDLE_FEATURE or LASER_FEATURE."
  2933. #elif !PIN_EXISTS(SPINDLE_LASER_ENA) && DISABLED(SPINDLE_SERVO)
  2934. #error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power."
  2935. #elif ENABLED(SPINDLE_CHANGE_DIR) && !PIN_EXISTS(SPINDLE_DIR)
  2936. #error "SPINDLE_DIR_PIN is required for SPINDLE_CHANGE_DIR."
  2937. #elif ENABLED(SPINDLE_LASER_PWM)
  2938. #if !defined(SPINDLE_LASER_PWM_PIN) || SPINDLE_LASER_PWM_PIN < 0
  2939. #error "SPINDLE_LASER_PWM_PIN is required for SPINDLE_LASER_PWM."
  2940. #elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN)
  2941. #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin."
  2942. #elif !defined(SPINDLE_LASER_PWM_INVERT)
  2943. #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE."
  2944. #elif !(defined(SPEED_POWER_INTERCEPT) && defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP))
  2945. #error "SPINDLE_LASER_PWM equation constant(s) missing."
  2946. #elif _PIN_CONFLICT(X_MIN)
  2947. #error "SPINDLE_LASER_PWM pin conflicts with X_MIN_PIN."
  2948. #elif _PIN_CONFLICT(X_MAX)
  2949. #error "SPINDLE_LASER_PWM pin conflicts with X_MAX_PIN."
  2950. #elif _PIN_CONFLICT(Z_STEP)
  2951. #error "SPINDLE_LASER_PWM pin conflicts with Z_STEP_PIN."
  2952. #elif _PIN_CONFLICT(CASE_LIGHT)
  2953. #error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN."
  2954. #elif _PIN_CONFLICT(E0_AUTO_FAN)
  2955. #error "SPINDLE_LASER_PWM_PIN conflicts with E0_AUTO_FAN_PIN."
  2956. #elif _PIN_CONFLICT(E1_AUTO_FAN)
  2957. #error "SPINDLE_LASER_PWM_PIN conflicts with E1_AUTO_FAN_PIN."
  2958. #elif _PIN_CONFLICT(E2_AUTO_FAN)
  2959. #error "SPINDLE_LASER_PWM_PIN conflicts with E2_AUTO_FAN_PIN."
  2960. #elif _PIN_CONFLICT(E3_AUTO_FAN)
  2961. #error "SPINDLE_LASER_PWM_PIN conflicts with E3_AUTO_FAN_PIN."
  2962. #elif _PIN_CONFLICT(E4_AUTO_FAN)
  2963. #error "SPINDLE_LASER_PWM_PIN conflicts with E4_AUTO_FAN_PIN."
  2964. #elif _PIN_CONFLICT(E5_AUTO_FAN)
  2965. #error "SPINDLE_LASER_PWM_PIN conflicts with E5_AUTO_FAN_PIN."
  2966. #elif _PIN_CONFLICT(E6_AUTO_FAN)
  2967. #error "SPINDLE_LASER_PWM_PIN conflicts with E6_AUTO_FAN_PIN."
  2968. #elif _PIN_CONFLICT(E7_AUTO_FAN)
  2969. #error "SPINDLE_LASER_PWM_PIN conflicts with E7_AUTO_FAN_PIN."
  2970. #elif _PIN_CONFLICT(FAN)
  2971. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN_PIN."
  2972. #elif _PIN_CONFLICT(FAN1)
  2973. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN1_PIN."
  2974. #elif _PIN_CONFLICT(FAN2)
  2975. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN2_PIN."
  2976. #elif _PIN_CONFLICT(FAN3)
  2977. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN3_PIN."
  2978. #elif _PIN_CONFLICT(FAN4)
  2979. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN4_PIN."
  2980. #elif _PIN_CONFLICT(FAN5)
  2981. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN5_PIN."
  2982. #elif _PIN_CONFLICT(FAN6)
  2983. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN6_PIN."
  2984. #elif _PIN_CONFLICT(FAN7)
  2985. #error "SPINDLE_LASER_PWM_PIN conflicts with FAN7_PIN."
  2986. #elif _PIN_CONFLICT(CONTROLLERFAN)
  2987. #error "SPINDLE_LASER_PWM_PIN conflicts with CONTROLLERFAN_PIN."
  2988. #elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_XY)
  2989. #error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_XY."
  2990. #elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_Z)
  2991. #error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_Z."
  2992. #elif _PIN_CONFLICT(MOTOR_CURRENT_PWM_E)
  2993. #error "SPINDLE_LASER_PWM_PIN conflicts with MOTOR_CURRENT_PWM_E."
  2994. #endif
  2995. #endif
  2996. #undef _PIN_CONFLICT
  2997. #endif
  2998. #if NONE(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI) && ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
  2999. #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
  3000. #endif
  3001. #if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && ADC_BUTTON_DEBOUNCE_DELAY < 16
  3002. #error "ADC_BUTTON_DEBOUNCE_DELAY must be greater than 16."
  3003. #endif
  3004. /**
  3005. * Check to make sure MONITOR_DRIVER_STATUS isn't enabled
  3006. * on boards where TMC drivers share the SPI bus with SD.
  3007. */
  3008. #if HAS_TMC_SPI && ALL(MONITOR_DRIVER_STATUS, SDSUPPORT, USES_SHARED_SPI)
  3009. #error "MONITOR_DRIVER_STATUS and SDSUPPORT cannot be used together on boards with shared SPI."
  3010. #endif
  3011. // G60/G61 Position Save
  3012. #if SAVED_POSITIONS > 256
  3013. #error "SAVED_POSITIONS must be an integer from 0 to 256."
  3014. #endif
  3015. /**
  3016. * Stepper Chunk support
  3017. */
  3018. #if BOTH(DIRECT_STEPPING, LIN_ADVANCE)
  3019. #error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible."
  3020. #endif
  3021. /**
  3022. * Touch Buttons
  3023. */
  3024. #if ENABLED(TOUCH_SCREEN)
  3025. #ifndef TOUCH_CALIBRATION_X
  3026. #error "TOUCH_CALIBRATION_X must be defined with TOUCH_SCREEN."
  3027. #endif
  3028. #ifndef TOUCH_CALIBRATION_Y
  3029. #error "TOUCH_CALIBRATION_Y must be defined with TOUCH_SCREEN."
  3030. #endif
  3031. #ifndef TOUCH_OFFSET_X
  3032. #error "TOUCH_OFFSET_X must be defined with TOUCH_SCREEN."
  3033. #endif
  3034. #ifndef TOUCH_OFFSET_Y
  3035. #error "TOUCH_OFFSET_Y must be defined with TOUCH_SCREEN."
  3036. #endif
  3037. #endif
  3038. /**
  3039. * Sanity check for WIFI
  3040. */
  3041. #if EITHER(ESP3D_WIFISUPPORT, WIFISUPPORT) && DISABLED(ARDUINO_ARCH_ESP32)
  3042. #error "ESP3D_WIFISUPPORT or WIFISUPPORT requires an ESP32 MOTHERBOARD."
  3043. #endif
  3044. /**
  3045. * Sanity Check for Password Feature
  3046. */
  3047. #if ENABLED(PASSWORD_FEATURE)
  3048. #if NONE(HAS_LCD_MENU, PASSWORD_UNLOCK_GCODE, PASSWORD_CHANGE_GCODE)
  3049. #error "Without PASSWORD_UNLOCK_GCODE, PASSWORD_CHANGE_GCODE, or a supported LCD there's no way to unlock the printer or set a password."
  3050. #elif DISABLED(EEPROM_SETTINGS)
  3051. #warning "PASSWORD_FEATURE settings will be lost on power-off without EEPROM_SETTINGS."
  3052. #endif
  3053. #endif
  3054. /**
  3055. * Sanity check for valid stepper driver types
  3056. */
  3057. #define _BAD_DRIVER(A) (defined(A##_DRIVER_TYPE) && !_DRIVER_ID(A##_DRIVER_TYPE))
  3058. #if _BAD_DRIVER(X)
  3059. #error "X_DRIVER_TYPE is not recognized."
  3060. #endif
  3061. #if _BAD_DRIVER(Y)
  3062. #error "Y_DRIVER_TYPE is not recognized."
  3063. #endif
  3064. #if _BAD_DRIVER(Z)
  3065. #error "Z_DRIVER_TYPE is not recognized."
  3066. #endif
  3067. #if _BAD_DRIVER(X2)
  3068. #error "X2_DRIVER_TYPE is not recognized."
  3069. #endif
  3070. #if _BAD_DRIVER(Y2)
  3071. #error "Y2_DRIVER_TYPE is not recognized."
  3072. #endif
  3073. #if _BAD_DRIVER(Z2)
  3074. #error "Z2_DRIVER_TYPE is not recognized."
  3075. #endif
  3076. #if _BAD_DRIVER(Z3)
  3077. #error "Z3_DRIVER_TYPE is not recognized."
  3078. #endif
  3079. #if _BAD_DRIVER(Z4)
  3080. #error "Z4_DRIVER_TYPE is not recognized."
  3081. #endif
  3082. #if _BAD_DRIVER(E0)
  3083. #error "E0_DRIVER_TYPE is not recognized."
  3084. #endif
  3085. #if _BAD_DRIVER(E1)
  3086. #error "E1_DRIVER_TYPE is not recognized."
  3087. #endif
  3088. #if _BAD_DRIVER(E2)
  3089. #error "E2_DRIVER_TYPE is not recognized."
  3090. #endif
  3091. #if _BAD_DRIVER(E3)
  3092. #error "E3_DRIVER_TYPE is not recognized."
  3093. #endif
  3094. #if _BAD_DRIVER(E4)
  3095. #error "E4_DRIVER_TYPE is not recognized."
  3096. #endif
  3097. #if _BAD_DRIVER(E5)
  3098. #error "E5_DRIVER_TYPE is not recognized."
  3099. #endif
  3100. #if _BAD_DRIVER(E6)
  3101. #error "E6_DRIVER_TYPE is not recognized."
  3102. #endif
  3103. #if _BAD_DRIVER(E7)
  3104. #error "E7_DRIVER_TYPE is not recognized."
  3105. #endif
  3106. #undef _BAD_DRIVER
  3107. // Misc. Cleanup
  3108. #undef _TEST_PWM