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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * Conditionals_LCD.h
  24. * Conditionals that need to be set before Configuration_adv.h or pins.h
  25. */
  26. #ifndef CONDITIONALS_LCD_H // Get the LCD defines which are needed first
  27. #define CONDITIONALS_LCD_H
  28. #define LCD_HAS_DIRECTIONAL_BUTTONS (BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT))
  29. #if ENABLED(CARTESIO_UI)
  30. #define DOGLCD
  31. #define ULTIPANEL
  32. #define NEWPANEL
  33. #define DEFAULT_LCD_CONTRAST 90
  34. #define LCD_CONTRAST_MIN 60
  35. #define LCD_CONTRAST_MAX 140
  36. #elif ENABLED(MAKRPANEL)
  37. #define DOGLCD
  38. #define ULTIPANEL
  39. #define NEWPANEL
  40. #define DEFAULT_LCD_CONTRAST 17
  41. #define U8GLIB_ST7565_64128N
  42. #elif ENABLED(MINIPANEL)
  43. #define DOGLCD
  44. #define ULTIPANEL
  45. #define NEWPANEL
  46. #define DEFAULT_LCD_CONTRAST 17
  47. #elif ENABLED(ANET_KEYPAD_LCD)
  48. #define REPRAPWORLD_KEYPAD
  49. #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
  50. #define ADC_KEYPAD
  51. #define ADC_KEY_NUM 8
  52. #define ULTIPANEL
  53. // this helps to implement ADC_KEYPAD menus
  54. #define ENCODER_STEPS_PER_MENU_ITEM 1
  55. #define REVERSE_MENU_DIRECTION
  56. #elif ENABLED(ANET_FULL_GRAPHICS_LCD)
  57. #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
  58. #elif ENABLED(BQ_LCD_SMART_CONTROLLER)
  59. #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
  60. #define LONG_FILENAME_HOST_SUPPORT
  61. #elif ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
  62. #define ULTRA_LCD //general LCD support, also 16x2
  63. #define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
  64. #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
  65. #if ENABLED(miniVIKI)
  66. #define LCD_CONTRAST_MIN 75
  67. #define LCD_CONTRAST_MAX 115
  68. #define DEFAULT_LCD_CONTRAST 95
  69. #define U8GLIB_ST7565_64128N
  70. #elif ENABLED(VIKI2)
  71. #define LCD_CONTRAST_MIN 0
  72. #define LCD_CONTRAST_MAX 255
  73. #define DEFAULT_LCD_CONTRAST 140
  74. #define U8GLIB_ST7565_64128N
  75. #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
  76. #define LCD_CONTRAST_MIN 90
  77. #define LCD_CONTRAST_MAX 130
  78. #define DEFAULT_LCD_CONTRAST 110
  79. #define U8GLIB_LM6059_AF
  80. #define SD_DETECT_INVERTED
  81. #endif
  82. #elif ENABLED(OLED_PANEL_TINYBOY2)
  83. #define U8GLIB_SSD1306
  84. #define ULTIPANEL
  85. #define NEWPANEL
  86. #define REVERSE_ENCODER_DIRECTION
  87. #define REVERSE_MENU_DIRECTION
  88. #elif ENABLED(RA_CONTROL_PANEL)
  89. #define LCD_I2C_TYPE_PCA8574
  90. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  91. #define ULTIPANEL
  92. #define NEWPANEL
  93. #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  94. #define DOGLCD
  95. #define U8GLIB_ST7920
  96. #define ULTIPANEL
  97. #define NEWPANEL
  98. #endif
  99. // Generic support for SSD1306 / SH1106 OLED based LCDs.
  100. #if ENABLED(U8GLIB_SSD1306) || ENABLED(U8GLIB_SH1106)
  101. #define ULTRA_LCD //general LCD support, also 16x2
  102. #define DOGLCD // Support for I2C LCD 128x64 (Controller SSD1306 / SH1106 graphic Display Family)
  103. #endif
  104. #if ENABLED(PANEL_ONE) || ENABLED(U8GLIB_SH1106)
  105. #define ULTIMAKERCONTROLLER
  106. #endif
  107. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(LCD_FOR_MELZI)
  108. #define DOGLCD
  109. #define U8GLIB_ST7920
  110. #define REPRAP_DISCOUNT_SMART_CONTROLLER
  111. #endif
  112. #if ENABLED(ULTIMAKERCONTROLLER) \
  113. || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
  114. || ENABLED(G3D_PANEL) \
  115. || ENABLED(RIGIDBOT_PANEL)
  116. #define ULTIPANEL
  117. #define NEWPANEL
  118. #endif
  119. #if ENABLED(REPRAPWORLD_KEYPAD)
  120. #define NEWPANEL
  121. #if ENABLED(ULTIPANEL) && !defined(REPRAPWORLD_KEYPAD_MOVE_STEP)
  122. #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0
  123. #endif
  124. #endif
  125. /**
  126. * I2C PANELS
  127. */
  128. #if ENABLED(LCD_I2C_SAINSMART_YWROBOT)
  129. // Note: This controller requires F.Malpartida's LiquidCrystal_I2C library
  130. // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
  131. #define LCD_I2C_TYPE_PCF8575
  132. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  133. #define ULTIPANEL
  134. #define NEWPANEL
  135. #elif ENABLED(LCD_I2C_PANELOLU2)
  136. // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
  137. #define LCD_I2C_TYPE_MCP23017
  138. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  139. #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
  140. #define ULTIPANEL
  141. #define NEWPANEL
  142. #elif ENABLED(LCD_I2C_VIKI)
  143. /**
  144. * Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
  145. *
  146. * This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
  147. * Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
  148. * Note: The pause/stop/resume LCD button pin should be connected to the Arduino
  149. * BTN_ENC pin (or set BTN_ENC to -1 if not used)
  150. */
  151. #define LCD_I2C_TYPE_MCP23017
  152. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  153. #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
  154. #define ULTIPANEL
  155. #define NEWPANEL
  156. #define ENCODER_FEEDRATE_DEADZONE 4
  157. #ifndef ENCODER_PULSES_PER_STEP
  158. #define ENCODER_PULSES_PER_STEP 1
  159. #endif
  160. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  161. #define ENCODER_STEPS_PER_MENU_ITEM 2
  162. #endif
  163. #endif
  164. // Set encoder detents for well-known controllers
  165. #if ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) || ENABLED(OLED_PANEL_TINYBOY2) \
  166. || ENABLED(BQ_LCD_SMART_CONTROLLER) || ENABLED(LCD_I2C_PANELOLU2) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
  167. #ifndef ENCODER_PULSES_PER_STEP
  168. #define ENCODER_PULSES_PER_STEP 4
  169. #endif
  170. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  171. #define ENCODER_STEPS_PER_MENU_ITEM 1
  172. #endif
  173. #endif
  174. // Shift register panels
  175. // ---------------------
  176. // 2 wire Non-latching LCD SR from:
  177. // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
  178. #if ENABLED(SAV_3DLCD)
  179. #define SR_LCD_2W_NL // Non latching 2 wire shift register
  180. #define ULTIPANEL
  181. #define NEWPANEL
  182. #endif
  183. #if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
  184. #ifndef LCD_WIDTH
  185. #define LCD_WIDTH 22
  186. #endif
  187. #ifndef LCD_HEIGHT
  188. #define LCD_HEIGHT 5
  189. #endif
  190. #endif
  191. #if ENABLED(ULTIPANEL)
  192. #define NEWPANEL //enable this if you have a click-encoder panel
  193. #define ULTRA_LCD
  194. #ifndef LCD_WIDTH
  195. #define LCD_WIDTH 20
  196. #endif
  197. #ifndef LCD_HEIGHT
  198. #define LCD_HEIGHT 4
  199. #endif
  200. #else // no panel but just LCD
  201. #if ENABLED(ULTRA_LCD)
  202. #ifndef LCD_WIDTH
  203. #define LCD_WIDTH 16
  204. #endif
  205. #ifndef LCD_HEIGHT
  206. #define LCD_HEIGHT 2
  207. #endif
  208. #endif
  209. #endif
  210. #if ENABLED(DOGLCD)
  211. /* Custom characters defined in font dogm_font_data_Marlin_symbols.h / Marlin_symbols.fon */
  212. // \x00 intentionally skipped to avoid problems in strings
  213. #define LCD_STR_REFRESH "\x01"
  214. #define LCD_STR_FOLDER "\x02"
  215. #define LCD_STR_ARROW_RIGHT "\x03"
  216. #define LCD_STR_UPLEVEL "\x04"
  217. #define LCD_STR_CLOCK "\x05"
  218. #define LCD_STR_FEEDRATE "\x06"
  219. #define LCD_STR_BEDTEMP "\x07"
  220. #define LCD_STR_THERMOMETER "\x08"
  221. #define LCD_STR_DEGREE "\x09"
  222. #define LCD_STR_SPECIAL_MAX '\x09'
  223. // Maximum here is 0x1F because 0x20 is ' ' (space) and the normal charsets begin.
  224. // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
  225. // Symbol characters
  226. #define LCD_STR_FILAM_DIA "\xf8"
  227. #define LCD_STR_FILAM_MUL "\xa4"
  228. #else
  229. /* Custom characters defined in the first 8 characters of the LCD */
  230. #define LCD_BEDTEMP_CHAR 0x00 // Print only as a char. This will have 'unexpected' results when used in a string!
  231. #define LCD_DEGREE_CHAR 0x01
  232. #define LCD_STR_THERMOMETER "\x02" // Still used with string concatenation
  233. #define LCD_UPLEVEL_CHAR 0x03
  234. #define LCD_STR_REFRESH "\x04"
  235. #define LCD_STR_FOLDER "\x05"
  236. #define LCD_FEEDRATE_CHAR 0x06
  237. #define LCD_CLOCK_CHAR 0x07
  238. #define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
  239. #endif
  240. /**
  241. * Default LCD contrast for dogm-like LCD displays
  242. */
  243. #if ENABLED(DOGLCD)
  244. #define HAS_LCD_CONTRAST ( \
  245. ENABLED(MAKRPANEL) \
  246. || ENABLED(CARTESIO_UI) \
  247. || ENABLED(VIKI2) \
  248. || ENABLED(miniVIKI) \
  249. || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
  250. )
  251. #if HAS_LCD_CONTRAST
  252. #ifndef LCD_CONTRAST_MIN
  253. #define LCD_CONTRAST_MIN 0
  254. #endif
  255. #ifndef LCD_CONTRAST_MAX
  256. #define LCD_CONTRAST_MAX 63
  257. #endif
  258. #ifndef DEFAULT_LCD_CONTRAST
  259. #define DEFAULT_LCD_CONTRAST 32
  260. #endif
  261. #endif
  262. #endif
  263. // Boot screens
  264. #if DISABLED(ULTRA_LCD)
  265. #undef SHOW_BOOTSCREEN
  266. #elif !defined(BOOTSCREEN_TIMEOUT)
  267. #define BOOTSCREEN_TIMEOUT 2500
  268. #endif
  269. #define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
  270. // MK2 Multiplexer forces SINGLENOZZLE to be enabled
  271. #if ENABLED(MK2_MULTIPLEXER)
  272. #define SINGLENOZZLE
  273. #endif
  274. /**
  275. * Extruders have some combination of stepper motors and hotends
  276. * so we separate these concepts into the defines:
  277. *
  278. * EXTRUDERS - Number of Selectable Tools
  279. * HOTENDS - Number of hotends, whether connected or separate
  280. * E_STEPPERS - Number of actual E stepper motors
  281. * E_MANUAL - Number of E steppers for LCD move options
  282. * TOOL_E_INDEX - Index to use when getting/setting the tool state
  283. *
  284. */
  285. #if ENABLED(SINGLENOZZLE) || ENABLED(MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset
  286. #define HOTENDS 1
  287. #undef TEMP_SENSOR_1_AS_REDUNDANT
  288. #undef HOTEND_OFFSET_X
  289. #undef HOTEND_OFFSET_Y
  290. #else // Two hotends
  291. #define HOTENDS EXTRUDERS
  292. #if ENABLED(SWITCHING_NOZZLE) && !defined(HOTEND_OFFSET_Z)
  293. #define HOTEND_OFFSET_Z { 0 }
  294. #endif
  295. #endif
  296. #define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
  297. #if HOTENDS == 1
  298. #define HOTEND_INDEX 0
  299. #else
  300. #define HOTEND_INDEX e
  301. #endif
  302. #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(MIXING_EXTRUDER) // Unified E axis
  303. #if ENABLED(MIXING_EXTRUDER)
  304. #define E_STEPPERS MIXING_STEPPERS
  305. #else
  306. #define E_STEPPERS 1 // One E stepper
  307. #endif
  308. #define E_MANUAL 1
  309. #define TOOL_E_INDEX 0
  310. #else
  311. #define E_STEPPERS EXTRUDERS
  312. #define E_MANUAL EXTRUDERS
  313. #define TOOL_E_INDEX current_block->active_extruder
  314. #endif
  315. /**
  316. * DISTINCT_E_FACTORS affects how some E factors are accessed
  317. */
  318. #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
  319. #define XYZE_N (XYZ + E_STEPPERS)
  320. #define E_AXIS_N (E_AXIS + extruder)
  321. #else
  322. #undef DISTINCT_E_FACTORS
  323. #define XYZE_N XYZE
  324. #define E_AXIS_N E_AXIS
  325. #endif
  326. /**
  327. * The BLTouch Probe emulates a servo probe
  328. * and uses "special" angles for its state.
  329. */
  330. #if ENABLED(BLTOUCH)
  331. #ifndef Z_ENDSTOP_SERVO_NR
  332. #define Z_ENDSTOP_SERVO_NR 0
  333. #endif
  334. #ifndef NUM_SERVOS
  335. #define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
  336. #endif
  337. #undef DEACTIVATE_SERVOS_AFTER_MOVE
  338. #if NUM_SERVOS == 1
  339. #undef SERVO_DELAY
  340. #define SERVO_DELAY { 50 }
  341. #endif
  342. #ifndef BLTOUCH_DELAY
  343. #define BLTOUCH_DELAY 375
  344. #endif
  345. #undef Z_SERVO_ANGLES
  346. #define Z_SERVO_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW }
  347. #define BLTOUCH_DEPLOY 10
  348. #define BLTOUCH_STOW 90
  349. #define BLTOUCH_SELFTEST 120
  350. #define BLTOUCH_RESET 160
  351. #define _TEST_BLTOUCH(P) (READ(P##_PIN) != P##_ENDSTOP_INVERTING)
  352. // Always disable probe pin inverting for BLTouch
  353. #undef Z_MIN_PROBE_ENDSTOP_INVERTING
  354. #define Z_MIN_PROBE_ENDSTOP_INVERTING false
  355. #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
  356. #undef Z_MIN_ENDSTOP_INVERTING
  357. #define Z_MIN_ENDSTOP_INVERTING false
  358. #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN)
  359. #else
  360. #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN_PROBE)
  361. #endif
  362. #endif
  363. /**
  364. * Set a flag for a servo probe
  365. */
  366. #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
  367. /**
  368. * UBL has its own manual probing, so this just causes trouble.
  369. */
  370. #if ENABLED(AUTO_BED_LEVELING_UBL)
  371. #undef PROBE_MANUALLY
  372. #endif
  373. /**
  374. * Set a flag for any enabled probe
  375. */
  376. #define PROBE_SELECTED (ENABLED(PROBE_MANUALLY) || ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE))
  377. /**
  378. * Clear probe pin settings when no probe is selected
  379. */
  380. #if !PROBE_SELECTED || ENABLED(PROBE_MANUALLY)
  381. #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
  382. #undef Z_MIN_PROBE_ENDSTOP
  383. #endif
  384. #define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS))
  385. #define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER))
  386. #define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_RGBW_LED))
  387. #endif // CONDITIONALS_LCD_H