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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  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_USE_I2C_BUZZER // Enable buzzer on LCD for I2C and SPI buses (LiquidTWI2 not required)
  183. #define LCD_I2C_ADDRESS 0x27 // Must be equal to panel's I2C slave addres
  184. #endif
  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. // FSMC/SPI TFT Panels (LVGL)
  256. #if EITHER(TFT_LVGL_UI_SPI, TFT_LVGL_UI_FSMC)
  257. #define HAS_TFT_LVGL_UI 1
  258. #endif
  259. // FSMC/SPI TFT Panels
  260. #if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT)
  261. #define TFT_SCALED_DOGLCD 1
  262. #endif
  263. #if TFT_SCALED_DOGLCD
  264. #define DOGLCD
  265. #define IS_ULTIPANEL
  266. #define DELAYED_BACKLIGHT_INIT
  267. #elif ENABLED(TFT_LVGL_UI_SPI)
  268. #define DELAYED_BACKLIGHT_INIT
  269. #endif
  270. // FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi).h
  271. #if ANY(TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC, FSMC_GRAPHICAL_TFT)
  272. #define HAS_FSMC_TFT 1
  273. #elif ANY(TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI, SPI_GRAPHICAL_TFT)
  274. #define HAS_SPI_TFT 1
  275. #endif
  276. // Color UI
  277. #if ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI)
  278. #define HAS_GRAPHICAL_TFT 1
  279. #define IS_ULTIPANEL
  280. #endif
  281. // Fewer lines with touch buttons on-screen
  282. #if EITHER(TFT_320x240, TFT_320x240_SPI)
  283. #define HAS_UI_320x240 1
  284. #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
  285. #elif EITHER(TFT_480x320, TFT_480x320_SPI)
  286. #define HAS_UI_480x320 1
  287. #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
  288. #endif
  289. /**
  290. * I2C Panels
  291. */
  292. #if EITHER(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004)
  293. #define LCD_I2C_TYPE_PCF8575
  294. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  295. #if ENABLED(LCD_SAINSMART_I2C_2004)
  296. #define LCD_WIDTH 20
  297. #define LCD_HEIGHT 4
  298. #endif
  299. #elif ENABLED(LCD_I2C_PANELOLU2)
  300. // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
  301. #define LCD_I2C_TYPE_MCP23017
  302. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  303. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (optional)
  304. #define IS_ULTIPANEL
  305. #elif ENABLED(LCD_I2C_VIKI)
  306. /**
  307. * Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
  308. *
  309. * This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
  310. * Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
  311. * Note: The pause/stop/resume LCD button pin should be connected to the Arduino
  312. * BTN_ENC pin (or set BTN_ENC to -1 if not used)
  313. */
  314. #define LCD_I2C_TYPE_MCP23017
  315. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  316. #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
  317. #define IS_ULTIPANEL
  318. #define ENCODER_FEEDRATE_DEADZONE 4
  319. #define STD_ENCODER_PULSES_PER_STEP 1
  320. #define STD_ENCODER_STEPS_PER_MENU_ITEM 2
  321. #elif ENABLED(G3D_PANEL)
  322. #define STD_ENCODER_PULSES_PER_STEP 2
  323. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  324. #elif ANY(REPRAP_DISCOUNT_SMART_CONTROLLER, miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864, OLED_PANEL_TINYBOY2, BQ_LCD_SMART_CONTROLLER, LCD_I2C_PANELOLU2)
  325. #define STD_ENCODER_PULSES_PER_STEP 4
  326. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  327. #endif
  328. #ifndef STD_ENCODER_PULSES_PER_STEP
  329. #if ENABLED(TOUCH_SCREEN)
  330. #define STD_ENCODER_PULSES_PER_STEP 2
  331. #else
  332. #define STD_ENCODER_PULSES_PER_STEP 5
  333. #endif
  334. #endif
  335. #ifndef STD_ENCODER_STEPS_PER_MENU_ITEM
  336. #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
  337. #endif
  338. #ifndef ENCODER_PULSES_PER_STEP
  339. #define ENCODER_PULSES_PER_STEP STD_ENCODER_PULSES_PER_STEP
  340. #endif
  341. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  342. #define ENCODER_STEPS_PER_MENU_ITEM STD_ENCODER_STEPS_PER_MENU_ITEM
  343. #endif
  344. #ifndef ENCODER_FEEDRATE_DEADZONE
  345. #define ENCODER_FEEDRATE_DEADZONE 6
  346. #endif
  347. // Shift register panels
  348. // ---------------------
  349. // 2 wire Non-latching LCD SR from:
  350. // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
  351. #if ENABLED(FF_INTERFACEBOARD)
  352. #define SR_LCD_3W_NL // Non latching 3 wire shift register
  353. #define IS_ULTIPANEL
  354. #elif ENABLED(SAV_3DLCD)
  355. #define SR_LCD_2W_NL // Non latching 2 wire shift register
  356. #define IS_ULTIPANEL
  357. #endif
  358. #if ENABLED(IS_ULTIPANEL)
  359. #define ULTIPANEL
  360. #endif
  361. #if ENABLED(ULTIPANEL)
  362. #define IS_ULTRA_LCD
  363. #define NEWPANEL
  364. #endif
  365. #if ENABLED(IS_ULTRA_LCD)
  366. #define ULTRA_LCD
  367. #endif
  368. #if ENABLED(IS_RRW_KEYPAD)
  369. #define REPRAPWORLD_KEYPAD
  370. #endif
  371. // Keypad needs a move step
  372. #if ENABLED(REPRAPWORLD_KEYPAD)
  373. #define NEWPANEL
  374. #ifndef REPRAPWORLD_KEYPAD_MOVE_STEP
  375. #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0
  376. #endif
  377. #endif
  378. // Aliases for LCD features
  379. #if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
  380. #define HAS_DGUS_LCD 1
  381. #endif
  382. // Extensible UI serial touch screens. (See src/lcd/extui)
  383. #if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
  384. #define IS_EXTUI
  385. #define EXTENSIBLE_UI
  386. #endif
  387. // Aliases for LCD features
  388. #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
  389. #define HAS_DISPLAY 1
  390. #endif
  391. #if ENABLED(ULTRA_LCD)
  392. #define HAS_WIRED_LCD 1
  393. #if ENABLED(DOGLCD)
  394. #define HAS_MARLINUI_U8GLIB 1
  395. #elif IS_TFTGLCD_PANEL
  396. // Neither DOGM nor HD44780. Fully customized interface.
  397. #elif DISABLED(HAS_GRAPHICAL_TFT)
  398. #define HAS_MARLINUI_HD44780 1
  399. #endif
  400. #endif
  401. #if ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)
  402. #define HAS_LCD_MENU 1
  403. #endif
  404. #if ENABLED(ADC_KEYPAD)
  405. #define HAS_ADC_BUTTONS 1
  406. #endif
  407. #if HAS_MARLINUI_U8GLIB
  408. #ifndef LCD_PIXEL_WIDTH
  409. #define LCD_PIXEL_WIDTH 128
  410. #endif
  411. #ifndef LCD_PIXEL_HEIGHT
  412. #define LCD_PIXEL_HEIGHT 64
  413. #endif
  414. #endif
  415. /**
  416. * Extruders have some combination of stepper motors and hotends
  417. * so we separate these concepts into the defines:
  418. *
  419. * EXTRUDERS - Number of Selectable Tools
  420. * HOTENDS - Number of hotends, whether connected or separate
  421. * E_STEPPERS - Number of actual E stepper motors
  422. * E_MANUAL - Number of E steppers for LCD move options
  423. */
  424. #if EXTRUDERS == 0
  425. #undef EXTRUDERS
  426. #define EXTRUDERS 0
  427. #undef SINGLENOZZLE
  428. #undef SWITCHING_EXTRUDER
  429. #undef SWITCHING_NOZZLE
  430. #undef MIXING_EXTRUDER
  431. #undef MK2_MULTIPLEXER
  432. #undef PRUSA_MMU2
  433. #undef HOTEND_IDLE_TIMEOUT
  434. #elif EXTRUDERS > 1
  435. #define HAS_MULTI_EXTRUDER 1
  436. #endif
  437. #if ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS
  438. #if EXTRUDERS > 4
  439. #define E_STEPPERS 3
  440. #elif EXTRUDERS > 2
  441. #define E_STEPPERS 2
  442. #else
  443. #define E_STEPPERS 1
  444. #endif
  445. #if DISABLED(SWITCHING_NOZZLE)
  446. #define HOTENDS E_STEPPERS
  447. #endif
  448. #elif ENABLED(MIXING_EXTRUDER)
  449. #define E_STEPPERS MIXING_STEPPERS
  450. #define E_MANUAL 1
  451. #if MIXING_STEPPERS == 2
  452. #define HAS_DUAL_MIXING 1
  453. #endif
  454. #elif ENABLED(SWITCHING_TOOLHEAD)
  455. #define E_STEPPERS EXTRUDERS
  456. #define E_MANUAL EXTRUDERS
  457. #elif ENABLED(PRUSA_MMU2)
  458. #define E_STEPPERS 1
  459. #endif
  460. // No inactive extruders with MK2_MULTIPLEXER or SWITCHING_NOZZLE
  461. #if EITHER(MK2_MULTIPLEXER, SWITCHING_NOZZLE)
  462. #undef DISABLE_INACTIVE_EXTRUDER
  463. #endif
  464. // Průša MK2 Multiplexer and MMU 2.0 force SINGLENOZZLE
  465. #if EITHER(MK2_MULTIPLEXER, PRUSA_MMU2)
  466. #define SINGLENOZZLE
  467. #endif
  468. #if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset
  469. #undef HOTENDS
  470. #define HOTENDS 1
  471. #undef HOTEND_OFFSET_X
  472. #undef HOTEND_OFFSET_Y
  473. #endif
  474. #ifndef HOTENDS
  475. #define HOTENDS EXTRUDERS
  476. #endif
  477. #ifndef E_STEPPERS
  478. #define E_STEPPERS EXTRUDERS
  479. #endif
  480. #ifndef E_MANUAL
  481. #define E_MANUAL EXTRUDERS
  482. #endif
  483. #if HOTENDS
  484. #define HAS_HOTEND 1
  485. #ifndef HOTEND_OVERSHOOT
  486. #define HOTEND_OVERSHOOT 15
  487. #endif
  488. #if HOTENDS > 1
  489. #define HAS_MULTI_HOTEND 1
  490. #define HAS_HOTEND_OFFSET 1
  491. #endif
  492. #else
  493. #undef PID_PARAMS_PER_HOTEND
  494. #endif
  495. // Helper macros for extruder and hotend arrays
  496. #define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
  497. #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V)
  498. #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1, v1, v1)
  499. #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)
  500. #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1, v1, v1)
  501. #if ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR)
  502. #define DO_SWITCH_EXTRUDER 1
  503. #endif
  504. #ifdef SWITCHING_NOZZLE_E1_SERVO_NR
  505. #define SWITCHING_NOZZLE_TWO_SERVOS 1
  506. #endif
  507. /**
  508. * Default hotend offsets, if not defined
  509. */
  510. #if HAS_HOTEND_OFFSET
  511. #ifndef HOTEND_OFFSET_X
  512. #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
  513. #endif
  514. #ifndef HOTEND_OFFSET_Y
  515. #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
  516. #endif
  517. #ifndef HOTEND_OFFSET_Z
  518. #define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder
  519. #endif
  520. #endif
  521. /**
  522. * DISTINCT_E_FACTORS affects how some E factors are accessed
  523. */
  524. #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
  525. #define DISTINCT_E E_STEPPERS
  526. #define XYZE_N (XYZ + E_STEPPERS)
  527. #define E_INDEX_N(E) (E)
  528. #define E_AXIS_N(E) AxisEnum(E_AXIS + E)
  529. #define UNUSED_E(E) NOOP
  530. #else
  531. #undef DISTINCT_E_FACTORS
  532. #define DISTINCT_E 1
  533. #define XYZE_N XYZE
  534. #define E_INDEX_N(E) 0
  535. #define E_AXIS_N(E) E_AXIS
  536. #define UNUSED_E(E) UNUSED(E)
  537. #endif
  538. #if ENABLED(DWIN_CREALITY_LCD)
  539. #define SERIAL_CATCHALL 0
  540. #endif
  541. // Pressure sensor with a BLTouch-like interface
  542. #if ENABLED(CREALITY_TOUCH)
  543. #define BLTOUCH
  544. #endif
  545. /**
  546. * The BLTouch Probe emulates a servo probe
  547. * and uses "special" angles for its state.
  548. */
  549. #if ENABLED(BLTOUCH)
  550. #ifndef Z_PROBE_SERVO_NR
  551. #define Z_PROBE_SERVO_NR 0
  552. #endif
  553. #ifndef NUM_SERVOS
  554. #define NUM_SERVOS (Z_PROBE_SERVO_NR + 1)
  555. #endif
  556. #undef DEACTIVATE_SERVOS_AFTER_MOVE
  557. #if NUM_SERVOS == 1
  558. #undef SERVO_DELAY
  559. #define SERVO_DELAY { 50 }
  560. #endif
  561. // Always disable probe pin inverting for BLTouch
  562. #undef Z_MIN_PROBE_ENDSTOP_INVERTING
  563. #define Z_MIN_PROBE_ENDSTOP_INVERTING false
  564. #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  565. #undef Z_MIN_ENDSTOP_INVERTING
  566. #define Z_MIN_ENDSTOP_INVERTING false
  567. #endif
  568. #endif
  569. #ifndef NUM_SERVOS
  570. #define NUM_SERVOS 0
  571. #endif
  572. /**
  573. * Set a flag for a servo probe (or BLTouch)
  574. */
  575. #if defined(Z_PROBE_SERVO_NR) && Z_PROBE_SERVO_NR >= 0
  576. #define HAS_Z_SERVO_PROBE 1
  577. #endif
  578. #if ANY(HAS_Z_SERVO_PROBE, SWITCHING_EXTRUDER, SWITCHING_NOZZLE)
  579. #define HAS_SERVO_ANGLES 1
  580. #endif
  581. #if !HAS_SERVO_ANGLES
  582. #undef EDITABLE_SERVO_ANGLES
  583. #endif
  584. /**
  585. * Set flags for enabled probes
  586. */
  587. #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)
  588. #define HAS_BED_PROBE 1
  589. #endif
  590. #if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
  591. #define PROBE_SELECTED 1
  592. #endif
  593. #if HAS_BED_PROBE
  594. #if DISABLED(NOZZLE_AS_PROBE)
  595. #define HAS_PROBE_XY_OFFSET 1
  596. #endif
  597. #if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  598. #define HAS_CUSTOM_PROBE_PIN 1
  599. #endif
  600. #if Z_HOME_DIR < 0 && (!HAS_CUSTOM_PROBE_PIN || ENABLED(USE_PROBE_FOR_Z_HOMING))
  601. #define HOMING_Z_WITH_PROBE 1
  602. #endif
  603. #ifndef Z_PROBE_LOW_POINT
  604. #define Z_PROBE_LOW_POINT -5
  605. #endif
  606. #if ENABLED(Z_PROBE_ALLEN_KEY)
  607. #define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
  608. #endif
  609. #if MULTIPLE_PROBING > 1
  610. #if EXTRA_PROBING > 0
  611. #define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
  612. #else
  613. #define TOTAL_PROBING MULTIPLE_PROBING
  614. #endif
  615. #endif
  616. #else
  617. // Clear probe pin settings when no probe is selected
  618. #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
  619. #endif
  620. /**
  621. * Set granular options based on the specific type of leveling
  622. */
  623. #if ENABLED(AUTO_BED_LEVELING_UBL)
  624. #undef LCD_BED_LEVELING
  625. #if ENABLED(DELTA)
  626. #define UBL_SEGMENTED 1
  627. #endif
  628. #endif
  629. #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
  630. #define ABL_PLANAR 1
  631. #endif
  632. #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
  633. #define ABL_GRID 1
  634. #endif
  635. #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT)
  636. #define HAS_ABL_NOT_UBL 1
  637. #endif
  638. #if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
  639. #define HAS_MESH 1
  640. #endif
  641. #if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
  642. #define NEEDS_THREE_PROBE_POINTS 1
  643. #endif
  644. #if EITHER(HAS_ABL_NOT_UBL, AUTO_BED_LEVELING_UBL)
  645. #define HAS_ABL_OR_UBL 1
  646. #if DISABLED(PROBE_MANUALLY)
  647. #define HAS_AUTOLEVEL 1
  648. #endif
  649. #endif
  650. #if EITHER(HAS_ABL_OR_UBL, MESH_BED_LEVELING)
  651. #define HAS_LEVELING 1
  652. #if DISABLED(AUTO_BED_LEVELING_UBL)
  653. #define PLANNER_LEVELING 1
  654. #endif
  655. #endif
  656. #if EITHER(HAS_ABL_OR_UBL, Z_MIN_PROBE_REPEATABILITY_TEST)
  657. #define HAS_PROBING_PROCEDURE 1
  658. #endif
  659. #if !HAS_LEVELING
  660. #undef RESTORE_LEVELING_AFTER_G28
  661. #endif
  662. #ifdef GRID_MAX_POINTS_X
  663. #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
  664. #define GRID_LOOP(A,B) LOOP_L_N(A, GRID_MAX_POINTS_X) LOOP_L_N(B, GRID_MAX_POINTS_Y)
  665. #endif
  666. #ifndef INVERT_X_DIR
  667. #define INVERT_X_DIR false
  668. #endif
  669. #ifndef INVERT_Y_DIR
  670. #define INVERT_Y_DIR false
  671. #endif
  672. #ifndef INVERT_Z_DIR
  673. #define INVERT_Z_DIR false
  674. #endif
  675. #ifndef INVERT_E_DIR
  676. #define INVERT_E_DIR false
  677. #endif
  678. #if ENABLED(SLIM_LCD_MENUS)
  679. #define BOOT_MARLIN_LOGO_SMALL
  680. #endif
  681. // This flag indicates some kind of jerk storage is needed
  682. #if EITHER(CLASSIC_JERK, IS_KINEMATIC)
  683. #define HAS_CLASSIC_JERK 1
  684. #endif
  685. #if DISABLED(CLASSIC_JERK)
  686. #define HAS_JUNCTION_DEVIATION 1
  687. #endif
  688. // E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA
  689. #if ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))
  690. #define HAS_CLASSIC_E_JERK 1
  691. #endif
  692. #ifndef SPI_SPEED
  693. #define SPI_SPEED SPI_FULL_SPEED
  694. #endif
  695. #if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1
  696. #define HAS_USB_SERIAL 1
  697. #endif
  698. /**
  699. * This setting is also used by M109 when trying to calculate
  700. * a ballpark safe margin to prevent wait-forever situation.
  701. */
  702. #ifndef EXTRUDE_MINTEMP
  703. #define EXTRUDE_MINTEMP 170
  704. #endif