My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

marlinui_DOGM.h 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * lcd/dogm/marlinui_DOGM.h
  25. */
  26. #include "../../inc/MarlinConfigPre.h"
  27. #include <U8glib-HAL.h>
  28. #include "HAL_LCD_class_defines.h"
  29. //#define ALTERNATIVE_LCD
  30. #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  31. // RepRapWorld Graphical LCD
  32. #define U8G_CLASS U8GLIB_ST7920_128X64_4X
  33. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN)
  34. #define U8G_PARAM LCD_PINS_RS
  35. #else
  36. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
  37. #endif
  38. #elif IS_U8GLIB_ST7920
  39. // RepRap Discount Full Graphics Smart Controller
  40. // and other variant LCDs using ST7920
  41. #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN)
  42. #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL // 2 stripes, HW SPI (Shared with SD card. Non-standard LCD adapter on AVR.)
  43. #define U8G_PARAM LCD_PINS_RS
  44. #else
  45. #if ENABLED(ALTERNATIVE_LCD)
  46. #define U8G_CLASS U8GLIB_ST7920_128X64_4X // 2 stripes, SW SPI (Original u8glib device)
  47. #else
  48. #define U8G_CLASS U8GLIB_ST7920_128X64_RRD // Adjust stripes with PAGE_HEIGHT in ultralcd_st7920_u8glib_rrd.h
  49. #endif
  50. #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // AVR version ignores these pin settings
  51. // HAL version uses these pin settings
  52. #endif
  53. #elif ENABLED(CARTESIO_UI)
  54. // CartesioUI LCD
  55. #if ENABLED(ALTERNATIVE_LCD)
  56. #define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes
  57. #define FORCE_SOFT_SPI // SW-SPI
  58. #else
  59. #define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes (HW-SPI)
  60. #endif
  61. #elif IS_U8GLIB_LM6059_AF
  62. // Based on the Adafruit ST7565 (https://www.adafruit.com/products/250)
  63. #if ENABLED(ALTERNATIVE_LCD)
  64. #define U8G_CLASS U8GLIB_LM6059 // 8 stripes (HW-SPI)
  65. #else
  66. #define U8G_CLASS U8GLIB_LM6059_2X // 4 stripes (HW-SPI)
  67. #endif
  68. #elif IS_U8GLIB_ST7565_64128N
  69. // MaKrPanel, Mini Viki, Viki 2.0, AZSMZ 12864 ST7565 controller
  70. #define SMART_RAMPS MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF)
  71. #define U8G_CLASS U8GLIB_64128N_2X_HAL // 4 stripes (HW-SPI)
  72. #if (SMART_RAMPS && defined(__SAM3X8E__)) || DOGLCD_SCK != SD_SCK_PIN || DOGLCD_MOSI != SD_MOSI_PIN
  73. #define FORCE_SOFT_SPI // SW-SPI
  74. #endif
  75. #elif ANY(FYSETC_MINI_12864, MKS_MINI_12864, ENDER2_STOCKDISPLAY)
  76. // The FYSETC Mini 12864 display // "4 stripes"
  77. // The MKS_MINI_12864 V1/V2 aren't exact copies of the MiniPanel.
  78. // Panel management is in u8g_dev_uc1701_mini12864_HAL.cpp with
  79. // extra delays added to remove glitches seen with fast MCUs.
  80. #define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 8 stripes (HW-SPI)
  81. #elif ENABLED(MINIPANEL)
  82. #if ENABLED(ALTERNATIVE_LCD)
  83. #define U8G_CLASS U8GLIB_MINI12864
  84. #else
  85. #define U8G_CLASS U8GLIB_MINI12864_2X // 8 stripes (HW-SPI)
  86. #endif
  87. #elif ENABLED(MKS_12864OLED_SSD1306)
  88. // MKS 128x64 (SSD1306) OLED I2C LCD
  89. #define FORCE_SOFT_SPI // SW-SPI
  90. #if ENABLED(ALTERNATIVE_LCD)
  91. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
  92. #else
  93. #define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes
  94. #endif
  95. #elif EITHER(FYSETC_242_OLED_12864, K3D_242_OLED_CONTROLLER)
  96. // FYSETC OLED 2.42" 128 × 64 Full Graphics Controller
  97. // or K3D OLED 2.42" 128 × 64 Full Graphics Controller
  98. #define FORCE_SOFT_SPI // SW-SPI
  99. #if ENABLED(ALTERNATIVE_LCD)
  100. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
  101. #else
  102. #define U8G_CLASS U8GLIB_SSD1309_128X64_HAL
  103. #endif
  104. #elif ENABLED(ZONESTAR_12864OLED_SSD1306)
  105. // Zonestar SSD1306 OLED SPI LCD
  106. #define FORCE_SOFT_SPI // SW-SPI
  107. #if ENABLED(ALTERNATIVE_LCD)
  108. #define U8G_CLASS U8GLIB_SH1306_128X64_2X // 4 stripes
  109. #else
  110. #define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes
  111. #endif
  112. #elif EITHER(MKS_12864OLED, ZONESTAR_12864OLED)
  113. // MKS 128x64 (SH1106) OLED I2C LCD
  114. // - or -
  115. // Zonestar SH1106 OLED SPI LCD
  116. #define FORCE_SOFT_SPI // SW-SPI
  117. #if ENABLED(ALTERNATIVE_LCD)
  118. #define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
  119. #else
  120. #define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
  121. #endif
  122. #elif ENABLED(U8GLIB_SH1106_EINSTART)
  123. // Connected via motherboard header
  124. #define U8G_CLASS U8GLIB_SH1106_128X64
  125. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
  126. #elif ENABLED(U8GLIB_SH1106)
  127. // Generic SH1106 OLED I2C LCD
  128. #if ENABLED(ALTERNATIVE_LCD)
  129. #define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE // 4 stripes
  130. #else
  131. #define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
  132. #endif
  133. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C
  134. #elif ENABLED(U8GLIB_SSD1309)
  135. // Generic support for SSD1309 OLED I2C LCDs
  136. #define U8G_CLASS U8GLIB_SSD1309_128X64
  137. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C
  138. #elif ENABLED(U8GLIB_SSD1306)
  139. // Generic SSD1306 OLED I2C LCD
  140. #if ENABLED(ALTERNATIVE_LCD)
  141. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE // 4 stripes
  142. #else
  143. #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
  144. #endif
  145. #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
  146. #elif TFT_SCALED_DOGLCD
  147. // Unspecified 320x240 TFT pre-initialized by built-in bootloader
  148. #define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64
  149. #if HAS_FSMC_GRAPHICAL_TFT
  150. #define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN
  151. #else
  152. #define U8G_PARAM -1, -1
  153. #endif
  154. #else
  155. #if ENABLED(ALTERNATIVE_LCD)
  156. #define U8G_CLASS U8GLIB_DOGM128 // 8 stripes (HW-SPI)
  157. #else
  158. #define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes (HW-SPI)
  159. #endif
  160. #endif
  161. // Use HW-SPI if no other option is specified
  162. #ifndef U8G_PARAM
  163. #if ENABLED(FORCE_SOFT_SPI)
  164. #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // SW-SPI
  165. #else
  166. #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI
  167. #endif
  168. #endif
  169. // For selective rendering within a Y range
  170. #define PAGE_OVER(ya) ((ya) <= u8g.getU8g()->current_page.y1) // Does the current page follow a region top?
  171. #define PAGE_UNDER(yb) ((yb) >= u8g.getU8g()->current_page.y0) // Does the current page precede a region bottom?
  172. #define PAGE_CONTAINS(ya, yb) ((yb) >= u8g.getU8g()->current_page.y0 && (ya) <= u8g.getU8g()->current_page.y1) // Do two vertical regions overlap?
  173. extern U8G_CLASS u8g;