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

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