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

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