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

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