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

Conditionals_LCD.h 42KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * Conditionals_LCD.h
  25. * Conditionals that need to be set before Configuration_adv.h or pins.h
  26. */
  27. // MKS_LCD12864A/B is a variant of MKS_MINI_12864
  28. #if EITHER(MKS_LCD12864A, MKS_LCD12864B)
  29. #define MKS_MINI_12864
  30. #endif
  31. // MKS_MINI_12864_V3 and BTT_MINI_12864_V1 are identical to FYSETC_MINI_12864_2_1
  32. #if EITHER(MKS_MINI_12864_V3, BTT_MINI_12864_V1)
  33. #define FYSETC_MINI_12864_2_1
  34. #endif
  35. /**
  36. * General Flags that may be set below by specific LCDs
  37. *
  38. * DOGLCD : Run a Graphical LCD through U8GLib (with MarlinUI)
  39. * IS_ULTIPANEL : Define LCD_PINS_D5/6/7 for direct-connected "Ultipanel" LCDs
  40. * HAS_WIRED_LCD : Ultra LCD, not necessarily Ultipanel.
  41. * IS_RRD_SC : Common RRD Smart Controller digital interface pins
  42. * IS_RRD_FG_SC : Common RRD Full Graphical Smart Controller digital interface pins
  43. * IS_U8GLIB_ST7920 : Most common DOGM display SPI interface, supporting a "lightweight" display mode.
  44. * U8GLIB_SH1106 : SH1106 OLED with I2C interface via U8GLib
  45. * IS_U8GLIB_SSD1306 : SSD1306 OLED with I2C interface via U8GLib (U8GLIB_SSD1306)
  46. * U8GLIB_SSD1309 : SSD1309 OLED with I2C interface via U8GLib (HAS_U8GLIB_I2C_OLED, HAS_WIRED_LCD, DOGLCD)
  47. * IS_U8GLIB_ST7565_64128N : ST7565 128x64 LCD with SPI interface via U8GLib
  48. * IS_U8GLIB_LM6059_AF : LM6059 with Hardware SPI via U8GLib
  49. */
  50. #if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
  51. #define MINIPANEL
  52. #elif ENABLED(YHCB2004)
  53. #define IS_ULTIPANEL 1
  54. #elif ENABLED(CARTESIO_UI)
  55. #define DOGLCD
  56. #define IS_ULTIPANEL 1
  57. #elif EITHER(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE)
  58. #define IS_DWIN_MARLINUI 1
  59. #define IS_ULTIPANEL 1
  60. #elif ENABLED(ZONESTAR_LCD)
  61. #define HAS_ADC_BUTTONS 1
  62. #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
  63. #define ADC_KEY_NUM 8
  64. #define IS_ULTIPANEL 1
  65. // This helps to implement HAS_ADC_BUTTONS menus
  66. #define REVERSE_MENU_DIRECTION
  67. #define STD_ENCODER_PULSES_PER_STEP 1
  68. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  69. #define ENCODER_FEEDRATE_DEADZONE 2
  70. #elif ENABLED(ZONESTAR_12864LCD)
  71. #define DOGLCD
  72. #define IS_RRD_SC 1
  73. #define IS_U8GLIB_ST7920 1
  74. #elif ENABLED(ZONESTAR_12864OLED)
  75. #define IS_RRD_SC 1
  76. #define U8GLIB_SH1106
  77. #elif ENABLED(ZONESTAR_12864OLED_SSD1306)
  78. #define IS_RRD_SC 1
  79. #define IS_U8GLIB_SSD1306
  80. #elif ENABLED(RADDS_DISPLAY)
  81. #define IS_ULTIPANEL 1
  82. #define STD_ENCODER_PULSES_PER_STEP 2
  83. #elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864)
  84. #define DOGLCD
  85. #define IS_DOGM_12864 1
  86. #define IS_ULTIPANEL 1
  87. #if ENABLED(miniVIKI)
  88. #define IS_U8GLIB_ST7565_64128N 1
  89. #elif ENABLED(VIKI2)
  90. #define IS_U8GLIB_ST7565_64128N 1
  91. #elif ENABLED(WYH_L12864)
  92. #define IS_U8GLIB_ST7565_64128N 1
  93. #define ST7565_XOFFSET 0x04
  94. #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
  95. #define IS_U8GLIB_LM6059_AF 1
  96. #elif ENABLED(AZSMZ_12864)
  97. #define IS_U8GLIB_ST7565_64128N 1
  98. #endif
  99. #elif ENABLED(OLED_PANEL_TINYBOY2)
  100. #define IS_U8GLIB_SSD1306
  101. #define IS_ULTIPANEL 1
  102. #elif ENABLED(RA_CONTROL_PANEL)
  103. #define LCD_I2C_TYPE_PCA8574
  104. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  105. #define IS_ULTIPANEL 1
  106. #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  107. #define DOGLCD
  108. #define IS_U8GLIB_ST7920 1
  109. #define IS_ULTIPANEL 1
  110. #elif ENABLED(MKS_12864OLED)
  111. #define IS_RRD_SC 1
  112. #define U8GLIB_SH1106
  113. #elif ENABLED(MKS_12864OLED_SSD1306)
  114. #define IS_RRD_SC 1
  115. #define IS_U8GLIB_SSD1306
  116. #elif ENABLED(SAV_3DGLCD)
  117. #ifdef U8GLIB_SSD1306
  118. #define IS_U8GLIB_SSD1306 // Allow for U8GLIB_SSD1306 + SAV_3DGLCD
  119. #endif
  120. #define IS_NEWPANEL 1
  121. #elif ENABLED(FYSETC_242_OLED_12864)
  122. #define IS_RRD_SC 1
  123. #define U8GLIB_SH1106
  124. #ifndef NEOPIXEL_BRIGHTNESS
  125. #define NEOPIXEL_BRIGHTNESS 127
  126. #endif
  127. #elif ANY(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)
  128. #define FYSETC_MINI_12864
  129. #define DOGLCD
  130. #define IS_ULTIPANEL 1
  131. #define LED_COLORS_REDUCE_GREEN
  132. // Require LED backlighting enabled
  133. #if ENABLED(FYSETC_MINI_12864_2_1)
  134. #ifndef NEOPIXEL_BRIGHTNESS
  135. #define NEOPIXEL_BRIGHTNESS 127
  136. #endif
  137. //#define NEOPIXEL_STARTUP_TEST
  138. #endif
  139. #elif ENABLED(ULTI_CONTROLLER)
  140. #define IS_ULTIPANEL 1
  141. #define U8GLIB_SSD1309
  142. #define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
  143. #define STD_ENCODER_PULSES_PER_STEP 4
  144. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  145. #ifndef PCA9632
  146. #define PCA9632
  147. #endif
  148. #elif ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602)
  149. #define IS_RRD_SC 1
  150. #define LCD_WIDTH 16
  151. #define LCD_HEIGHT 2
  152. #elif EITHER(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C)
  153. #define IS_TFTGLCD_PANEL 1
  154. #define IS_ULTIPANEL 1 // Note that IS_ULTIPANEL leads to HAS_WIRED_LCD
  155. #if ENABLED(SDSUPPORT) && DISABLED(LCD_PROGRESS_BAR)
  156. #define LCD_PROGRESS_BAR
  157. #endif
  158. #if ENABLED(TFTGLCD_PANEL_I2C)
  159. #define LCD_I2C_ADDRESS 0x33 // Must be 0x33 for STM32 main boards and equal to panel's I2C slave address
  160. #endif
  161. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD, used for both I2C and SPI buses (LiquidTWI2 not required)
  162. #define STD_ENCODER_PULSES_PER_STEP 2
  163. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  164. #define LCD_WIDTH 20 // 20 or 24 chars in line
  165. #define LCD_HEIGHT 10 // Character lines
  166. #define LCD_CONTRAST_MIN 127
  167. #define LCD_CONTRAST_MAX 255
  168. #define LCD_CONTRAST_DEFAULT 250
  169. #define CONVERT_TO_EXT_ASCII // Use extended 128-255 symbols from ASCII table.
  170. // At this time present conversion only for cyrillic - bg, ru and uk languages.
  171. // First 7 ASCII symbols in panel font must be replaced with Marlin's special symbols.
  172. #elif ENABLED(CR10_STOCKDISPLAY)
  173. #define IS_RRD_FG_SC 1
  174. #define LCD_ST7920_DELAY_1 125
  175. #define LCD_ST7920_DELAY_2 125
  176. #define LCD_ST7920_DELAY_3 125
  177. #elif EITHER(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING)
  178. #define IS_RRD_FG_SC 1
  179. #define LCD_ST7920_DELAY_1 150
  180. #define LCD_ST7920_DELAY_2 150
  181. #define LCD_ST7920_DELAY_3 150
  182. #elif ANY(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, BQ_LCD_SMART_CONTROLLER, K3D_FULL_GRAPHIC_SMART_CONTROLLER)
  183. #define IS_RRD_FG_SC 1
  184. #elif ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
  185. #define IS_RRD_SC 1 // RepRapDiscount LCD or Graphical LCD with rotary click encoder
  186. #elif ENABLED(K3D_242_OLED_CONTROLLER)
  187. #define IS_RRD_SC 1
  188. #define U8GLIB_SSD1309
  189. #endif
  190. // ST7920-based graphical displays
  191. #if ANY(IS_RRD_FG_SC, LCD_FOR_MELZI, SILVER_GATE_GLCD_CONTROLLER)
  192. #define DOGLCD
  193. #define IS_U8GLIB_ST7920 1
  194. #define IS_RRD_SC 1
  195. #endif
  196. // ST7565 / 64128N graphical displays
  197. #if EITHER(MAKRPANEL, MINIPANEL)
  198. #define IS_ULTIPANEL 1
  199. #define DOGLCD
  200. #if ENABLED(MAKRPANEL)
  201. #define IS_U8GLIB_ST7565_64128N 1
  202. #endif
  203. #endif
  204. #if ENABLED(IS_U8GLIB_SSD1306)
  205. #define U8GLIB_SSD1306
  206. #endif
  207. #if ENABLED(OVERLORD_OLED)
  208. #define IS_ULTIPANEL 1
  209. #define U8GLIB_SH1106
  210. /**
  211. * PCA9632 for buzzer and LEDs via i2c
  212. * No auto-inc, red and green leds switched, buzzer
  213. */
  214. #define PCA9632
  215. #define PCA9632_NO_AUTO_INC
  216. #define PCA9632_GRN 0x00
  217. #define PCA9632_RED 0x02
  218. #define PCA9632_BUZZER
  219. #define PCA9632_BUZZER_DATA { 0x09, 0x02 }
  220. #define STD_ENCODER_PULSES_PER_STEP 1 // Overlord uses buttons
  221. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  222. #endif
  223. // 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106
  224. #if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
  225. #define HAS_U8GLIB_I2C_OLED 1
  226. #define HAS_WIRED_LCD 1
  227. #define DOGLCD
  228. #endif
  229. /**
  230. * SPI Ultipanels
  231. */
  232. // Basic Ultipanel-like displays
  233. #if ANY(ULTIMAKERCONTROLLER, IS_RRD_SC, G3D_PANEL, RIGIDBOT_PANEL, PANEL_ONE, U8GLIB_SH1106)
  234. #define IS_ULTIPANEL 1
  235. #endif
  236. // Einstart OLED has Cardinal nav via pins defined in pins_EINSTART-S.h
  237. #if ENABLED(U8GLIB_SH1106_EINSTART)
  238. #define DOGLCD
  239. #define IS_ULTIPANEL 1
  240. #endif
  241. // TFT Compatibility
  242. #if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI)
  243. #define IS_LEGACY_TFT 1
  244. #define TFT_GENERIC
  245. #endif
  246. #if ANY(FSMC_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC)
  247. #define TFT_INTERFACE_FSMC
  248. #elif ANY(SPI_GRAPHICAL_TFT, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI)
  249. #define TFT_INTERFACE_SPI
  250. #endif
  251. #if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT)
  252. #define TFT_CLASSIC_UI
  253. #elif ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI)
  254. #define TFT_COLOR_UI
  255. #elif EITHER(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI)
  256. #define TFT_LVGL_UI
  257. #endif
  258. // FSMC/SPI TFT Panels (LVGL)
  259. #if ENABLED(TFT_LVGL_UI)
  260. #define HAS_TFT_LVGL_UI 1
  261. #define SERIAL_RUNTIME_HOOK 1
  262. #endif
  263. // FSMC/SPI TFT Panels
  264. #if ENABLED(TFT_CLASSIC_UI)
  265. #define TFT_SCALED_DOGLCD 1
  266. #endif
  267. #if TFT_SCALED_DOGLCD
  268. #define DOGLCD
  269. #define IS_ULTIPANEL 1
  270. #define DELAYED_BACKLIGHT_INIT
  271. #elif HAS_TFT_LVGL_UI
  272. #define DELAYED_BACKLIGHT_INIT
  273. #endif
  274. // Color UI
  275. #if ENABLED(TFT_COLOR_UI)
  276. #define HAS_GRAPHICAL_TFT 1
  277. #define IS_ULTIPANEL 1
  278. #endif
  279. /**
  280. * I2C Panels
  281. */
  282. #if ANY(IS_RRD_SC, IS_DOGM_12864, OLED_PANEL_TINYBOY2, LCD_I2C_PANELOLU2)
  283. #define STD_ENCODER_PULSES_PER_STEP 4
  284. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  285. #if ENABLED(LCD_I2C_PANELOLU2) // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
  286. #define LCD_I2C_TYPE_MCP23017 // I2C Character-based 12864 display
  287. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  288. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (optional)
  289. #define IS_ULTIPANEL 1
  290. #endif
  291. #elif EITHER(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004)
  292. #define LCD_I2C_TYPE_PCF8575 // I2C Character-based 12864 display
  293. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  294. #if ENABLED(LCD_SAINSMART_I2C_2004)
  295. #define LCD_WIDTH 20
  296. #define LCD_HEIGHT 4
  297. #endif
  298. #elif ENABLED(LCD_I2C_VIKI)
  299. /**
  300. * Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
  301. *
  302. * This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
  303. * Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
  304. * Note: The pause/stop/resume LCD button pin should be connected to the Arduino
  305. * BTN_ENC pin (or set BTN_ENC to -1 if not used)
  306. */
  307. #define LCD_I2C_TYPE_MCP23017
  308. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  309. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
  310. #define IS_ULTIPANEL 1
  311. #define ENCODER_FEEDRATE_DEADZONE 4
  312. #define STD_ENCODER_PULSES_PER_STEP 1
  313. #define STD_ENCODER_STEPS_PER_MENU_ITEM 2
  314. #elif ENABLED(G3D_PANEL)
  315. #define STD_ENCODER_PULSES_PER_STEP 2
  316. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  317. #endif
  318. #if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && DISABLED(NO_LCD_DETECT)
  319. #define DETECT_I2C_LCD_DEVICE 1
  320. #endif
  321. #ifndef STD_ENCODER_PULSES_PER_STEP
  322. #if ENABLED(TOUCH_SCREEN)
  323. #define STD_ENCODER_PULSES_PER_STEP 2
  324. #else
  325. #define STD_ENCODER_PULSES_PER_STEP 5
  326. #endif
  327. #endif
  328. #ifndef STD_ENCODER_STEPS_PER_MENU_ITEM
  329. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  330. #endif
  331. #ifndef ENCODER_PULSES_PER_STEP
  332. #define ENCODER_PULSES_PER_STEP STD_ENCODER_PULSES_PER_STEP
  333. #endif
  334. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  335. #define ENCODER_STEPS_PER_MENU_ITEM STD_ENCODER_STEPS_PER_MENU_ITEM
  336. #endif
  337. #ifndef ENCODER_FEEDRATE_DEADZONE
  338. #define ENCODER_FEEDRATE_DEADZONE 6
  339. #endif
  340. // Shift register panels
  341. // ---------------------
  342. // 2 wire Non-latching LCD SR from:
  343. // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
  344. #if ENABLED(FF_INTERFACEBOARD)
  345. #define SR_LCD_3W_NL // Non latching 3 wire shift register
  346. #define IS_ULTIPANEL 1
  347. #elif ENABLED(SAV_3DLCD)
  348. #define SR_LCD_2W_NL // Non latching 2 wire shift register
  349. #define IS_ULTIPANEL 1
  350. #elif ENABLED(ULTIPANEL)
  351. #define IS_ULTIPANEL 1
  352. #endif
  353. #if EITHER(IS_ULTIPANEL, ULTRA_LCD)
  354. #define HAS_WIRED_LCD 1
  355. #endif
  356. #if EITHER(IS_ULTIPANEL, REPRAPWORLD_KEYPAD)
  357. #define IS_NEWPANEL 1
  358. #endif
  359. #if EITHER(ZONESTAR_LCD, REPRAPWORLD_KEYPAD)
  360. #define IS_RRW_KEYPAD 1
  361. #ifndef REPRAPWORLD_KEYPAD_MOVE_STEP
  362. #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0
  363. #endif
  364. #endif
  365. // Aliases for LCD features
  366. #if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS)
  367. #define HAS_DGUS_LCD_CLASSIC 1
  368. #endif
  369. #if ANY(HAS_DGUS_LCD_CLASSIC, DGUS_LCD_UI_RELOADED)
  370. #define HAS_DGUS_LCD 1
  371. #endif
  372. // Extensible UI serial touch screens. (See src/lcd/extui)
  373. #if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT)
  374. #define IS_EXTUI 1
  375. #define EXTENSIBLE_UI
  376. #endif
  377. // Aliases for LCD features
  378. #if EITHER(DWIN_CREALITY_LCD, DWIN_LCD_PROUI)
  379. #define HAS_DWIN_E3V2_BASIC 1
  380. #endif
  381. #if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
  382. #define HAS_DWIN_E3V2 1
  383. #endif
  384. #if ENABLED(DWIN_LCD_PROUI)
  385. #define DO_LIST_BIN_FILES 1
  386. #endif
  387. // E3V2 extras
  388. #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
  389. #define SERIAL_CATCHALL 0
  390. #define HAS_LCD_BRIGHTNESS 1
  391. #define LCD_BRIGHTNESS_MAX 250
  392. #if ENABLED(DWIN_LCD_PROUI)
  393. #define LCD_BRIGHTNESS_DEFAULT 127
  394. #endif
  395. #endif
  396. #if HAS_WIRED_LCD
  397. #if ENABLED(DOGLCD)
  398. #define HAS_MARLINUI_U8GLIB 1
  399. #elif IS_TFTGLCD_PANEL
  400. // Neither DOGM nor HD44780. Fully customized interface.
  401. #elif IS_DWIN_MARLINUI
  402. // Since HAS_MARLINUI_U8GLIB refers to U8G displays
  403. // the DWIN display can define its own flags
  404. #elif !HAS_GRAPHICAL_TFT
  405. #define HAS_MARLINUI_HD44780 1
  406. #endif
  407. #endif
  408. #if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
  409. #define HAS_DISPLAY 1
  410. #endif
  411. #if HAS_WIRED_LCD && !HAS_GRAPHICAL_TFT && !IS_DWIN_MARLINUI
  412. #define HAS_LCDPRINT 1
  413. #endif
  414. #if ANY(HAS_DISPLAY, HAS_DWIN_E3V2)
  415. #define HAS_STATUS_MESSAGE 1
  416. #endif
  417. #if IS_ULTIPANEL && DISABLED(NO_LCD_MENUS)
  418. #define HAS_MARLINUI_MENU 1
  419. #endif
  420. #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, HAS_DWIN_E3V2)
  421. #define HAS_MANUAL_MOVE_MENU 1
  422. #endif
  423. #if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI, DWIN_CREALITY_LCD_JYERSUI)
  424. #define CAN_SHOW_REMAINING_TIME 1
  425. #endif
  426. #if HAS_MARLINUI_U8GLIB
  427. #ifndef LCD_PIXEL_WIDTH
  428. #define LCD_PIXEL_WIDTH 128
  429. #endif
  430. #ifndef LCD_PIXEL_HEIGHT
  431. #define LCD_PIXEL_HEIGHT 64
  432. #endif
  433. #endif
  434. /**
  435. * Multi-Material-Unit supported models
  436. */
  437. #define PRUSA_MMU1 1
  438. #define PRUSA_MMU2 2
  439. #define PRUSA_MMU2S 3
  440. #define EXTENDABLE_EMU_MMU2 12
  441. #define EXTENDABLE_EMU_MMU2S 13
  442. #ifdef MMU_MODEL
  443. #define HAS_MMU 1
  444. #if MMU_MODEL == PRUSA_MMU1
  445. #define HAS_PRUSA_MMU1 1
  446. #elif MMU_MODEL % 10 == PRUSA_MMU2
  447. #define HAS_PRUSA_MMU2 1
  448. #elif MMU_MODEL % 10 == PRUSA_MMU2S
  449. #define HAS_PRUSA_MMU2 1
  450. #define HAS_PRUSA_MMU2S 1
  451. #endif
  452. #if MMU_MODEL >= EXTENDABLE_EMU_MMU2
  453. #define HAS_EXTENDABLE_MMU 1
  454. #endif
  455. #endif
  456. #undef PRUSA_MMU1
  457. #undef PRUSA_MMU2
  458. #undef PRUSA_MMU2S
  459. #undef EXTENDABLE_EMU_MMU2
  460. #undef EXTENDABLE_EMU_MMU2S
  461. /**
  462. * Extruders have some combination of stepper motors and hotends
  463. * so we separate these concepts into the defines:
  464. *
  465. * EXTRUDERS - Number of Selectable Tools
  466. * HOTENDS - Number of hotends, whether connected or separate
  467. * E_STEPPERS - Number of actual E stepper motors
  468. * E_MANUAL - Number of E steppers for LCD move options
  469. *
  470. * These defines must be simple constants for use in REPEAT, etc.
  471. */
  472. #if EXTRUDERS
  473. #define HAS_EXTRUDERS 1
  474. #if EXTRUDERS > 1
  475. #define HAS_MULTI_EXTRUDER 1
  476. #endif
  477. #define E_AXIS_N(E) AxisEnum(E_AXIS + E_INDEX_N(E))
  478. #else
  479. #undef EXTRUDERS
  480. #define EXTRUDERS 0
  481. #undef SINGLENOZZLE
  482. #undef SWITCHING_EXTRUDER
  483. #undef SWITCHING_NOZZLE
  484. #undef MIXING_EXTRUDER
  485. #undef HOTEND_IDLE_TIMEOUT
  486. #undef DISABLE_E
  487. #endif
  488. #define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N)
  489. #define E_TERN_(N) TERN_(HAS_MULTI_EXTRUDER, N)
  490. #define E_TERN0(N) TERN0(HAS_MULTI_EXTRUDER, N)
  491. #if ENABLED(E_DUAL_STEPPER_DRIVERS) // E0/E1 steppers act in tandem as E0
  492. #define E_STEPPERS 2
  493. #define E_MANUAL 1
  494. #elif ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS
  495. #if EXTRUDERS > 4
  496. #define E_STEPPERS 3
  497. #elif EXTRUDERS > 2
  498. #define E_STEPPERS 2
  499. #else
  500. #define E_STEPPERS 1
  501. #endif
  502. #if DISABLED(SWITCHING_NOZZLE)
  503. #define HOTENDS E_STEPPERS
  504. #endif
  505. #elif ENABLED(MIXING_EXTRUDER) // Multiple feeds are mixed proportionally
  506. #define E_STEPPERS MIXING_STEPPERS
  507. #define E_MANUAL 1
  508. #if MIXING_STEPPERS == 2
  509. #define HAS_DUAL_MIXING 1
  510. #endif
  511. #elif ENABLED(SWITCHING_TOOLHEAD) // Toolchanger
  512. #define E_STEPPERS EXTRUDERS
  513. #define E_MANUAL EXTRUDERS
  514. #elif HAS_PRUSA_MMU2 // Průša Multi-Material Unit v2
  515. #define E_STEPPERS 1
  516. #define E_MANUAL 1
  517. #endif
  518. // No inactive extruders with SWITCHING_NOZZLE or Průša MMU1
  519. #if ENABLED(SWITCHING_NOZZLE) || HAS_PRUSA_MMU1
  520. #undef DISABLE_INACTIVE_EXTRUDER
  521. #endif
  522. // Průša MMU1, MMU(S) 2.0 and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE
  523. #if HAS_MMU
  524. #define SINGLENOZZLE
  525. #endif
  526. #if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset
  527. #undef HOTENDS
  528. #define HOTENDS 1
  529. #undef HOTEND_OFFSET_X
  530. #undef HOTEND_OFFSET_Y
  531. #endif
  532. #ifndef HOTENDS
  533. #define HOTENDS EXTRUDERS
  534. #endif
  535. #ifndef E_STEPPERS
  536. #define E_STEPPERS EXTRUDERS
  537. #endif
  538. #ifndef E_MANUAL
  539. #define E_MANUAL EXTRUDERS
  540. #endif
  541. /**
  542. * Number of Linear Axes (e.g., XYZIJKUVW)
  543. * All the logical axes except for the tool (E) axis
  544. */
  545. #ifdef NUM_AXES
  546. #undef NUM_AXES
  547. #define NUM_AXES_WARNING 1
  548. #endif
  549. #ifdef W_DRIVER_TYPE
  550. #define NUM_AXES 9
  551. #elif defined(V_DRIVER_TYPE)
  552. #define NUM_AXES 8
  553. #elif defined(U_DRIVER_TYPE)
  554. #define NUM_AXES 7
  555. #elif defined(K_DRIVER_TYPE)
  556. #define NUM_AXES 6
  557. #elif defined(J_DRIVER_TYPE)
  558. #define NUM_AXES 5
  559. #elif defined(I_DRIVER_TYPE)
  560. #define NUM_AXES 4
  561. #elif defined(Z_DRIVER_TYPE)
  562. #define NUM_AXES 3
  563. #elif defined(Y_DRIVER_TYPE)
  564. #define NUM_AXES 2
  565. #else
  566. #define NUM_AXES 1
  567. #endif
  568. #if NUM_AXES >= XY
  569. #define HAS_Y_AXIS 1
  570. #if NUM_AXES >= XYZ
  571. #define HAS_Z_AXIS 1
  572. #ifdef Z4_DRIVER_TYPE
  573. #define NUM_Z_STEPPERS 4
  574. #elif defined(Z3_DRIVER_TYPE)
  575. #define NUM_Z_STEPPERS 3
  576. #elif defined(Z2_DRIVER_TYPE)
  577. #define NUM_Z_STEPPERS 2
  578. #else
  579. #define NUM_Z_STEPPERS 1
  580. #endif
  581. #if NUM_AXES >= 4
  582. #define HAS_I_AXIS 1
  583. #if NUM_AXES >= 5
  584. #define HAS_J_AXIS 1
  585. #if NUM_AXES >= 6
  586. #define HAS_K_AXIS 1
  587. #if NUM_AXES >= 7
  588. #define HAS_U_AXIS 1
  589. #if NUM_AXES >= 8
  590. #define HAS_V_AXIS 1
  591. #if NUM_AXES >= 9
  592. #define HAS_W_AXIS 1
  593. #endif
  594. #endif
  595. #endif
  596. #endif
  597. #endif
  598. #endif
  599. #endif
  600. #endif
  601. #if E_STEPPERS <= 0
  602. #undef E0_DRIVER_TYPE
  603. #endif
  604. #if E_STEPPERS <= 1
  605. #undef E1_DRIVER_TYPE
  606. #endif
  607. #if E_STEPPERS <= 2
  608. #undef E2_DRIVER_TYPE
  609. #endif
  610. #if E_STEPPERS <= 3
  611. #undef E3_DRIVER_TYPE
  612. #endif
  613. #if E_STEPPERS <= 4
  614. #undef E4_DRIVER_TYPE
  615. #endif
  616. #if E_STEPPERS <= 5
  617. #undef E5_DRIVER_TYPE
  618. #endif
  619. #if E_STEPPERS <= 6
  620. #undef E6_DRIVER_TYPE
  621. #endif
  622. #if E_STEPPERS <= 7
  623. #undef E7_DRIVER_TYPE
  624. #endif
  625. #if !HAS_Y_AXIS
  626. #undef ENDSTOPPULLUP_YMIN
  627. #undef ENDSTOPPULLUP_YMAX
  628. #undef Y_MIN_ENDSTOP_INVERTING
  629. #undef Y_MAX_ENDSTOP_INVERTING
  630. #undef Y2_DRIVER_TYPE
  631. #undef Y_ENABLE_ON
  632. #undef DISABLE_Y
  633. #undef INVERT_Y_DIR
  634. #undef Y_HOME_DIR
  635. #undef Y_MIN_POS
  636. #undef Y_MAX_POS
  637. #undef MANUAL_Y_HOME_POS
  638. #endif
  639. #if !HAS_Z_AXIS
  640. #undef ENDSTOPPULLUP_ZMIN
  641. #undef ENDSTOPPULLUP_ZMAX
  642. #undef Z_MIN_ENDSTOP_INVERTING
  643. #undef Z_MAX_ENDSTOP_INVERTING
  644. #undef Z2_DRIVER_TYPE
  645. #undef Z3_DRIVER_TYPE
  646. #undef Z4_DRIVER_TYPE
  647. #undef Z_ENABLE_ON
  648. #undef DISABLE_Z
  649. #undef INVERT_Z_DIR
  650. #undef Z_HOME_DIR
  651. #undef Z_MIN_POS
  652. #undef Z_MAX_POS
  653. #undef MANUAL_Z_HOME_POS
  654. #endif
  655. #if !HAS_I_AXIS
  656. #undef ENDSTOPPULLUP_IMIN
  657. #undef ENDSTOPPULLUP_IMAX
  658. #undef I_MIN_ENDSTOP_INVERTING
  659. #undef I_MAX_ENDSTOP_INVERTING
  660. #undef I_ENABLE_ON
  661. #undef DISABLE_I
  662. #undef INVERT_I_DIR
  663. #undef I_HOME_DIR
  664. #undef I_MIN_POS
  665. #undef I_MAX_POS
  666. #undef MANUAL_I_HOME_POS
  667. #endif
  668. #if !HAS_J_AXIS
  669. #undef ENDSTOPPULLUP_JMIN
  670. #undef ENDSTOPPULLUP_JMAX
  671. #undef J_MIN_ENDSTOP_INVERTING
  672. #undef J_MAX_ENDSTOP_INVERTING
  673. #undef J_ENABLE_ON
  674. #undef DISABLE_J
  675. #undef INVERT_J_DIR
  676. #undef J_HOME_DIR
  677. #undef J_MIN_POS
  678. #undef J_MAX_POS
  679. #undef MANUAL_J_HOME_POS
  680. #endif
  681. #if !HAS_K_AXIS
  682. #undef ENDSTOPPULLUP_KMIN
  683. #undef ENDSTOPPULLUP_KMAX
  684. #undef K_MIN_ENDSTOP_INVERTING
  685. #undef K_MAX_ENDSTOP_INVERTING
  686. #undef K_ENABLE_ON
  687. #undef DISABLE_K
  688. #undef INVERT_K_DIR
  689. #undef K_HOME_DIR
  690. #undef K_MIN_POS
  691. #undef K_MAX_POS
  692. #undef MANUAL_K_HOME_POS
  693. #endif
  694. #if !HAS_U_AXIS
  695. #undef ENDSTOPPULLUP_UMIN
  696. #undef ENDSTOPPULLUP_UMAX
  697. #undef U_MIN_ENDSTOP_INVERTING
  698. #undef U_MAX_ENDSTOP_INVERTING
  699. #undef U_ENABLE_ON
  700. #undef DISABLE_U
  701. #undef INVERT_U_DIR
  702. #undef U_HOME_DIR
  703. #undef U_MIN_POS
  704. #undef U_MAX_POS
  705. #undef MANUAL_U_HOME_POS
  706. #endif
  707. #if !HAS_V_AXIS
  708. #undef ENDSTOPPULLUP_VMIN
  709. #undef ENDSTOPPULLUP_VMAX
  710. #undef V_MIN_ENDSTOP_INVERTING
  711. #undef V_MAX_ENDSTOP_INVERTING
  712. #undef V_ENABLE_ON
  713. #undef DISABLE_V
  714. #undef INVERT_V_DIR
  715. #undef V_HOME_DIR
  716. #undef V_MIN_POS
  717. #undef V_MAX_POS
  718. #undef MANUAL_V_HOME_POS
  719. #endif
  720. #if !HAS_W_AXIS
  721. #undef ENDSTOPPULLUP_WMIN
  722. #undef ENDSTOPPULLUP_WMAX
  723. #undef W_MIN_ENDSTOP_INVERTING
  724. #undef W_MAX_ENDSTOP_INVERTING
  725. #undef W_ENABLE_ON
  726. #undef DISABLE_W
  727. #undef INVERT_W_DIR
  728. #undef W_HOME_DIR
  729. #undef W_MIN_POS
  730. #undef W_MAX_POS
  731. #undef MANUAL_W_HOME_POS
  732. #endif
  733. #ifdef X2_DRIVER_TYPE
  734. #define HAS_X2_STEPPER 1
  735. // Dual X Carriage isn't known yet. TODO: Consider moving it to Configuration.h.
  736. #endif
  737. #ifdef Y2_DRIVER_TYPE
  738. #define HAS_Y2_STEPPER 1
  739. #define HAS_DUAL_Y_STEPPERS 1
  740. #endif
  741. /**
  742. * Number of Primary Linear Axes (e.g., XYZ)
  743. * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2. Z2. Z3, Z4)
  744. */
  745. #if NUM_AXES >= 3
  746. #define PRIMARY_LINEAR_AXES 3
  747. #else
  748. #define PRIMARY_LINEAR_AXES NUM_AXES
  749. #endif
  750. /**
  751. * Number of Secondary Axes (e.g., IJKUVW)
  752. * All linear/rotational axes between XYZ and E.
  753. */
  754. #define SECONDARY_AXES SUB3(NUM_AXES)
  755. /**
  756. * Number of Rotational Axes (e.g., IJK)
  757. * All axes for which AXIS*_ROTATES is defined.
  758. * For these axes, positions are specified in angular degrees.
  759. */
  760. #if ENABLED(AXIS9_ROTATES)
  761. #define ROTATIONAL_AXES 6
  762. #elif ENABLED(AXIS8_ROTATES)
  763. #define ROTATIONAL_AXES 5
  764. #elif ENABLED(AXIS7_ROTATES)
  765. #define ROTATIONAL_AXES 4
  766. #elif ENABLED(AXIS6_ROTATES)
  767. #define ROTATIONAL_AXES 3
  768. #elif ENABLED(AXIS5_ROTATES)
  769. #define ROTATIONAL_AXES 2
  770. #elif ENABLED(AXIS4_ROTATES)
  771. #define ROTATIONAL_AXES 1
  772. #else
  773. #define ROTATIONAL_AXES 0
  774. #endif
  775. /**
  776. * Number of Secondary Linear Axes (e.g., UVW)
  777. * All secondary axes for which AXIS*_ROTATES is not defined.
  778. * Excluding primary axes and excluding duplicate axes (X2, Y2, Z2, Z3, Z4)
  779. */
  780. #define SECONDARY_LINEAR_AXES (NUM_AXES - PRIMARY_LINEAR_AXES - ROTATIONAL_AXES)
  781. /**
  782. * Number of Logical Axes (e.g., XYZIJKUVWE)
  783. * All logical axes that can be commanded directly by G-code.
  784. * Delta maps stepper-specific values to ABC steppers.
  785. */
  786. #if HAS_EXTRUDERS
  787. #define LOGICAL_AXES INCREMENT(NUM_AXES)
  788. #else
  789. #define LOGICAL_AXES NUM_AXES
  790. #endif
  791. /**
  792. * DISTINCT_E_FACTORS is set to give extruders (some) individual settings.
  793. *
  794. * DISTINCT_AXES is the number of distinct addressable axes (not steppers).
  795. * Includes all linear axes plus all distinguished extruders.
  796. * The default behavior is to treat all extruders as a single E axis
  797. * with shared motion and temperature settings.
  798. *
  799. * DISTINCT_E is the number of distinguished extruders. By default this
  800. * well be 1 which indicates all extruders share the same settings.
  801. *
  802. * E_INDEX_N(E) should be used to get the E index of any item that might be
  803. * distinguished.
  804. */
  805. #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
  806. #define DISTINCT_AXES (NUM_AXES + E_STEPPERS)
  807. #define DISTINCT_E E_STEPPERS
  808. #define E_INDEX_N(E) (E)
  809. #else
  810. #undef DISTINCT_E_FACTORS
  811. #define DISTINCT_AXES LOGICAL_AXES
  812. #define DISTINCT_E 1
  813. #define E_INDEX_N(E) 0
  814. #endif
  815. #if HOTENDS
  816. #define HAS_HOTEND 1
  817. #ifndef HOTEND_OVERSHOOT
  818. #define HOTEND_OVERSHOOT 15
  819. #endif
  820. #if HOTENDS > 1
  821. #define HAS_MULTI_HOTEND 1
  822. #define HAS_HOTEND_OFFSET 1
  823. #endif
  824. #else
  825. #undef PID_PARAMS_PER_HOTEND
  826. #endif
  827. // Helper macros for extruder and hotend arrays
  828. #define EXTRUDER_LOOP() for (int8_t e = 0; e < EXTRUDERS; e++)
  829. #define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
  830. #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V)
  831. #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1)
  832. #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)
  833. #define ARRAY_BY_HOTENDS1(v1) ARRAY_N_1(HOTENDS, v1)
  834. /**
  835. * Default hotend offsets, if not defined
  836. */
  837. #if HAS_HOTEND_OFFSET
  838. #ifndef HOTEND_OFFSET_X
  839. #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
  840. #endif
  841. #ifndef HOTEND_OFFSET_Y
  842. #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
  843. #endif
  844. #ifndef HOTEND_OFFSET_Z
  845. #define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder
  846. #endif
  847. #endif
  848. /**
  849. * Disable unused SINGLENOZZLE sub-options
  850. */
  851. #if DISABLED(SINGLENOZZLE)
  852. #undef SINGLENOZZLE_STANDBY_TEMP
  853. #endif
  854. #if !BOTH(HAS_FAN, SINGLENOZZLE)
  855. #undef SINGLENOZZLE_STANDBY_FAN
  856. #endif
  857. // Switching extruder has its own servo?
  858. #if ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR)
  859. #define DO_SWITCH_EXTRUDER 1
  860. #endif
  861. /**
  862. * The BLTouch Probe emulates a servo probe
  863. * and uses "special" angles for its state.
  864. */
  865. #if ENABLED(BLTOUCH)
  866. #ifndef Z_PROBE_SERVO_NR
  867. #define Z_PROBE_SERVO_NR 0
  868. #endif
  869. #ifdef DEACTIVATE_SERVOS_AFTER_MOVE
  870. #error "BLTOUCH requires DEACTIVATE_SERVOS_AFTER_MOVE to be to disabled. Please update your Configuration.h file."
  871. #endif
  872. // Always disable probe pin inverting for BLTouch
  873. #if Z_MIN_PROBE_ENDSTOP_INVERTING
  874. #error "BLTOUCH requires Z_MIN_PROBE_ENDSTOP_INVERTING set to false. Please update your Configuration.h file."
  875. #endif
  876. #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  877. #if Z_MIN_ENDSTOP_INVERTING
  878. #error "BLTOUCH requires Z_MIN_ENDSTOP_INVERTING set to false. Please update your Configuration.h file."
  879. #endif
  880. #endif
  881. #endif
  882. /**
  883. * Set a flag for a servo probe (or BLTouch)
  884. */
  885. #ifdef Z_PROBE_SERVO_NR
  886. #define HAS_Z_SERVO_PROBE 1
  887. #endif
  888. #if ANY(HAS_Z_SERVO_PROBE, SWITCHING_EXTRUDER, SWITCHING_NOZZLE)
  889. #define HAS_SERVO_ANGLES 1
  890. #endif
  891. #if !HAS_SERVO_ANGLES
  892. #undef EDITABLE_SERVO_ANGLES
  893. #endif
  894. /**
  895. * Set a flag for any type of bed probe, including the paper-test
  896. */
  897. #if ANY(HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE, MAGLEV4)
  898. #define HAS_BED_PROBE 1
  899. #endif
  900. /**
  901. * Fill in undefined Filament Sensor options
  902. */
  903. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  904. #if NUM_RUNOUT_SENSORS >= 1
  905. #ifndef FIL_RUNOUT1_STATE
  906. #define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
  907. #endif
  908. #ifndef FIL_RUNOUT1_PULLUP
  909. #define FIL_RUNOUT1_PULLUP FIL_RUNOUT_PULLUP
  910. #endif
  911. #ifndef FIL_RUNOUT1_PULLDOWN
  912. #define FIL_RUNOUT1_PULLDOWN FIL_RUNOUT_PULLDOWN
  913. #endif
  914. #endif
  915. #if NUM_RUNOUT_SENSORS >= 2
  916. #ifndef FIL_RUNOUT2_STATE
  917. #define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
  918. #endif
  919. #ifndef FIL_RUNOUT2_PULLUP
  920. #define FIL_RUNOUT2_PULLUP FIL_RUNOUT_PULLUP
  921. #endif
  922. #ifndef FIL_RUNOUT2_PULLDOWN
  923. #define FIL_RUNOUT2_PULLDOWN FIL_RUNOUT_PULLDOWN
  924. #endif
  925. #endif
  926. #if NUM_RUNOUT_SENSORS >= 3
  927. #ifndef FIL_RUNOUT3_STATE
  928. #define FIL_RUNOUT3_STATE FIL_RUNOUT_STATE
  929. #endif
  930. #ifndef FIL_RUNOUT3_PULLUP
  931. #define FIL_RUNOUT3_PULLUP FIL_RUNOUT_PULLUP
  932. #endif
  933. #ifndef FIL_RUNOUT3_PULLDOWN
  934. #define FIL_RUNOUT3_PULLDOWN FIL_RUNOUT_PULLDOWN
  935. #endif
  936. #endif
  937. #if NUM_RUNOUT_SENSORS >= 4
  938. #ifndef FIL_RUNOUT4_STATE
  939. #define FIL_RUNOUT4_STATE FIL_RUNOUT_STATE
  940. #endif
  941. #ifndef FIL_RUNOUT4_PULLUP
  942. #define FIL_RUNOUT4_PULLUP FIL_RUNOUT_PULLUP
  943. #endif
  944. #ifndef FIL_RUNOUT4_PULLDOWN
  945. #define FIL_RUNOUT4_PULLDOWN FIL_RUNOUT_PULLDOWN
  946. #endif
  947. #endif
  948. #if NUM_RUNOUT_SENSORS >= 5
  949. #ifndef FIL_RUNOUT5_STATE
  950. #define FIL_RUNOUT5_STATE FIL_RUNOUT_STATE
  951. #endif
  952. #ifndef FIL_RUNOUT5_PULLUP
  953. #define FIL_RUNOUT5_PULLUP FIL_RUNOUT_PULLUP
  954. #endif
  955. #ifndef FIL_RUNOUT5_PULLDOWN
  956. #define FIL_RUNOUT5_PULLDOWN FIL_RUNOUT_PULLDOWN
  957. #endif
  958. #endif
  959. #if NUM_RUNOUT_SENSORS >= 6
  960. #ifndef FIL_RUNOUT6_STATE
  961. #define FIL_RUNOUT6_STATE FIL_RUNOUT_STATE
  962. #endif
  963. #ifndef FIL_RUNOUT6_PULLUP
  964. #define FIL_RUNOUT6_PULLUP FIL_RUNOUT_PULLUP
  965. #endif
  966. #ifndef FIL_RUNOUT6_PULLDOWN
  967. #define FIL_RUNOUT6_PULLDOWN FIL_RUNOUT_PULLDOWN
  968. #endif
  969. #endif
  970. #if NUM_RUNOUT_SENSORS >= 7
  971. #ifndef FIL_RUNOUT7_STATE
  972. #define FIL_RUNOUT7_STATE FIL_RUNOUT_STATE
  973. #endif
  974. #ifndef FIL_RUNOUT7_PULLUP
  975. #define FIL_RUNOUT7_PULLUP FIL_RUNOUT_PULLUP
  976. #endif
  977. #ifndef FIL_RUNOUT7_PULLDOWN
  978. #define FIL_RUNOUT7_PULLDOWN FIL_RUNOUT_PULLDOWN
  979. #endif
  980. #endif
  981. #if NUM_RUNOUT_SENSORS >= 8
  982. #ifndef FIL_RUNOUT8_STATE
  983. #define FIL_RUNOUT8_STATE FIL_RUNOUT_STATE
  984. #endif
  985. #ifndef FIL_RUNOUT8_PULLUP
  986. #define FIL_RUNOUT8_PULLUP FIL_RUNOUT_PULLUP
  987. #endif
  988. #ifndef FIL_RUNOUT8_PULLDOWN
  989. #define FIL_RUNOUT8_PULLDOWN FIL_RUNOUT_PULLDOWN
  990. #endif
  991. #endif
  992. #endif // FILAMENT_RUNOUT_SENSOR
  993. // Homing to Min or Max
  994. #if X_HOME_DIR > 0
  995. #define X_HOME_TO_MAX 1
  996. #elif X_HOME_DIR < 0
  997. #define X_HOME_TO_MIN 1
  998. #endif
  999. #if Y_HOME_DIR > 0
  1000. #define Y_HOME_TO_MAX 1
  1001. #elif Y_HOME_DIR < 0
  1002. #define Y_HOME_TO_MIN 1
  1003. #endif
  1004. #if Z_HOME_DIR > 0
  1005. #define Z_HOME_TO_MAX 1
  1006. #elif Z_HOME_DIR < 0
  1007. #define Z_HOME_TO_MIN 1
  1008. #endif
  1009. #if I_HOME_DIR > 0
  1010. #define I_HOME_TO_MAX 1
  1011. #elif I_HOME_DIR < 0
  1012. #define I_HOME_TO_MIN 1
  1013. #endif
  1014. #if J_HOME_DIR > 0
  1015. #define J_HOME_TO_MAX 1
  1016. #elif J_HOME_DIR < 0
  1017. #define J_HOME_TO_MIN 1
  1018. #endif
  1019. #if K_HOME_DIR > 0
  1020. #define K_HOME_TO_MAX 1
  1021. #elif K_HOME_DIR < 0
  1022. #define K_HOME_TO_MIN 1
  1023. #endif
  1024. #if U_HOME_DIR > 0
  1025. #define U_HOME_TO_MAX 1
  1026. #elif U_HOME_DIR < 0
  1027. #define U_HOME_TO_MIN 1
  1028. #endif
  1029. #if V_HOME_DIR > 0
  1030. #define V_HOME_TO_MAX 1
  1031. #elif V_HOME_DIR < 0
  1032. #define V_HOME_TO_MIN 1
  1033. #endif
  1034. #if W_HOME_DIR > 0
  1035. #define W_HOME_TO_MAX 1
  1036. #elif W_HOME_DIR < 0
  1037. #define W_HOME_TO_MIN 1
  1038. #endif
  1039. /**
  1040. * Conditionals based on the type of Bed Probe
  1041. */
  1042. #if HAS_BED_PROBE
  1043. #if DISABLED(NOZZLE_AS_PROBE)
  1044. #define HAS_PROBE_XY_OFFSET 1
  1045. #endif
  1046. #if BOTH(DELTA, SENSORLESS_PROBING)
  1047. #define HAS_DELTA_SENSORLESS_PROBING 1
  1048. #endif
  1049. #if NONE(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING)
  1050. #define USES_Z_MIN_PROBE_PIN 1
  1051. #endif
  1052. #if Z_HOME_TO_MIN && TERN1(USES_Z_MIN_PROBE_PIN, ENABLED(USE_PROBE_FOR_Z_HOMING))
  1053. #define HOMING_Z_WITH_PROBE 1
  1054. #endif
  1055. #ifndef Z_PROBE_LOW_POINT
  1056. #define Z_PROBE_LOW_POINT -5
  1057. #endif
  1058. #if ENABLED(Z_PROBE_ALLEN_KEY)
  1059. #define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
  1060. #endif
  1061. #if MULTIPLE_PROBING > 1
  1062. #if EXTRA_PROBING > 0
  1063. #define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
  1064. #else
  1065. #define TOTAL_PROBING MULTIPLE_PROBING
  1066. #endif
  1067. #endif
  1068. #else
  1069. // Clear probe pin settings when no probe is selected
  1070. #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
  1071. #undef USE_PROBE_FOR_Z_HOMING
  1072. #endif
  1073. #if ENABLED(BELTPRINTER) && !defined(HOME_Y_BEFORE_X)
  1074. #define HOME_Y_BEFORE_X
  1075. #endif
  1076. #if Z_HOME_TO_MAX && DISABLED(Z_SAFE_HOMING)
  1077. #define HOME_Z_FIRST // If homing away from BED do Z first
  1078. #endif
  1079. /**
  1080. * Conditionals based on the type of Bed Leveling
  1081. */
  1082. #if ENABLED(AUTO_BED_LEVELING_UBL)
  1083. #undef LCD_BED_LEVELING
  1084. #if ENABLED(DELTA)
  1085. #define UBL_SEGMENTED 1
  1086. #endif
  1087. #endif
  1088. #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
  1089. #define ABL_PLANAR 1
  1090. #endif
  1091. #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
  1092. #define ABL_USES_GRID 1
  1093. #endif
  1094. #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT)
  1095. #define HAS_ABL_NOT_UBL 1
  1096. #endif
  1097. #if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
  1098. #define HAS_MESH 1
  1099. #endif
  1100. #if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
  1101. #define NEEDS_THREE_PROBE_POINTS 1
  1102. #endif
  1103. #if EITHER(HAS_ABL_NOT_UBL, AUTO_BED_LEVELING_UBL)
  1104. #define HAS_ABL_OR_UBL 1
  1105. #if DISABLED(PROBE_MANUALLY)
  1106. #define HAS_AUTOLEVEL 1
  1107. #endif
  1108. #endif
  1109. #if EITHER(HAS_ABL_OR_UBL, MESH_BED_LEVELING)
  1110. #define HAS_LEVELING 1
  1111. #if DISABLED(AUTO_BED_LEVELING_UBL)
  1112. #define PLANNER_LEVELING 1
  1113. #endif
  1114. #endif
  1115. #if !HAS_LEVELING
  1116. #undef RESTORE_LEVELING_AFTER_G28
  1117. #undef ENABLE_LEVELING_AFTER_G28
  1118. #undef G29_RETRY_AND_RECOVER
  1119. #endif
  1120. #if !HAS_LEVELING || EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
  1121. #undef PROBE_MANUALLY
  1122. #endif
  1123. #if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
  1124. #define PROBE_SELECTED 1
  1125. #endif
  1126. #ifdef GRID_MAX_POINTS_X
  1127. #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
  1128. #define GRID_LOOP(A,B) LOOP_L_N(A, GRID_MAX_POINTS_X) LOOP_L_N(B, GRID_MAX_POINTS_Y)
  1129. #endif
  1130. // Slim menu optimizations
  1131. #if ENABLED(SLIM_LCD_MENUS)
  1132. #define BOOT_MARLIN_LOGO_SMALL
  1133. #endif
  1134. /**
  1135. * CoreXY, CoreXZ, and CoreYZ - and their reverse
  1136. */
  1137. #if EITHER(COREXY, COREYX)
  1138. #define CORE_IS_XY 1
  1139. #endif
  1140. #if EITHER(COREXZ, COREZX)
  1141. #define CORE_IS_XZ 1
  1142. #endif
  1143. #if EITHER(COREYZ, COREZY)
  1144. #define CORE_IS_YZ 1
  1145. #endif
  1146. #if CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ
  1147. #define IS_CORE 1
  1148. #endif
  1149. #if IS_CORE
  1150. #if CORE_IS_XY
  1151. #define CORE_AXIS_1 A_AXIS
  1152. #define CORE_AXIS_2 B_AXIS
  1153. #define NORMAL_AXIS Z_AXIS
  1154. #elif CORE_IS_XZ
  1155. #define CORE_AXIS_1 A_AXIS
  1156. #define NORMAL_AXIS Y_AXIS
  1157. #define CORE_AXIS_2 C_AXIS
  1158. #elif CORE_IS_YZ
  1159. #define NORMAL_AXIS X_AXIS
  1160. #define CORE_AXIS_1 B_AXIS
  1161. #define CORE_AXIS_2 C_AXIS
  1162. #endif
  1163. #define CORESIGN(n) (ANY(COREYX, COREZX, COREZY) ? (-(n)) : (n))
  1164. #elif EITHER(MARKFORGED_XY, MARKFORGED_YX)
  1165. // Markforged kinematics
  1166. #define CORE_AXIS_1 A_AXIS
  1167. #define CORE_AXIS_2 B_AXIS
  1168. #define NORMAL_AXIS Z_AXIS
  1169. #endif
  1170. #if ANY(MORGAN_SCARA, MP_SCARA, AXEL_TPARA)
  1171. #define IS_SCARA 1
  1172. #define IS_KINEMATIC 1
  1173. #elif EITHER(DELTA, POLARGRAPH)
  1174. #define IS_KINEMATIC 1
  1175. #else
  1176. #define IS_CARTESIAN 1
  1177. #if !IS_CORE
  1178. #define IS_FULL_CARTESIAN 1
  1179. #endif
  1180. #endif
  1181. #if DISABLED(DELTA)
  1182. #undef DELTA_HOME_TO_SAFE_ZONE
  1183. #endif
  1184. // This flag indicates some kind of jerk storage is needed
  1185. #if EITHER(CLASSIC_JERK, IS_KINEMATIC)
  1186. #define HAS_CLASSIC_JERK 1
  1187. #endif
  1188. #if DISABLED(CLASSIC_JERK)
  1189. #define HAS_JUNCTION_DEVIATION 1
  1190. #endif
  1191. // E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA
  1192. #if HAS_EXTRUDERS && (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE)))
  1193. #define HAS_CLASSIC_E_JERK 1
  1194. #endif
  1195. //
  1196. // Serial Port Info
  1197. //
  1198. #ifdef SERIAL_PORT_2
  1199. #define HAS_MULTI_SERIAL 1
  1200. #ifdef SERIAL_PORT_3
  1201. #define NUM_SERIAL 3
  1202. #else
  1203. #define NUM_SERIAL 2
  1204. #endif
  1205. #elif defined(SERIAL_PORT)
  1206. #define NUM_SERIAL 1
  1207. #else
  1208. #define NUM_SERIAL 0
  1209. #undef BAUD_RATE_GCODE
  1210. #endif
  1211. #if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1 || SERIAL_PORT_3 == -1
  1212. #define HAS_USB_SERIAL 1
  1213. #endif
  1214. #if SERIAL_PORT_2 == -2
  1215. #define HAS_ETHERNET 1
  1216. #endif
  1217. /**
  1218. * This setting is also used by M109 when trying to calculate
  1219. * a ballpark safe margin to prevent wait-forever situation.
  1220. */
  1221. #ifndef EXTRUDE_MINTEMP
  1222. #define EXTRUDE_MINTEMP 170
  1223. #endif
  1224. /**
  1225. * TFT Displays
  1226. *
  1227. * Configure parameters for TFT displays:
  1228. * - TFT_DEFAULT_ORIENTATION
  1229. * - TFT_DRIVER
  1230. * - TFT_WIDTH
  1231. * - TFT_HEIGHT
  1232. * - TFT_INTERFACE_(SPI|FSMC)
  1233. * - TFT_COLOR
  1234. * - GRAPHICAL_TFT_UPSCALE
  1235. */
  1236. #if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) // ST7796
  1237. #define TFT_DEFAULT_DRIVER ST7796
  1238. #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY
  1239. #define TFT_RES_480x320
  1240. #define TFT_INTERFACE_SPI
  1241. #elif EITHER(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796
  1242. #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY
  1243. #define TFT_RES_480x320
  1244. #define TFT_INTERFACE_FSMC
  1245. #elif ANY(ANET_ET4_TFT28, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32) // ST7789
  1246. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
  1247. #define TFT_RES_320x240
  1248. #define TFT_INTERFACE_FSMC
  1249. #elif ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488
  1250. #define TFT_DRIVER ILI9488
  1251. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  1252. #define TFT_RES_480x320
  1253. #define TFT_INTERFACE_FSMC
  1254. #elif ENABLED(MKS_ROBIN_TFT43)
  1255. #define TFT_DRIVER SSD1963
  1256. #define TFT_DEFAULT_ORIENTATION 0
  1257. #define TFT_RES_480x272
  1258. #define TFT_INTERFACE_FSMC
  1259. #elif ANY(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505
  1260. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  1261. #define TFT_RES_320x240
  1262. #define TFT_INTERFACE_FSMC
  1263. #elif ENABLED(BIQU_BX_TFT70) // RGB
  1264. #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY
  1265. #define TFT_RES_1024x600
  1266. #define TFT_INTERFACE_LTDC
  1267. #if ENABLED(TOUCH_SCREEN)
  1268. #define TFT_TOUCH_DEVICE_GT911
  1269. #endif
  1270. #elif ENABLED(TFT_GENERIC)
  1271. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  1272. #if NONE(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
  1273. #define TFT_RES_320x240
  1274. #endif
  1275. #if NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
  1276. #define TFT_INTERFACE_SPI
  1277. #endif
  1278. #endif
  1279. #if ENABLED(TFT_RES_320x240)
  1280. #define TFT_WIDTH 320
  1281. #define TFT_HEIGHT 240
  1282. #define GRAPHICAL_TFT_UPSCALE 2
  1283. #elif ENABLED(TFT_RES_480x272)
  1284. #define TFT_WIDTH 480
  1285. #define TFT_HEIGHT 272
  1286. #define GRAPHICAL_TFT_UPSCALE 2
  1287. #elif ENABLED(TFT_RES_480x320)
  1288. #define TFT_WIDTH 480
  1289. #define TFT_HEIGHT 320
  1290. #define GRAPHICAL_TFT_UPSCALE 3
  1291. #elif ENABLED(TFT_RES_1024x600)
  1292. #define TFT_WIDTH 1024
  1293. #define TFT_HEIGHT 600
  1294. #define GRAPHICAL_TFT_UPSCALE 4
  1295. #endif
  1296. // FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi|ltdc).h
  1297. #if ENABLED(TFT_INTERFACE_FSMC)
  1298. #define HAS_FSMC_TFT 1
  1299. #if TFT_SCALED_DOGLCD
  1300. #define HAS_FSMC_GRAPHICAL_TFT 1
  1301. #elif HAS_TFT_LVGL_UI
  1302. #define HAS_TFT_LVGL_UI_FSMC 1
  1303. #endif
  1304. #elif ENABLED(TFT_INTERFACE_SPI)
  1305. #define HAS_SPI_TFT 1
  1306. #if TFT_SCALED_DOGLCD
  1307. #define HAS_SPI_GRAPHICAL_TFT 1
  1308. #elif HAS_TFT_LVGL_UI
  1309. #define HAS_TFT_LVGL_UI_SPI 1
  1310. #endif
  1311. #elif ENABLED(TFT_INTERFACE_LTDC)
  1312. #define HAS_LTDC_TFT 1
  1313. #if TFT_SCALED_DOGLCD
  1314. #define HAS_LTDC_GRAPHICAL_TFT 1
  1315. #elif HAS_TFT_LVGL_UI
  1316. #define HAS_TFT_LVGL_UI_LTDC 1
  1317. #endif
  1318. #endif
  1319. #if ENABLED(TFT_COLOR_UI)
  1320. #if TFT_HEIGHT == 240
  1321. #if ENABLED(TFT_INTERFACE_SPI)
  1322. #define TFT_320x240_SPI
  1323. #elif ENABLED(TFT_INTERFACE_FSMC)
  1324. #define TFT_320x240
  1325. #endif
  1326. #elif TFT_HEIGHT == 320
  1327. #if ENABLED(TFT_INTERFACE_SPI)
  1328. #define TFT_480x320_SPI
  1329. #elif ENABLED(TFT_INTERFACE_FSMC)
  1330. #define TFT_480x320
  1331. #endif
  1332. #elif TFT_HEIGHT == 272
  1333. #if ENABLED(TFT_INTERFACE_SPI)
  1334. #define TFT_480x272_SPI
  1335. #elif ENABLED(TFT_INTERFACE_FSMC)
  1336. #define TFT_480x272
  1337. #endif
  1338. #elif TFT_HEIGHT == 600
  1339. #if ENABLED(TFT_INTERFACE_LTDC)
  1340. #define TFT_1024x600_LTDC
  1341. #endif
  1342. #endif
  1343. #endif
  1344. #if EITHER(TFT_320x240, TFT_320x240_SPI)
  1345. #define HAS_UI_320x240 1
  1346. #elif EITHER(TFT_480x320, TFT_480x320_SPI)
  1347. #define HAS_UI_480x320 1
  1348. #elif EITHER(TFT_480x272, TFT_480x272_SPI)
  1349. #define HAS_UI_480x272 1
  1350. #elif defined(TFT_1024x600_LTDC)
  1351. #define HAS_UI_1024x600 1
  1352. #endif
  1353. #if ANY(HAS_UI_320x240, HAS_UI_480x320, HAS_UI_480x272)
  1354. #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen
  1355. #elif HAS_UI_1024x600
  1356. #define LCD_HEIGHT TERN(TOUCH_SCREEN, 12, 13) // Fewer lines with touch buttons onscreen
  1357. #endif
  1358. // This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
  1359. #if ENABLED(TOUCH_SCREEN)
  1360. #if TOUCH_IDLE_SLEEP
  1361. #define HAS_TOUCH_SLEEP 1
  1362. #endif
  1363. #if NONE(TFT_TOUCH_DEVICE_GT911, TFT_TOUCH_DEVICE_XPT2046)
  1364. #define TFT_TOUCH_DEVICE_XPT2046 // ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8
  1365. #endif
  1366. #if ENABLED(TFT_TOUCH_DEVICE_GT911) // GT911 Capacitive touch screen such as BIQU_BX_TFT70
  1367. #undef TOUCH_SCREEN_CALIBRATION
  1368. #undef TOUCH_CALIBRATION_AUTO_SAVE
  1369. #endif
  1370. #if !HAS_GRAPHICAL_TFT
  1371. #undef TOUCH_SCREEN
  1372. #if ENABLED(TFT_CLASSIC_UI)
  1373. #define HAS_TOUCH_BUTTONS 1
  1374. #if ENABLED(TFT_TOUCH_DEVICE_GT911)
  1375. #define HAS_CAP_TOUCH_BUTTONS 1
  1376. #else
  1377. #define HAS_RES_TOUCH_BUTTONS 1
  1378. #endif
  1379. #endif
  1380. #endif
  1381. #endif
  1382. // XPT2046_** Compatibility
  1383. #if !(defined(TOUCH_CALIBRATION_X) || defined(TOUCH_CALIBRATION_Y) || defined(TOUCH_OFFSET_X) || defined(TOUCH_OFFSET_Y) || defined(TOUCH_ORIENTATION))
  1384. #if defined(XPT2046_X_CALIBRATION) && defined(XPT2046_Y_CALIBRATION) && defined(XPT2046_X_OFFSET) && defined(XPT2046_Y_OFFSET)
  1385. #define TOUCH_CALIBRATION_X XPT2046_X_CALIBRATION
  1386. #define TOUCH_CALIBRATION_Y XPT2046_Y_CALIBRATION
  1387. #define TOUCH_OFFSET_X XPT2046_X_OFFSET
  1388. #define TOUCH_OFFSET_Y XPT2046_Y_OFFSET
  1389. #define TOUCH_ORIENTATION TOUCH_LANDSCAPE
  1390. #endif
  1391. #endif
  1392. #if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) || (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR)
  1393. #define HAS_ENDSTOPS 1
  1394. #define COORDINATE_OKAY(N,L,H) WITHIN(N,L,H)
  1395. #else
  1396. #define COORDINATE_OKAY(N,L,H) true
  1397. #endif
  1398. /**
  1399. * LED Backlight INDEX END
  1400. */
  1401. #if defined(NEOPIXEL_BKGD_INDEX_FIRST) && !defined(NEOPIXEL_BKGD_INDEX_LAST)
  1402. #define NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_INDEX_FIRST
  1403. #endif