From b055d8c39cf0a3bc946e13510ba407e60f07518f Mon Sep 17 00:00:00 2001 From: Dan Delaney Date: Sat, 16 Dec 2017 18:47:04 -0600 Subject: [PATCH] [2.0.x] Adding support for using the MKS_12864OLED with the SSD1306 controller (#8814) * Adding support for using the MKS_12864OLED with the SSD1306 controller * Update comment for correct controller type --- Marlin/Configuration.h | 8 +++++--- Marlin/src/inc/Conditionals_LCD.h | 5 +++++ Marlin/src/inc/SanityCheck.h | 12 +++++++++--- Marlin/src/lcd/ultralcd_impl_DOGM.h | 5 +++++ Marlin/src/pins/pins_RAMPS.h | 2 +- Marlin/src/pins/pins_RAMPS_PLUS.h | 2 +- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index c60aea5186..be269f725f 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1625,12 +1625,14 @@ //#define CR10_STOCKDISPLAY // -// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// MKS OLED 1.3" 128x64 FULL GRAPHICS CONTROLLER // http://reprap.org/wiki/MKS_12864OLED // // Tiny, but very sharp OLED display -// -//#define MKS_12864OLED +// If there is a pixel shift, try the other controller. + +//#define MKS_12864OLED // Uses the SH1106 controller (default) +//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller // // AZSMZ 12864 LCD with SD diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 63d7e81948..a38beed22e 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -130,6 +130,11 @@ #define REPRAP_DISCOUNT_SMART_CONTROLLER #define U8GLIB_SH1106 +#elif ENABLED(MKS_12864OLED_SSD1306) + + #define REPRAP_DISCOUNT_SMART_CONTROLLER + #define U8GLIB_SSD1306 + #elif ENABLED(MKS_MINI_12864) #define MINIPANEL diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index b06bf49354..be73bb1082 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1289,6 +1289,7 @@ static_assert(1 >= 0 * REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER => REPRAP_DISCOUNT_SMART_CONTROLLER * SAV_3DGLCD => U8GLIB_SH1106 => ULTIMAKERCONTROLLER * MKS_12864OLED => U8GLIB_SH1106 => ULTIMAKERCONTROLLER + * MKS_12864OLED_SSD1306 => U8GLIB_SSD1306 => ULTIMAKERCONTROLLER * miniVIKI => ULTIMAKERCONTROLLER * VIKI2 => ULTIMAKERCONTROLLER * ELB_FULL_GRAPHIC_CONTROLLER => ULTIMAKERCONTROLLER @@ -1303,14 +1304,16 @@ static_assert(1 >= 0 && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ && DISABLED(AZSMZ_12864) \ && DISABLED(PANEL_ONE) \ - && DISABLED(MKS_12864OLED) + && DISABLED(MKS_12864OLED) \ + && DISABLED(MKS_12864OLED_SSD1306) + 1 #endif #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \ && DISABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) \ && DISABLED(LCD_FOR_MELZI) \ && DISABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) \ - && DISABLED(MKS_12864OLED) + && DISABLED(MKS_12864OLED) \ + && DISABLED(MKS_12864OLED_SSD1306) + 1 #endif #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) \ @@ -1323,6 +1326,9 @@ static_assert(1 >= 0 #if ENABLED(MKS_12864OLED) + 1 #endif + #if ENABLED(MKS_12864OLED_SSD1306) + + 1 + #endif #if ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) + 1 #endif @@ -1382,7 +1388,7 @@ static_assert(1 >= 0 #if ENABLED(LCD_I2C_VIKI) + 1 #endif - #if ENABLED(U8GLIB_SSD1306) && DISABLED(OLED_PANEL_TINYBOY2) + #if ENABLED(U8GLIB_SSD1306) && DISABLED(OLED_PANEL_TINYBOY2) && DISABLED(MKS_12864OLED_SSD1306) + 1 #endif #if ENABLED(SAV_3DLCD) diff --git a/Marlin/src/lcd/ultralcd_impl_DOGM.h b/Marlin/src/lcd/ultralcd_impl_DOGM.h index 7ef2736be3..27877a34d0 100644 --- a/Marlin/src/lcd/ultralcd_impl_DOGM.h +++ b/Marlin/src/lcd/ultralcd_impl_DOGM.h @@ -195,6 +195,11 @@ //U8GLIB_64128N_2X_HAL u8g(DOGLCD_CS, DOGLCD_A0); // using HW-SPI U8GLIB_64128N_2X_HAL u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // using SW-SPI +#elif ENABLED(MKS_12864OLED_SSD1306) + // MKS 128x64 (SSD1306) OLED I2C LCD + U8GLIB_SSD1306_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 8 stripes + //U8GLIB_SSD1306_128X64_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes + #elif ENABLED(U8GLIB_SSD1306) // Generic support for SSD1306 OLED I2C LCDs //U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index 539cdd9fa0..8adf0295b5 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -339,7 +339,7 @@ #else - #if ENABLED(MKS_12864OLED) + #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) #define LCD_PINS_DC 25 // Set as output on init #define LCD_PINS_RS 27 // Pull low for 1s to init // DOGM SPI LCD Support diff --git a/Marlin/src/pins/pins_RAMPS_PLUS.h b/Marlin/src/pins/pins_RAMPS_PLUS.h index 5b9fd50f9f..77e0e140c0 100644 --- a/Marlin/src/pins/pins_RAMPS_PLUS.h +++ b/Marlin/src/pins/pins_RAMPS_PLUS.h @@ -76,7 +76,7 @@ #undef E1_CS_PIN #if ENABLED(ULTRA_LCD) && DISABLED(REPRAPWORLD_GRAPHICAL_LCD) && (DISABLED(NEWPANEL) || DISABLED(PANEL_ONE)) && DISABLED(CR10_STOCKDISPLAY) - #if DISABLED(MKS_12864OLED) + #if DISABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) #undef LCD_PINS_RS #define LCD_PINS_RS 42 // 3DYMY boards pin 16 -> 42 #undef LCD_PINS_ENABLE