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 162KB

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