My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  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. // Kinematics
  28. #if ENABLED(MORGAN_SCARA)
  29. #define IS_SCARA 1
  30. #define IS_KINEMATIC 1
  31. #elif ENABLED(DELTA)
  32. #define IS_KINEMATIC 1
  33. #else
  34. #define IS_CARTESIAN 1
  35. #endif
  36. // MKS_LCD12864 is a variant of MKS_MINI_12864
  37. #if ENABLED(MKS_LCD12864)
  38. #define MKS_MINI_12864
  39. #endif
  40. /**
  41. * General Flags that may be set below by specific LCDs
  42. *
  43. * DOGLCD : Run a Graphical LCD through U8GLib (with MarlinUI)
  44. * IS_ULTIPANEL : Define LCD_PINS_D5/6/7 for direct-connected "Ultipanel" LCDs
  45. * IS_ULTRA_LCD : Ultra LCD, not necessarily Ultipanel.
  46. * IS_RRD_SC : Common RRD Smart Controller digital interface pins
  47. * IS_RRD_FG_SC : Common RRD Full Graphical Smart Controller digital interface pins
  48. * U8GLIB_ST7920 : Most common DOGM display SPI interface, supporting a "lightweight" display mode.
  49. * U8GLIB_SH1106 : SH1106 OLED with I2C interface via U8GLib
  50. * IS_U8GLIB_SSD1306 : SSD1306 OLED with I2C interface via U8GLib
  51. * U8GLIB_SSD1309 : SSD1309 OLED with I2C interface via U8GLib
  52. * U8GLIB_ST7565_64128N : ST7565 128x64 LCD with SPI interface via U8GLib
  53. * U8GLIB_LM6059_AF : LM6059 with Hardware SPI via U8GLib
  54. */
  55. #if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
  56. #define MINIPANEL
  57. #elif ENABLED(CARTESIO_UI)
  58. #define DOGLCD
  59. #define IS_ULTIPANEL 1
  60. #elif EITHER(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE)
  61. #define IS_DWIN_MARLINUI 1
  62. #define IS_ULTIPANEL 1
  63. #elif ENABLED(ZONESTAR_LCD)
  64. #define HAS_ADC_BUTTONS 1
  65. #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
  66. #define ADC_KEY_NUM 8
  67. #define IS_ULTIPANEL 1
  68. // This helps to implement HAS_ADC_BUTTONS menus
  69. #define REVERSE_MENU_DIRECTION
  70. #define ENCODER_PULSES_PER_STEP 1
  71. #define ENCODER_STEPS_PER_MENU_ITEM 1
  72. #define ENCODER_FEEDRATE_DEADZONE 2
  73. #elif ENABLED(ZONESTAR_12864LCD)
  74. #define DOGLCD
  75. #define IS_RRD_SC 1
  76. #define U8GLIB_ST7920
  77. #elif ENABLED(ZONESTAR_12864OLED)
  78. #define IS_RRD_SC 1
  79. #define U8GLIB_SH1106
  80. #elif ENABLED(ZONESTAR_12864OLED_SSD1306)
  81. #define IS_RRD_SC 1
  82. #define IS_U8GLIB_SSD1306
  83. #elif ENABLED(RADDS_DISPLAY)
  84. #define IS_ULTIPANEL 1
  85. #define ENCODER_PULSES_PER_STEP 2
  86. #elif ANY(miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864)
  87. #define DOGLCD
  88. #define IS_ULTIPANEL 1
  89. #if ENABLED(miniVIKI)
  90. #define U8GLIB_ST7565_64128N
  91. #elif ENABLED(VIKI2)
  92. #define U8GLIB_ST7565_64128N
  93. #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
  94. #define U8GLIB_LM6059_AF
  95. #elif ENABLED(AZSMZ_12864)
  96. #define U8GLIB_ST7565_64128N
  97. #endif
  98. #elif ENABLED(OLED_PANEL_TINYBOY2)
  99. #define IS_U8GLIB_SSD1306
  100. #define IS_ULTIPANEL 1
  101. #elif ENABLED(RA_CONTROL_PANEL)
  102. #define LCD_I2C_TYPE_PCA8574
  103. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  104. #define IS_ULTIPANEL 1
  105. #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  106. #define DOGLCD
  107. #define U8GLIB_ST7920
  108. #define IS_ULTIPANEL 1
  109. #elif ENABLED(MKS_12864OLED)
  110. #define IS_RRD_SC 1
  111. #define U8GLIB_SH1106
  112. #elif ENABLED(MKS_12864OLED_SSD1306)
  113. #define IS_RRD_SC 1
  114. #define IS_U8GLIB_SSD1306
  115. #elif ENABLED(FYSETC_242_OLED_12864)
  116. #define IS_RRD_SC 1
  117. #define U8GLIB_SH1106
  118. #define LED_CONTROL_MENU
  119. #define NEOPIXEL_LED
  120. #undef NEOPIXEL_TYPE
  121. #define NEOPIXEL_TYPE NEO_RGB
  122. #if NEOPIXEL_PIXELS < 3
  123. #undef NEOPIXELS_PIXELS
  124. #define NEOPIXEL_PIXELS 3
  125. #endif
  126. #ifndef NEOPIXEL_BRIGHTNESS
  127. #define NEOPIXEL_BRIGHTNESS 127
  128. #endif
  129. #if ENABLED(PSU_CONTROL)
  130. #define LED_BACKLIGHT_TIMEOUT 10000
  131. #endif
  132. #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)
  133. #define FYSETC_MINI_12864
  134. #define DOGLCD
  135. #define IS_ULTIPANEL 1
  136. #define LED_COLORS_REDUCE_GREEN
  137. #if ENABLED(PSU_CONTROL) && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
  138. #define LED_BACKLIGHT_TIMEOUT 10000
  139. #endif
  140. // Require LED backlighting enabled
  141. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
  142. #define RGB_LED
  143. #elif ENABLED(FYSETC_MINI_12864_2_1)
  144. #define LED_CONTROL_MENU
  145. #define NEOPIXEL_LED
  146. #undef NEOPIXEL_TYPE
  147. #define NEOPIXEL_TYPE NEO_RGB
  148. #if NEOPIXEL_PIXELS < 3
  149. #undef NEOPIXELS_PIXELS
  150. #define NEOPIXEL_PIXELS 3
  151. #endif
  152. #ifndef NEOPIXEL_BRIGHTNESS
  153. #define NEOPIXEL_BRIGHTNESS 127
  154. #endif
  155. //#define NEOPIXEL_STARTUP_TEST
  156. #endif
  157. #elif ENABLED(ULTI_CONTROLLER)
  158. #define IS_ULTIPANEL 1
  159. #define U8GLIB_SSD1309
  160. #define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
  161. #define ENCODER_PULSES_PER_STEP 2
  162. #define ENCODER_STEPS_PER_MENU_ITEM 2
  163. #elif ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602)
  164. #define IS_RRD_SC 1
  165. #define LCD_WIDTH 16
  166. #define LCD_HEIGHT 2
  167. #elif EITHER(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C)
  168. #define IS_TFTGLCD_PANEL 1
  169. #define IS_ULTIPANEL 1 // Note that IS_ULTIPANEL leads to HAS_WIRED_LCD
  170. #if ENABLED(SDSUPPORT) && DISABLED(LCD_PROGRESS_BAR)
  171. #define LCD_PROGRESS_BAR
  172. #endif
  173. #if ENABLED(TFTGLCD_PANEL_I2C)
  174. #define LCD_I2C_ADDRESS 0x27 // Must be equal to panel's I2C slave addres
  175. #endif
  176. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD, used for both I2C and SPI buses (LiquidTWI2 not required)
  177. #define STD_ENCODER_PULSES_PER_STEP 2
  178. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  179. #define LCD_WIDTH 20 // 20 or 24 chars in line
  180. #define LCD_HEIGHT 10 // Character lines
  181. #define LCD_CONTRAST_MIN 127
  182. #define LCD_CONTRAST_MAX 255
  183. #define DEFAULT_LCD_CONTRAST 250
  184. #define CONVERT_TO_EXT_ASCII // Use extended 128-255 symbols from ASCII table.
  185. // At this time present conversion only for cyrillic - bg, ru and uk languages.
  186. // First 7 ASCII symbols in panel font must be replaced with Marlin's special symbols.
  187. #elif ENABLED(CR10_STOCKDISPLAY)
  188. #define IS_RRD_FG_SC 1
  189. #define BOARD_ST7920_DELAY_1 DELAY_NS(125)
  190. #define BOARD_ST7920_DELAY_2 DELAY_NS(125)
  191. #define BOARD_ST7920_DELAY_3 DELAY_NS(125)
  192. #elif ANY(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, ANET_FULL_GRAPHICS_LCD, BQ_LCD_SMART_CONTROLLER)
  193. #define IS_RRD_FG_SC 1
  194. #elif ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
  195. // RepRapDiscount LCD or Graphical LCD with rotary click encoder
  196. #define IS_RRD_SC 1
  197. #endif
  198. // ST7920-based graphical displays
  199. #if ANY(IS_RRD_FG_SC, LCD_FOR_MELZI, SILVER_GATE_GLCD_CONTROLLER)
  200. #define DOGLCD
  201. #define U8GLIB_ST7920
  202. #define IS_RRD_SC 1
  203. #endif
  204. // ST7565 / 64128N graphical displays
  205. #if EITHER(MAKRPANEL, MINIPANEL)
  206. #define IS_ULTIPANEL 1
  207. #define DOGLCD
  208. #if ENABLED(MAKRPANEL)
  209. #define U8GLIB_ST7565_64128N
  210. #endif
  211. #endif
  212. #if ENABLED(IS_U8GLIB_SSD1306)
  213. #define U8GLIB_SSD1306
  214. #endif
  215. #if ENABLED(OVERLORD_OLED)
  216. #define IS_ULTIPANEL 1
  217. #define U8GLIB_SH1106
  218. /**
  219. * PCA9632 for buzzer and LEDs via i2c
  220. * No auto-inc, red and green leds switched, buzzer
  221. */
  222. #define PCA9632
  223. #define PCA9632_NO_AUTO_INC
  224. #define PCA9632_GRN 0x00
  225. #define PCA9632_RED 0x02
  226. #define PCA9632_BUZZER
  227. #define PCA9632_BUZZER_DATA { 0x09, 0x02 }
  228. #define ENCODER_PULSES_PER_STEP 1 // Overlord uses buttons
  229. #define ENCODER_STEPS_PER_MENU_ITEM 1
  230. #endif
  231. // 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106
  232. #if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
  233. #define HAS_U8GLIB_I2C_OLED 1
  234. #define IS_ULTRA_LCD 1
  235. #define DOGLCD
  236. #endif
  237. /**
  238. * SPI Ultipanels
  239. */
  240. // Basic Ultipanel-like displays
  241. #if ANY(ULTIMAKERCONTROLLER, IS_RRD_SC, G3D_PANEL, RIGIDBOT_PANEL, PANEL_ONE, U8GLIB_SH1106)
  242. #define IS_ULTIPANEL 1
  243. #endif
  244. // Einstart OLED has Cardinal nav via pins defined in pins_EINSTART-S.h
  245. #if ENABLED(U8GLIB_SH1106_EINSTART)
  246. #define DOGLCD
  247. #define IS_ULTIPANEL 1
  248. #endif
  249. // TFT Compatibility
  250. #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)
  251. #define IS_LEGACY_TFT 1
  252. #define TFT_GENERIC
  253. #warning "Don't forget to update your TFT settings in Configuration.h."
  254. #endif
  255. #if ANY(FSMC_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC)
  256. #define TFT_INTERFACE_FSMC
  257. #elif ANY(SPI_GRAPHICAL_TFT, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI)
  258. #define TFT_INTERFACE_SPI
  259. #endif
  260. #if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT)
  261. #define TFT_CLASSIC_UI
  262. #elif ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI)
  263. #define TFT_COLOR_UI
  264. #elif EITHER(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI)
  265. #define TFT_LVGL_UI
  266. #endif
  267. // FSMC/SPI TFT Panels (LVGL)
  268. #if ENABLED(TFT_LVGL_UI)
  269. #define HAS_TFT_LVGL_UI 1
  270. #endif
  271. // FSMC/SPI TFT Panels
  272. #if ENABLED(TFT_CLASSIC_UI)
  273. #define TFT_SCALED_DOGLCD 1
  274. #endif
  275. #if TFT_SCALED_DOGLCD
  276. #define DOGLCD
  277. #define IS_ULTIPANEL 1
  278. #define DELAYED_BACKLIGHT_INIT
  279. #elif ENABLED(TFT_LVGL_UI)
  280. #define DELAYED_BACKLIGHT_INIT
  281. #endif
  282. // Color UI
  283. #if ENABLED(TFT_COLOR_UI)
  284. #define HAS_GRAPHICAL_TFT 1
  285. #define IS_ULTIPANEL 1
  286. #endif
  287. /**
  288. * I2C Panels
  289. */
  290. #if EITHER(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004)
  291. #define LCD_I2C_TYPE_PCF8575
  292. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  293. #if ENABLED(LCD_SAINSMART_I2C_2004)
  294. #define LCD_WIDTH 20
  295. #define LCD_HEIGHT 4
  296. #endif
  297. #elif ENABLED(LCD_I2C_PANELOLU2)
  298. // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
  299. #define LCD_I2C_TYPE_MCP23017
  300. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  301. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (optional)
  302. #define IS_ULTIPANEL 1
  303. #elif ENABLED(LCD_I2C_VIKI)
  304. /**
  305. * Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
  306. *
  307. * This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
  308. * Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
  309. * Note: The pause/stop/resume LCD button pin should be connected to the Arduino
  310. * BTN_ENC pin (or set BTN_ENC to -1 if not used)
  311. */
  312. #define LCD_I2C_TYPE_MCP23017
  313. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  314. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
  315. #define IS_ULTIPANEL 1
  316. #define ENCODER_FEEDRATE_DEADZONE 4
  317. #define STD_ENCODER_PULSES_PER_STEP 1
  318. #define STD_ENCODER_STEPS_PER_MENU_ITEM 2
  319. #elif ENABLED(G3D_PANEL)
  320. #define STD_ENCODER_PULSES_PER_STEP 2
  321. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  322. #elif ANY(IS_RRD_SC, miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864, OLED_PANEL_TINYBOY2, BQ_LCD_SMART_CONTROLLER, LCD_I2C_PANELOLU2)
  323. #define STD_ENCODER_PULSES_PER_STEP 4
  324. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  325. #endif
  326. #ifndef STD_ENCODER_PULSES_PER_STEP
  327. #if ENABLED(TOUCH_SCREEN)
  328. #define STD_ENCODER_PULSES_PER_STEP 2
  329. #else
  330. #define STD_ENCODER_PULSES_PER_STEP 5
  331. #endif
  332. #endif
  333. #ifndef STD_ENCODER_STEPS_PER_MENU_ITEM
  334. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  335. #endif
  336. #ifndef ENCODER_PULSES_PER_STEP
  337. #define ENCODER_PULSES_PER_STEP STD_ENCODER_PULSES_PER_STEP
  338. #endif
  339. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  340. #define ENCODER_STEPS_PER_MENU_ITEM STD_ENCODER_STEPS_PER_MENU_ITEM
  341. #endif
  342. #ifndef ENCODER_FEEDRATE_DEADZONE
  343. #define ENCODER_FEEDRATE_DEADZONE 6
  344. #endif
  345. // Shift register panels
  346. // ---------------------
  347. // 2 wire Non-latching LCD SR from:
  348. // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
  349. #if ENABLED(FF_INTERFACEBOARD)
  350. #define SR_LCD_3W_NL // Non latching 3 wire shift register
  351. #define IS_ULTIPANEL 1
  352. #elif ENABLED(SAV_3DLCD)
  353. #define SR_LCD_2W_NL // Non latching 2 wire shift register
  354. #define IS_ULTIPANEL 1
  355. #elif ENABLED(ULTIPANEL)
  356. #define IS_ULTIPANEL 1
  357. #endif
  358. #if EITHER(IS_ULTIPANEL, ULTRA_LCD)
  359. #define IS_ULTRA_LCD 1
  360. #endif
  361. #if EITHER(IS_ULTIPANEL, REPRAPWORLD_KEYPAD)
  362. #define IS_NEWPANEL 1
  363. #endif
  364. #if EITHER(ZONESTAR_LCD, REPRAPWORLD_KEYPAD)
  365. #define IS_RRW_KEYPAD 1
  366. #ifndef REPRAPWORLD_KEYPAD_MOVE_STEP
  367. #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0
  368. #endif
  369. #endif
  370. // Aliases for LCD features
  371. #if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
  372. #define HAS_DGUS_LCD 1
  373. #endif
  374. // Extensible UI serial touch screens. (See src/lcd/extui)
  375. #if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
  376. #define IS_EXTUI 1
  377. #define EXTENSIBLE_UI
  378. #endif
  379. // Aliases for LCD features
  380. #if EITHER(IS_ULTRA_LCD, EXTENSIBLE_UI)
  381. #define HAS_DISPLAY 1
  382. #endif
  383. #if IS_ULTRA_LCD
  384. #define HAS_WIRED_LCD 1
  385. #if ENABLED(DOGLCD)
  386. #define HAS_MARLINUI_U8GLIB 1
  387. #elif IS_TFTGLCD_PANEL
  388. // Neither DOGM nor HD44780. Fully customized interface.
  389. #elif DISABLED(HAS_GRAPHICAL_TFT)
  390. #define HAS_MARLINUI_HD44780 1
  391. #endif
  392. #endif
  393. #if IS_ULTIPANEL && DISABLED(NO_LCD_MENUS)
  394. #define HAS_LCD_MENU 1
  395. #endif
  396. #if HAS_MARLINUI_U8GLIB
  397. #ifndef LCD_PIXEL_WIDTH
  398. #define LCD_PIXEL_WIDTH 128
  399. #endif
  400. #ifndef LCD_PIXEL_HEIGHT
  401. #define LCD_PIXEL_HEIGHT 64
  402. #endif
  403. #endif
  404. /**
  405. * Extruders have some combination of stepper motors and hotends
  406. * so we separate these concepts into the defines:
  407. *
  408. * EXTRUDERS - Number of Selectable Tools
  409. * HOTENDS - Number of hotends, whether connected or separate
  410. * E_STEPPERS - Number of actual E stepper motors
  411. * E_MANUAL - Number of E steppers for LCD move options
  412. */
  413. #if EXTRUDERS == 0
  414. #undef EXTRUDERS
  415. #define EXTRUDERS 0
  416. #undef SINGLENOZZLE
  417. #undef SWITCHING_EXTRUDER
  418. #undef SWITCHING_NOZZLE
  419. #undef MIXING_EXTRUDER
  420. #undef MK2_MULTIPLEXER
  421. #undef PRUSA_MMU2
  422. #undef HOTEND_IDLE_TIMEOUT
  423. #elif EXTRUDERS > 1
  424. #define HAS_MULTI_EXTRUDER 1
  425. #endif
  426. #if ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS
  427. #if EXTRUDERS > 4
  428. #define E_STEPPERS 3
  429. #elif EXTRUDERS > 2
  430. #define E_STEPPERS 2
  431. #else
  432. #define E_STEPPERS 1
  433. #endif
  434. #if DISABLED(SWITCHING_NOZZLE)
  435. #define HOTENDS E_STEPPERS
  436. #endif
  437. #elif ENABLED(MIXING_EXTRUDER)
  438. #define E_STEPPERS MIXING_STEPPERS
  439. #define E_MANUAL 1
  440. #if MIXING_STEPPERS == 2
  441. #define HAS_DUAL_MIXING 1
  442. #endif
  443. #elif ENABLED(SWITCHING_TOOLHEAD)
  444. #define E_STEPPERS EXTRUDERS
  445. #define E_MANUAL EXTRUDERS
  446. #elif ENABLED(PRUSA_MMU2)
  447. #define E_STEPPERS 1
  448. #endif
  449. // No inactive extruders with MK2_MULTIPLEXER or SWITCHING_NOZZLE
  450. #if EITHER(MK2_MULTIPLEXER, SWITCHING_NOZZLE)
  451. #undef DISABLE_INACTIVE_EXTRUDER
  452. #endif
  453. // Průša MK2 Multiplexer and MMU 2.0 force SINGLENOZZLE
  454. #if EITHER(MK2_MULTIPLEXER, PRUSA_MMU2)
  455. #define SINGLENOZZLE
  456. #endif
  457. #if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset
  458. #undef HOTENDS
  459. #define HOTENDS 1
  460. #undef HOTEND_OFFSET_X
  461. #undef HOTEND_OFFSET_Y
  462. #endif
  463. #ifndef HOTENDS
  464. #define HOTENDS EXTRUDERS
  465. #endif
  466. #ifndef E_STEPPERS
  467. #define E_STEPPERS EXTRUDERS
  468. #endif
  469. #ifndef E_MANUAL
  470. #define E_MANUAL EXTRUDERS
  471. #endif
  472. #if HOTENDS
  473. #define HAS_HOTEND 1
  474. #ifndef HOTEND_OVERSHOOT
  475. #define HOTEND_OVERSHOOT 15
  476. #endif
  477. #if HOTENDS > 1
  478. #define HAS_MULTI_HOTEND 1
  479. #define HAS_HOTEND_OFFSET 1
  480. #endif
  481. #else
  482. #undef PID_PARAMS_PER_HOTEND
  483. #endif
  484. // Helper macros for extruder and hotend arrays
  485. #define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
  486. #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V)
  487. #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1, v1, v1)
  488. #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)
  489. #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1, v1, v1)
  490. #if ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR)
  491. #define DO_SWITCH_EXTRUDER 1
  492. #endif
  493. /**
  494. * Default hotend offsets, if not defined
  495. */
  496. #if HAS_HOTEND_OFFSET
  497. #ifndef HOTEND_OFFSET_X
  498. #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
  499. #endif
  500. #ifndef HOTEND_OFFSET_Y
  501. #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
  502. #endif
  503. #ifndef HOTEND_OFFSET_Z
  504. #define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder
  505. #endif
  506. #endif
  507. /**
  508. * DISTINCT_E_FACTORS affects how some E factors are accessed
  509. */
  510. #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
  511. #define DISTINCT_E E_STEPPERS
  512. #define XYZE_N (XYZ + E_STEPPERS)
  513. #define E_INDEX_N(E) (E)
  514. #define E_AXIS_N(E) AxisEnum(E_AXIS + E)
  515. #define UNUSED_E(E) NOOP
  516. #else
  517. #undef DISTINCT_E_FACTORS
  518. #define DISTINCT_E 1
  519. #define XYZE_N XYZE
  520. #define E_INDEX_N(E) 0
  521. #define E_AXIS_N(E) E_AXIS
  522. #define UNUSED_E(E) UNUSED(E)
  523. #endif
  524. #if ENABLED(DWIN_CREALITY_LCD)
  525. #define SERIAL_CATCHALL 0
  526. #endif
  527. // Pressure sensor with a BLTouch-like interface
  528. #if ENABLED(CREALITY_TOUCH)
  529. #define BLTOUCH
  530. #endif
  531. /**
  532. * The BLTouch Probe emulates a servo probe
  533. * and uses "special" angles for its state.
  534. */
  535. #if ENABLED(BLTOUCH)
  536. #ifndef Z_PROBE_SERVO_NR
  537. #define Z_PROBE_SERVO_NR 0
  538. #endif
  539. #undef DEACTIVATE_SERVOS_AFTER_MOVE
  540. // Always disable probe pin inverting for BLTouch
  541. #undef Z_MIN_PROBE_ENDSTOP_INVERTING
  542. #define Z_MIN_PROBE_ENDSTOP_INVERTING false
  543. #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  544. #undef Z_MIN_ENDSTOP_INVERTING
  545. #define Z_MIN_ENDSTOP_INVERTING false
  546. #endif
  547. #endif
  548. /**
  549. * Set a flag for a servo probe (or BLTouch)
  550. */
  551. #ifdef Z_PROBE_SERVO_NR
  552. #define HAS_Z_SERVO_PROBE 1
  553. #endif
  554. #if ANY(HAS_Z_SERVO_PROBE, SWITCHING_EXTRUDER, SWITCHING_NOZZLE)
  555. #define HAS_SERVO_ANGLES 1
  556. #endif
  557. #if !HAS_SERVO_ANGLES
  558. #undef EDITABLE_SERVO_ANGLES
  559. #endif
  560. /**
  561. * Set flags for enabled probes
  562. */
  563. #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)
  564. #define HAS_BED_PROBE 1
  565. #endif
  566. #if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
  567. #define PROBE_SELECTED 1
  568. #endif
  569. #if HAS_BED_PROBE
  570. #if DISABLED(NOZZLE_AS_PROBE)
  571. #define HAS_PROBE_XY_OFFSET 1
  572. #endif
  573. #if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  574. #define HAS_CUSTOM_PROBE_PIN 1
  575. #endif
  576. #if Z_HOME_DIR < 0 && (!HAS_CUSTOM_PROBE_PIN || ENABLED(USE_PROBE_FOR_Z_HOMING))
  577. #define HOMING_Z_WITH_PROBE 1
  578. #endif
  579. #ifndef Z_PROBE_LOW_POINT
  580. #define Z_PROBE_LOW_POINT -5
  581. #endif
  582. #if ENABLED(Z_PROBE_ALLEN_KEY)
  583. #define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
  584. #endif
  585. #if MULTIPLE_PROBING > 1
  586. #if EXTRA_PROBING > 0
  587. #define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
  588. #else
  589. #define TOTAL_PROBING MULTIPLE_PROBING
  590. #endif
  591. #endif
  592. #else
  593. // Clear probe pin settings when no probe is selected
  594. #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
  595. #endif
  596. /**
  597. * Set granular options based on the specific type of leveling
  598. */
  599. #if ENABLED(AUTO_BED_LEVELING_UBL)
  600. #undef LCD_BED_LEVELING
  601. #if ENABLED(DELTA)
  602. #define UBL_SEGMENTED 1
  603. #endif
  604. #endif
  605. #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
  606. #define ABL_PLANAR 1
  607. #endif
  608. #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
  609. #define ABL_GRID 1
  610. #endif
  611. #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT)
  612. #define HAS_ABL_NOT_UBL 1
  613. #endif
  614. #if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
  615. #define HAS_MESH 1
  616. #endif
  617. #if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
  618. #define NEEDS_THREE_PROBE_POINTS 1
  619. #endif
  620. #if EITHER(HAS_ABL_NOT_UBL, AUTO_BED_LEVELING_UBL)
  621. #define HAS_ABL_OR_UBL 1
  622. #if DISABLED(PROBE_MANUALLY)
  623. #define HAS_AUTOLEVEL 1
  624. #endif
  625. #endif
  626. #if EITHER(HAS_ABL_OR_UBL, MESH_BED_LEVELING)
  627. #define HAS_LEVELING 1
  628. #if DISABLED(AUTO_BED_LEVELING_UBL)
  629. #define PLANNER_LEVELING 1
  630. #endif
  631. #endif
  632. #if EITHER(HAS_ABL_OR_UBL, Z_MIN_PROBE_REPEATABILITY_TEST)
  633. #define HAS_PROBING_PROCEDURE 1
  634. #endif
  635. #if !HAS_LEVELING
  636. #undef RESTORE_LEVELING_AFTER_G28
  637. #endif
  638. #ifdef GRID_MAX_POINTS_X
  639. #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
  640. #define GRID_LOOP(A,B) LOOP_L_N(A, GRID_MAX_POINTS_X) LOOP_L_N(B, GRID_MAX_POINTS_Y)
  641. #endif
  642. #ifndef INVERT_X_DIR
  643. #define INVERT_X_DIR false
  644. #endif
  645. #ifndef INVERT_Y_DIR
  646. #define INVERT_Y_DIR false
  647. #endif
  648. #ifndef INVERT_Z_DIR
  649. #define INVERT_Z_DIR false
  650. #endif
  651. #ifndef INVERT_E_DIR
  652. #define INVERT_E_DIR false
  653. #endif
  654. #if ENABLED(SLIM_LCD_MENUS)
  655. #define BOOT_MARLIN_LOGO_SMALL
  656. #endif
  657. // This flag indicates some kind of jerk storage is needed
  658. #if EITHER(CLASSIC_JERK, IS_KINEMATIC)
  659. #define HAS_CLASSIC_JERK 1
  660. #endif
  661. #if DISABLED(CLASSIC_JERK)
  662. #define HAS_JUNCTION_DEVIATION 1
  663. #endif
  664. // E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA
  665. #if ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))
  666. #define HAS_CLASSIC_E_JERK 1
  667. #endif
  668. #ifndef SPI_SPEED
  669. #define SPI_SPEED SPI_FULL_SPEED
  670. #endif
  671. #if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1
  672. #define HAS_USB_SERIAL 1
  673. #endif
  674. /**
  675. * This setting is also used by M109 when trying to calculate
  676. * a ballpark safe margin to prevent wait-forever situation.
  677. */
  678. #ifndef EXTRUDE_MINTEMP
  679. #define EXTRUDE_MINTEMP 170
  680. #endif
  681. /**
  682. * TFT Displays
  683. *
  684. * Configure parameters for TFT displays:
  685. * - TFT_DEFAULT_ORIENTATION
  686. * - TFT_DRIVER
  687. * - TFT_WIDTH
  688. * - TFT_HEIGHT
  689. * - TFT_INTERFACE_(SPI|FSMC)
  690. * - TFT_COLOR
  691. * - GRAPHICAL_TFT_UPSCALE
  692. */
  693. #if ENABLED(MKS_TS35_V2_0)
  694. // Most common: ST7796
  695. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
  696. #define TFT_RES_480x320
  697. #define TFT_INTERFACE_SPI
  698. #elif ENABLED(MKS_ROBIN_TFT24)
  699. // Most common: ST7789
  700. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
  701. #define TFT_RES_320x240
  702. #define TFT_INTERFACE_FSMC
  703. #elif ENABLED(MKS_ROBIN_TFT28)
  704. // Most common: ST7789
  705. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
  706. #define TFT_RES_320x240
  707. #define TFT_INTERFACE_FSMC
  708. #elif ENABLED(MKS_ROBIN_TFT32)
  709. // Most common: ST7789
  710. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
  711. #define TFT_RES_320x240
  712. #define TFT_INTERFACE_FSMC
  713. #elif ENABLED(MKS_ROBIN_TFT35)
  714. // Most common: ILI9488
  715. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  716. #define TFT_RES_480x320
  717. #define TFT_INTERFACE_FSMC
  718. #elif ENABLED(MKS_ROBIN_TFT43)
  719. #define TFT_DEFAULT_ORIENTATION 0
  720. #define TFT_DRIVER SSD1963
  721. #define TFT_RES_480x272
  722. #define TFT_INTERFACE_FSMC
  723. #elif ENABLED(MKS_ROBIN_TFT_V1_1R)
  724. // ILI9328 or R61505
  725. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  726. #define TFT_RES_320x240
  727. #define TFT_INTERFACE_FSMC
  728. #elif EITHER(TFT_TRONXY_X5SA, ANYCUBIC_TFT35)
  729. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  730. #define TFT_DRIVER ILI9488
  731. #define TFT_RES_480x320
  732. #define TFT_INTERFACE_FSMC
  733. #elif ENABLED(LONGER_LK_TFT28)
  734. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  735. #define TFT_RES_320x240
  736. #define TFT_INTERFACE_FSMC
  737. #elif ENABLED(TFT_GENERIC)
  738. #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
  739. #if NONE(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
  740. #define TFT_RES_320x240
  741. #endif
  742. #if NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
  743. #define TFT_INTERFACE_SPI
  744. #endif
  745. #endif
  746. #if ENABLED(TFT_RES_320x240)
  747. #define TFT_WIDTH 320
  748. #define TFT_HEIGHT 240
  749. #define GRAPHICAL_TFT_UPSCALE 2
  750. #elif ENABLED(TFT_RES_480x272)
  751. #define TFT_WIDTH 480
  752. #define TFT_HEIGHT 272
  753. #define GRAPHICAL_TFT_UPSCALE 2
  754. #elif ENABLED(TFT_RES_480x320)
  755. #define TFT_WIDTH 480
  756. #define TFT_HEIGHT 320
  757. #define GRAPHICAL_TFT_UPSCALE 3
  758. #endif
  759. // FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi).h
  760. #if ENABLED(TFT_INTERFACE_FSMC)
  761. #define HAS_FSMC_TFT 1
  762. #if ENABLED(TFT_CLASSIC_UI)
  763. #define HAS_FSMC_GRAPHICAL_TFT 1
  764. #elif ENABLED(TFT_LVGL_UI)
  765. #define HAS_TFT_LVGL_UI_FSMC 1
  766. #endif
  767. #elif ENABLED(TFT_INTERFACE_SPI)
  768. #define HAS_SPI_TFT 1
  769. #if ENABLED(TFT_CLASSIC_UI)
  770. #define HAS_SPI_GRAPHICAL_TFT 1
  771. #elif ENABLED(TFT_LVGL_UI)
  772. #define HAS_TFT_LVGL_UI_SPI 1
  773. #endif
  774. #endif
  775. #if ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 240
  776. #if ENABLED(TFT_INTERFACE_SPI)
  777. #define TFT_320x240_SPI
  778. #elif ENABLED(TFT_INTERFACE_FSMC)
  779. #define TFT_320x240
  780. #endif
  781. #elif ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 320
  782. #if ENABLED(TFT_INTERFACE_SPI)
  783. #define TFT_480x320_SPI
  784. #elif ENABLED(TFT_INTERFACE_FSMC)
  785. #define TFT_480x320
  786. #endif
  787. #endif
  788. // Fewer lines with touch buttons on-screen
  789. #if EITHER(TFT_320x240, TFT_320x240_SPI)
  790. #define HAS_UI_320x240 1
  791. #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
  792. #elif EITHER(TFT_480x320, TFT_480x320_SPI)
  793. #define HAS_UI_480x320 1
  794. #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
  795. #endif
  796. // This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
  797. #if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
  798. #undef TOUCH_SCREEN
  799. #undef TOUCH_SCREEN_CALIBRATION
  800. #define HAS_TOUCH_XPT2046 1
  801. #endif