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

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