PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/Marlin/Conditionals_LCD.h

https://gitlab.com/helios/Marlin
C Header | 319 lines | 223 code | 37 blank | 59 comment | 16 complexity | e1d849cf924578ae0776e454ccadc104 MD5 | raw file
  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. * LCD Defines that depend on configuration but are not editable.
  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. #ifndef ENCODER_PULSES_PER_STEP
  61. #define ENCODER_PULSES_PER_STEP 4
  62. #endif
  63. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  64. #define ENCODER_STEPS_PER_MENU_ITEM 1
  65. #endif
  66. #endif
  67. // Generic support for SSD1306 / SH1106 OLED based LCDs.
  68. #if ENABLED(U8GLIB_SSD1306) || ENABLED(U8GLIB_SH1106)
  69. #define ULTRA_LCD //general LCD support, also 16x2
  70. #define DOGLCD // Support for I2C LCD 128x64 (Controller SSD1306 / SH1106 graphic Display Family)
  71. #endif
  72. #if ENABLED(PANEL_ONE) || ENABLED(U8GLIB_SH1106)
  73. #define ULTIMAKERCONTROLLER
  74. #endif
  75. #if ENABLED(BQ_LCD_SMART_CONTROLLER)
  76. #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
  77. #ifndef ENCODER_PULSES_PER_STEP
  78. #define ENCODER_PULSES_PER_STEP 4
  79. #endif
  80. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  81. #define ENCODER_STEPS_PER_MENU_ITEM 1
  82. #endif
  83. #ifndef LONG_FILENAME_HOST_SUPPORT
  84. #define LONG_FILENAME_HOST_SUPPORT
  85. #endif
  86. #endif
  87. #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  88. #define DOGLCD
  89. #define U8GLIB_ST7920
  90. #define REPRAP_DISCOUNT_SMART_CONTROLLER
  91. #endif
  92. #if ENABLED(ULTIMAKERCONTROLLER) \
  93. || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
  94. || ENABLED(G3D_PANEL) \
  95. || ENABLED(RIGIDBOT_PANEL) \
  96. || ENABLED(REPRAPWORLD_KEYPAD)
  97. #define ULTIPANEL
  98. #define NEWPANEL
  99. #endif
  100. #if ENABLED(RA_CONTROL_PANEL)
  101. #define LCD_I2C_TYPE_PCA8574
  102. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  103. #define ULTIPANEL
  104. #define NEWPANEL
  105. #endif
  106. #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  107. #define DOGLCD
  108. #define U8GLIB_ST7920
  109. #define ULTIPANEL
  110. #define NEWPANEL
  111. #endif
  112. /**
  113. * I2C PANELS
  114. */
  115. #if ENABLED(LCD_I2C_SAINSMART_YWROBOT)
  116. // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
  117. // Make sure it is placed in the Arduino libraries directory.
  118. #define LCD_I2C_TYPE_PCF8575
  119. #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
  120. #define ULTIPANEL
  121. #define NEWPANEL
  122. #endif
  123. // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
  124. #if ENABLED(LCD_I2C_PANELOLU2)
  125. #define LCD_I2C_TYPE_MCP23017
  126. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  127. #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
  128. #ifndef ENCODER_PULSES_PER_STEP
  129. #define ENCODER_PULSES_PER_STEP 4
  130. #endif
  131. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  132. #define ENCODER_STEPS_PER_MENU_ITEM 1
  133. #endif
  134. #define ULTIPANEL
  135. #define NEWPANEL
  136. #endif
  137. // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
  138. #if ENABLED(LCD_I2C_VIKI)
  139. // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
  140. // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
  141. // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
  142. // BTN_ENC pin (or set BTN_ENC to -1 if not used)
  143. #define LCD_I2C_TYPE_MCP23017
  144. #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
  145. #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
  146. #define ULTIPANEL
  147. #define NEWPANEL
  148. #define ENCODER_FEEDRATE_DEADZONE 4
  149. #ifndef ENCODER_PULSES_PER_STEP
  150. #define ENCODER_PULSES_PER_STEP 1
  151. #endif
  152. #ifndef ENCODER_STEPS_PER_MENU_ITEM
  153. #define ENCODER_STEPS_PER_MENU_ITEM 2
  154. #endif
  155. #endif
  156. // Shift register panels
  157. // ---------------------
  158. // 2 wire Non-latching LCD SR from:
  159. // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
  160. #if ENABLED(SAV_3DLCD)
  161. #define SR_LCD_2W_NL // Non latching 2 wire shift register
  162. #define ULTIPANEL
  163. #define NEWPANEL
  164. #endif
  165. #if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
  166. #ifndef LCD_WIDTH
  167. #define LCD_WIDTH 22
  168. #endif
  169. #ifndef LCD_HEIGHT
  170. #define LCD_HEIGHT 5
  171. #endif
  172. #endif
  173. #if ENABLED(ULTIPANEL)
  174. #define NEWPANEL //enable this if you have a click-encoder panel
  175. #define ULTRA_LCD
  176. #ifndef LCD_WIDTH
  177. #define LCD_WIDTH 20
  178. #endif
  179. #ifndef LCD_HEIGHT
  180. #define LCD_HEIGHT 4
  181. #endif
  182. #else //no panel but just LCD
  183. #if ENABLED(ULTRA_LCD)
  184. #ifndef LCD_WIDTH
  185. #define LCD_WIDTH 16
  186. #endif
  187. #ifndef LCD_HEIGHT
  188. #define LCD_HEIGHT 2
  189. #endif
  190. #endif
  191. #endif
  192. #if ENABLED(DOGLCD)
  193. /* Custom characters defined in font dogm_font_data_Marlin_symbols.h / Marlin_symbols.fon */
  194. // \x00 intentionally skipped to avoid problems in strings
  195. #define LCD_STR_REFRESH "\x01"
  196. #define LCD_STR_FOLDER "\x02"
  197. #define LCD_STR_ARROW_RIGHT "\x03"
  198. #define LCD_STR_UPLEVEL "\x04"
  199. #define LCD_STR_CLOCK "\x05"
  200. #define LCD_STR_FEEDRATE "\x06"
  201. #define LCD_STR_BEDTEMP "\x07"
  202. #define LCD_STR_THERMOMETER "\x08"
  203. #define LCD_STR_DEGREE "\x09"
  204. #define LCD_STR_SPECIAL_MAX '\x09'
  205. // Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
  206. // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
  207. #else
  208. /* Custom characters defined in the first 8 characters of the LCD */
  209. #define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string!
  210. #define LCD_STR_DEGREE "\x01"
  211. #define LCD_STR_THERMOMETER "\x02"
  212. #define LCD_STR_UPLEVEL "\x03"
  213. #define LCD_STR_REFRESH "\x04"
  214. #define LCD_STR_FOLDER "\x05"
  215. #define LCD_STR_FEEDRATE "\x06"
  216. #define LCD_STR_CLOCK "\x07"
  217. #define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
  218. #endif
  219. /**
  220. * Default LCD contrast for dogm-like LCD displays
  221. */
  222. #if ENABLED(DOGLCD)
  223. #define HAS_LCD_CONTRAST ( \
  224. ENABLED(MAKRPANEL) \
  225. || ENABLED(CARTESIO_UI) \
  226. || ENABLED(VIKI2) \
  227. || ENABLED(miniVIKI) \
  228. || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
  229. )
  230. #if HAS_LCD_CONTRAST
  231. #ifndef LCD_CONTRAST_MIN
  232. #define LCD_CONTRAST_MIN 0
  233. #endif
  234. #ifndef LCD_CONTRAST_MAX
  235. #define LCD_CONTRAST_MAX 63
  236. #endif
  237. #ifndef DEFAULT_LCD_CONTRAST
  238. #define DEFAULT_LCD_CONTRAST 32
  239. #endif
  240. #endif
  241. #endif
  242. #ifndef BOOTSCREEN_TIMEOUT
  243. #define BOOTSCREEN_TIMEOUT 2500
  244. #endif
  245. /**
  246. * Extruders have some combination of stepper motors and hotends
  247. * so we separate these concepts into the defines:
  248. *
  249. * EXTRUDERS - Number of Selectable Tools
  250. * HOTENDS - Number of hotends, whether connected or separate
  251. * E_STEPPERS - Number of actual E stepper motors
  252. * TOOL_E_INDEX - Index to use when getting/setting the tool state
  253. *
  254. */
  255. #if ENABLED(SINGLENOZZLE) // One hotend, multi-extruder
  256. #define HOTENDS 1
  257. #define E_STEPPERS EXTRUDERS
  258. #define E_MANUAL EXTRUDERS
  259. #define TOOL_E_INDEX current_block->active_extruder
  260. #undef TEMP_SENSOR_1_AS_REDUNDANT
  261. #undef HOTEND_OFFSET_X
  262. #undef HOTEND_OFFSET_Y
  263. #elif ENABLED(SWITCHING_EXTRUDER) // One E stepper, unified E axis, two hotends
  264. #define HOTENDS EXTRUDERS
  265. #define E_STEPPERS 1
  266. #define E_MANUAL 1
  267. #define TOOL_E_INDEX 0
  268. #ifndef HOTEND_OFFSET_Z
  269. #define HOTEND_OFFSET_Z { 0 }
  270. #endif
  271. #elif ENABLED(MIXING_EXTRUDER) // Multi-stepper, unified E axis, one hotend
  272. #define HOTENDS 1
  273. #define E_STEPPERS MIXING_STEPPERS
  274. #define E_MANUAL 1
  275. #define TOOL_E_INDEX 0
  276. #else // One stepper, E axis, and hotend per tool
  277. #define HOTENDS EXTRUDERS
  278. #define E_STEPPERS EXTRUDERS
  279. #define E_MANUAL EXTRUDERS
  280. #define TOOL_E_INDEX current_block->active_extruder
  281. #endif
  282. #endif //CONDITIONALS_LCD_H