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.

ultralcd_DOGM.h 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2019 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. * ultralcd_DOGM.h
  24. */
  25. #include "../../inc/MarlinConfigPre.h"
  26. #include <U8glib.h>
  27. #include "HAL_LCD_class_defines.h"
  28. // LCD selection
  29. #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  30. #define U8G_CLASS U8GLIB_ST7920_128X64_4X
  31. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
  32. #define U8G_PARAM LCD_PINS_RS
  33. #else
  34. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
  35. #endif
  36. #elif ENABLED(U8GLIB_ST7920)
  37. // RepRap Discount Full Graphics Smart Controller
  38. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
  39. #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
  40. #define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
  41. #else
  42. //#define U8G_CLASS U8GLIB_ST7920_128X64_4X
  43. //#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Original u8glib device. 2 stripes, SW SPI
  44. #define U8G_CLASS U8GLIB_ST7920_128X64_RRD
  45. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
  46. // AVR version ignores these pin settings
  47. // HAL version uses these pin settings
  48. #endif
  49. #elif ENABLED(CARTESIO_UI)
  50. // The CartesioUI display
  51. //#define U8G_CLASS U8GLIB_DOGM128_2X
  52. //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
  53. #define U8G_CLASS U8GLIB_DOGM128_2X
  54. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
  55. #elif ENABLED(U8GLIB_LM6059_AF)
  56. // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
  57. //#define U8G_CLASS U8GLIB_LM6059
  58. //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
  59. #define U8G_CLASS U8GLIB_LM6059_2X
  60. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
  61. #elif ENABLED(U8GLIB_ST7565_64128N)
  62. // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
  63. #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
  64. #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
  65. #define U8G_CLASS U8GLIB_64128N_2X_HAL
  66. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // using HW-SPI
  67. #else
  68. #define U8G_CLASS U8GLIB_64128N_2X_HAL
  69. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // using SW-SPI
  70. #endif
  71. #elif ENABLED(MKS_12864OLED_SSD1306)
  72. // MKS 128x64 (SSD1306) OLED I2C LCD
  73. #define U8G_CLASS U8GLIB_SSD1306_128X64
  74. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
  75. //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
  76. //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
  77. #elif ENABLED(U8GLIB_SSD1306)
  78. // Generic support for SSD1306 OLED I2C LCDs
  79. //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE
  80. //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  81. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X
  82. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  83. #elif ENABLED(MKS_12864OLED)
  84. // MKS 128x64 (SH1106) OLED I2C LCD
  85. #define U8G_CLASS U8GLIB_SH1106_128X64
  86. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
  87. //#define U8G_CLASS U8GLIB_SH1106_128X64_2X
  88. //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
  89. #elif ENABLED(U8GLIB_SH1106)
  90. // Generic support for SH1106 OLED I2C LCDs
  91. //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE
  92. //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  93. #define U8G_CLASS U8GLIB_SH1106_128X64_2X
  94. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
  95. #elif ENABLED(U8GLIB_SSD1309)
  96. // Generic support for SSD1309 OLED I2C LCDs
  97. #define U8G_CLASS U8GLIB_SSD1309_128X64
  98. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
  99. #elif EITHER(MINIPANEL, FYSETC_MINI_12864)
  100. // The MINIPanel display
  101. //#define U8G_CLASS U8GLIB_MINI12864
  102. //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
  103. #define U8G_CLASS U8GLIB_MINI12864_2X
  104. #if EITHER(FYSETC_MINI_12864, TARGET_LPC1768)
  105. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes SW-SPI
  106. #else
  107. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes HW-SPI
  108. #endif
  109. #elif ENABLED(U8GLIB_SH1106_EINSTART)
  110. // Connected via motherboard header
  111. #define U8G_CLASS U8GLIB_SH1106_128X64
  112. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
  113. #elif ENABLED(MKS_ROBIN_TFT)
  114. // Unspecified 320x240 TFT pre-initialized by built-in bootloader
  115. #define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64
  116. #define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN
  117. #else
  118. // for regular DOGM128 display with HW-SPI
  119. //#define U8G_CLASS U8GLIB_DOGM128
  120. //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 8 stripes
  121. #define U8G_CLASS U8GLIB_DOGM128_2X
  122. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 4 stripes
  123. #endif
  124. #ifndef LCD_PIXEL_WIDTH
  125. #define LCD_PIXEL_WIDTH 128
  126. #endif
  127. #ifndef LCD_PIXEL_HEIGHT
  128. #define LCD_PIXEL_HEIGHT 64
  129. #endif
  130. // For selective rendering within a Y range
  131. #define PAGE_OVER(ya) ((ya) <= u8g.getU8g()->current_page.y1) // Does the current page follow a region top?
  132. #define PAGE_UNDER(yb) ((yb) >= u8g.getU8g()->current_page.y0) // Does the current page precede a region bottom?
  133. #define PAGE_CONTAINS(ya, yb) ((yb) >= u8g.getU8g()->current_page.y0 && (ya) <= u8g.getU8g()->current_page.y1) // Do two vertical regions overlap?
  134. // Only Western languages support big / small fonts
  135. #if DISABLED(DISPLAY_CHARSET_ISO10646_1)
  136. #undef USE_BIG_EDIT_FONT
  137. #undef USE_SMALL_INFOFONT
  138. #endif
  139. #define MENU_FONT_NAME ISO10646_1_5x7
  140. #define MENU_FONT_WIDTH 6
  141. #define MENU_FONT_ASCENT 10
  142. #define MENU_FONT_DESCENT 2
  143. #define MENU_FONT_HEIGHT (MENU_FONT_ASCENT + MENU_FONT_DESCENT)
  144. #if ENABLED(USE_BIG_EDIT_FONT)
  145. #define EDIT_FONT_NAME u8g_font_9x18
  146. #define EDIT_FONT_WIDTH 9
  147. #define EDIT_FONT_ASCENT 10
  148. #define EDIT_FONT_DESCENT 3
  149. #else
  150. #define EDIT_FONT_NAME MENU_FONT_NAME
  151. #define EDIT_FONT_WIDTH MENU_FONT_WIDTH
  152. #define EDIT_FONT_ASCENT MENU_FONT_ASCENT
  153. #define EDIT_FONT_DESCENT MENU_FONT_DESCENT
  154. #endif
  155. #define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT)
  156. // Get the Ascent, Descent, and total Height for the Info Screen font
  157. #if ENABLED(USE_SMALL_INFOFONT)
  158. extern const u8g_fntpgm_uint8_t u8g_font_6x9[];
  159. #define INFO_FONT_ASCENT 7
  160. #else
  161. #define INFO_FONT_ASCENT 8
  162. #endif
  163. #define INFO_FONT_DESCENT 2
  164. #define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
  165. #define INFO_FONT_WIDTH 6
  166. extern U8G_CLASS u8g;