From 097347b5756dbbe54a4463d07e0c8cf3db792123 Mon Sep 17 00:00:00 2001 From: George Fu Date: Fri, 3 Jul 2020 09:33:52 +0800 Subject: [PATCH] Add FYSETC 2.42 inch OLED support (#18485) --- Marlin/Configuration.h | 5 + Marlin/src/inc/Conditionals_LCD.h | 21 ++++ Marlin/src/inc/Conditionals_adv.h | 2 +- Marlin/src/lcd/dogm/ultralcd_DOGM.cpp | 2 +- Marlin/src/lcd/dogm/ultralcd_DOGM.h | 12 +++ Marlin/src/pins/ramps/pins_FYSETC_F6_13.h | 117 +++++++++++++--------- 6 files changed, 108 insertions(+), 51 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ac32add6b..68039e7ca 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2091,6 +2091,11 @@ // //#define OVERLORD_OLED +// +// FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER with WS2812 RGB +// Where to find : https://www.aliexpress.com/item/4000345255731.html +//#define FYSETC_242_OLED_12864 // Uses the SSD1309 controller + //============================================================================= //========================== Extensible UI Displays =========================== //============================================================================= diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 639c5765a..b1b2cf9b8 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -120,6 +120,27 @@ #define IS_RRD_SC #define IS_U8GLIB_SSD1306 +#elif ENABLED(FYSETC_242_OLED_12864) + + #define IS_RRD_SC + #define U8GLIB_SH1106 + + #define LED_CONTROL_MENU + #define NEOPIXEL_LED + #undef NEOPIXEL_TYPE + #define NEOPIXEL_TYPE NEO_RGB + #if NEOPIXEL_PIXELS < 3 + #undef NEOPIXELS_PIXELS + #define NEOPIXEL_PIXELS 3 + #endif + #ifndef NEOPIXEL_BRIGHTNESS + #define NEOPIXEL_BRIGHTNESS 127 + #endif + + #if ENABLED(PSU_CONTROL) + #define LED_BACKLIGHT_TIMEOUT 10000 + #endif + #elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) #define FYSETC_MINI_12864 diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index a318b198a..41cad412a 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -208,7 +208,7 @@ #endif #endif -#if ENABLED(FYSETC_MINI_12864_2_1) +#if ENABLED(FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864) #define LED_CONTROL_MENU #define LED_USER_PRESET_STARTUP #define LED_COLOR_PRESETS diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index e0b704e71..d90cc1184 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -246,7 +246,7 @@ void MarlinUI::init_lcd() { OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away #endif - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864) SET_OUTPUT(LCD_PINS_DC); #ifndef LCD_RESET_PIN #define LCD_RESET_PIN LCD_PINS_RS diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index e96d4d7b0..d1a60e770 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -123,6 +123,18 @@ #define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes #endif +#elif ENABLED(FYSETC_242_OLED_12864) + + // FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER + + #define FORCE_SOFT_SPI // SW-SPI + + #if ENABLED(ALTERNATIVE_LCD) + #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes + #else + #define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes + #endif + #elif ENABLED(U8GLIB_SH1106) // Generic SH1106 OLED I2C LCD diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h index 19238bc5f..d3d3f0043 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h @@ -211,58 +211,77 @@ // // LCDs and Controllers // -#define BEEPER_PIN 37 #define SD_DETECT_PIN 49 -#if ENABLED(FYSETC_MINI_12864) - // - // See https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 - // - #define DOGLCD_A0 16 - #define DOGLCD_CS 17 - - #if ENABLED(FYSETC_GENERIC_12864_1_1) - #define LCD_BACKLIGHT_PIN 27 - #endif - - #define KILL_PIN 41 - #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. - // Seems to work best if left open. - - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) - #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 25 - #endif - #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN 27 - #endif - #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 29 - #endif - #elif ENABLED(FYSETC_MINI_12864_2_1) - #define NEOPIXEL_PIN 25 - #endif - -#elif HAS_GRAPHICAL_LCD - - #define LCD_PINS_RS 16 - #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 - - #if ENABLED(MKS_MINI_12864) - #define DOGLCD_CS 25 - #define DOGLCD_A0 27 - #endif - -#endif - -#if ENABLED(NEWPANEL) - #define BTN_EN1 31 - #define BTN_EN2 33 +#if ENABLED(FYSETC_242_OLED_12864) + #define BTN_EN1 37 + #define BTN_EN2 29 #define BTN_ENC 35 + #define BEEPER_PIN 31 + + #define LCD_PINS_DC 25 + #define LCD_PINS_RS 33 + #define DOGLCD_CS 16 + #define DOGLCD_MOSI 23 + #define DOGLCD_SCK 17 + #define DOGLCD_A0 LCD_PINS_DC + + #define KILL_PIN -1 // NC + #define NEOPIXEL_PIN 27 + +#else + #define BEEPER_PIN 37 + + #if ENABLED(FYSETC_MINI_12864) + // + // See https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // + #define DOGLCD_A0 16 + #define DOGLCD_CS 17 + + #if ENABLED(FYSETC_GENERIC_12864_1_1) + #define LCD_BACKLIGHT_PIN 27 + #endif + + #define KILL_PIN 41 + #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN 25 + #endif + + #elif HAS_GRAPHICAL_LCD + + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 + + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS 25 + #define DOGLCD_A0 27 + #endif + + #endif + + #if ENABLED(NEWPANEL) + #define BTN_EN1 31 + #define BTN_EN2 33 + #define BTN_ENC 35 + #endif #endif #ifndef RGB_LED_R_PIN