My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ultralcd_DOGM.h 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. #pragma once
  23. /**
  24. * lcd/dogm/ultralcd_DOGM.h
  25. */
  26. #include "../../inc/MarlinConfigPre.h"
  27. #include <U8glib.h>
  28. #include "HAL_LCD_class_defines.h"
  29. //#define ALTERNATIVE_LCD
  30. #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  31. #define U8G_CLASS U8GLIB_ST7920_128X64_4X
  32. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
  33. #define U8G_PARAM LCD_PINS_RS
  34. #else
  35. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
  36. #endif
  37. #elif ENABLED(U8GLIB_ST7920)
  38. // RepRap Discount Full Graphics Smart Controller
  39. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
  40. #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL // 2 stripes, HW SPI (Shared with SD card. Non-standard LCD adapter on AVR.)
  41. #define U8G_PARAM LCD_PINS_RS
  42. #else
  43. #if ENABLED(ALTERNATIVE_LCD)
  44. #define U8G_CLASS U8GLIB_ST7920_128X64_4X // 2 stripes, SW SPI (Original u8glib device)
  45. #else
  46. #define U8G_CLASS U8GLIB_ST7920_128X64_RRD // Adjust stripes with PAGE_HEIGHT in ultralcd_st7920_u8glib_rrd.h
  47. #endif
  48. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // AVR version ignores these pin settings
  49. // HAL version uses these pin settings
  50. #endif
  51. #elif ENABLED(CARTESIO_UI)
  52. // CartesioUI LCD
  53. #if ENABLED(ALTERNATIVE_LCD)
  54. #define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes
  55. #define FORCE_SOFT_SPI // SW-SPI
  56. #else
  57. #define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes (HW-SPI)
  58. #endif
  59. #elif ENABLED(U8GLIB_LM6059_AF)
  60. // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
  61. #if ENABLED(ALTERNATIVE_LCD)
  62. #define U8G_CLASS U8GLIB_LM6059 // 8 stripes (HW-SPI)
  63. #else
  64. #define U8G_CLASS U8GLIB_LM6059_2X // 4 stripes (HW-SPI)
  65. #endif
  66. #elif ENABLED(U8GLIB_ST7565_64128N)
  67. // MaKrPanel, Mini Viki, Viki 2.0, AZSMZ 12864 ST7565 controller
  68. #define SMART_RAMPS MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF)
  69. #define U8G_CLASS U8GLIB_64128N_2X_HAL // 4 stripes (HW-SPI)
  70. #if SMART_RAMPS || DOGLCD_SCK != SCK_PIN || DOGLCD_MOSI != MOSI_PIN
  71. #define FORCE_SOFT_SPI // SW-SPI
  72. #endif
  73. #elif ENABLED(MKS_12864OLED_SSD1306)
  74. // MKS 128x64 (SSD1306) OLED I2C LCD
  75. #define FORCE_SOFT_SPI // SW-SPI
  76. #if ENABLED(ALTERNATIVE_LCD)
  77. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
  78. #else
  79. #define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes
  80. #endif
  81. #elif ENABLED(U8GLIB_SSD1306)
  82. // Generic SSD1306 OLED I2C LCD
  83. #if ENABLED(ALTERNATIVE_LCD)
  84. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE // 4 stripes
  85. #else
  86. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
  87. #endif
  88. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
  89. #elif ENABLED(MKS_12864OLED)
  90. // MKS 128x64 (SH1106) OLED I2C LCD
  91. #define FORCE_SOFT_SPI // SW-SPI
  92. #if ENABLED(ALTERNATIVE_LCD)
  93. #define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
  94. #else
  95. #define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
  96. #endif
  97. #elif ENABLED(U8GLIB_SH1106)
  98. // Generic SH1106 OLED I2C LCD
  99. #if ENABLED(ALTERNATIVE_LCD)
  100. #define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE // 4 stripes
  101. #else
  102. #define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
  103. #endif
  104. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C
  105. #elif ENABLED(U8GLIB_SSD1309)
  106. // Generic support for SSD1309 OLED I2C LCDs
  107. #define U8G_CLASS U8GLIB_SSD1309_128X64
  108. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C
  109. #elif ENABLED(FYSETC_MINI_12864)
  110. // The FYSETC Mini 12864 display
  111. #define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 4 stripes
  112. #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
  113. // The MKS_MINI_12864 V1/V2 aren't exact copies of the MiniPanel.
  114. // Panel management is in u8g_dev_uc1701_mini12864_HAL.cpp with
  115. // extra delays added to remove glitches seen with fast MCUs.
  116. #define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 8 stripes (HW-SPI)
  117. #elif ENABLED(MINIPANEL)
  118. #if ENABLED(ALTERNATIVE_LCD)
  119. #define U8G_CLASS U8GLIB_MINI12864
  120. #else
  121. #define U8G_CLASS U8GLIB_MINI12864_2X // 8 stripes (HW-SPI)
  122. #endif
  123. #elif ENABLED(U8GLIB_SH1106_EINSTART)
  124. // Connected via motherboard header
  125. #define U8G_CLASS U8GLIB_SH1106_128X64
  126. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
  127. #elif ENABLED(FSMC_GRAPHICAL_TFT)
  128. // Unspecified 320x240 TFT pre-initialized by built-in bootloader
  129. #define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64
  130. #define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN
  131. #else
  132. #if ENABLED(ALTERNATIVE_LCD)
  133. #define U8G_CLASS U8GLIB_DOGM128 // 8 stripes (HW-SPI)
  134. #else
  135. #define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes (HW-SPI)
  136. #endif
  137. #endif
  138. // Use HW-SPI if no other option is specified
  139. #ifndef U8G_PARAM
  140. #if ENABLED(FORCE_SOFT_SPI)
  141. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // SW-SPI
  142. #else
  143. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI
  144. #endif
  145. #endif
  146. #ifndef LCD_PIXEL_WIDTH
  147. #define LCD_PIXEL_WIDTH 128
  148. #endif
  149. #ifndef LCD_PIXEL_HEIGHT
  150. #define LCD_PIXEL_HEIGHT 64
  151. #endif
  152. // LCD_FULL_PIXEL_WIDTH =
  153. // LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X
  154. #if ENABLED(FSMC_GRAPHICAL_TFT)
  155. #define LCD_FULL_PIXEL_WIDTH 320
  156. #define LCD_PIXEL_OFFSET_X 32
  157. #define LCD_FULL_PIXEL_HEIGHT 240
  158. #define LCD_PIXEL_OFFSET_Y 32
  159. #endif
  160. // For selective rendering within a Y range
  161. #define PAGE_OVER(ya) ((ya) <= u8g.getU8g()->current_page.y1) // Does the current page follow a region top?
  162. #define PAGE_UNDER(yb) ((yb) >= u8g.getU8g()->current_page.y0) // Does the current page precede a region bottom?
  163. #define PAGE_CONTAINS(ya, yb) ((yb) >= u8g.getU8g()->current_page.y0 && (ya) <= u8g.getU8g()->current_page.y1) // Do two vertical regions overlap?
  164. // Only Western languages support big / small fonts
  165. #if DISABLED(DISPLAY_CHARSET_ISO10646_1)
  166. #undef USE_BIG_EDIT_FONT
  167. #undef USE_SMALL_INFOFONT
  168. #endif
  169. #define MENU_FONT_NAME ISO10646_1_5x7
  170. #define MENU_FONT_WIDTH 6
  171. #define MENU_FONT_ASCENT 10
  172. #define MENU_FONT_DESCENT 2
  173. #define MENU_FONT_HEIGHT (MENU_FONT_ASCENT + MENU_FONT_DESCENT)
  174. #if ENABLED(USE_BIG_EDIT_FONT)
  175. #define EDIT_FONT_NAME u8g_font_9x18
  176. #define EDIT_FONT_WIDTH 9
  177. #define EDIT_FONT_ASCENT 10
  178. #define EDIT_FONT_DESCENT 3
  179. #else
  180. #define EDIT_FONT_NAME MENU_FONT_NAME
  181. #define EDIT_FONT_WIDTH MENU_FONT_WIDTH
  182. #define EDIT_FONT_ASCENT MENU_FONT_ASCENT
  183. #define EDIT_FONT_DESCENT MENU_FONT_DESCENT
  184. #endif
  185. #define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT)
  186. // Get the Ascent, Descent, and total Height for the Info Screen font
  187. #if ENABLED(USE_SMALL_INFOFONT)
  188. extern const u8g_fntpgm_uint8_t u8g_font_6x9[];
  189. #define INFO_FONT_ASCENT 7
  190. #else
  191. #define INFO_FONT_ASCENT 8
  192. #endif
  193. #define INFO_FONT_DESCENT 2
  194. #define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
  195. #define INFO_FONT_WIDTH 6
  196. extern U8G_CLASS u8g;