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

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