From cb18b858d4b073ce0fe84fc31ffbe20fb529fc17 Mon Sep 17 00:00:00 2001 From: wmariz <11435639+wmariz@users.noreply.github.com> Date: Fri, 7 Aug 2020 19:03:59 -0300 Subject: [PATCH] ZoneStar Z6FB (#18918) Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 11 +- Marlin/src/core/boards.h | 1 + Marlin/src/inc/Conditionals_LCD.h | 13 ++ Marlin/src/inc/Conditionals_post.h | 4 + Marlin/src/inc/SanityCheck.h | 5 +- Marlin/src/lcd/dogm/ultralcd_DOGM.cpp | 2 +- Marlin/src/lcd/dogm/ultralcd_DOGM.h | 118 +++++----- Marlin/src/lcd/extui_anycubic_chiron_lcd.cpp | 6 +- Marlin/src/pins/pins.h | 2 + Marlin/src/pins/sanguino/pins_ZMIB_V2.h | 234 +++++++++++++++++++ Marlin/src/sd/Sd2Card.cpp | 11 +- platformio.ini | 1 - 12 files changed, 340 insertions(+), 68 deletions(-) create mode 100644 Marlin/src/pins/sanguino/pins_ZMIB_V2.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 75ee1eb990..3ad7dfdab3 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2089,7 +2089,7 @@ //#define OLED_PANEL_TINYBOY2 // -// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// MKS OLED 1.3" 128×64 FULL GRAPHICS CONTROLLER // https://reprap.org/wiki/MKS_12864OLED // // Tiny, but very sharp OLED display @@ -2097,6 +2097,13 @@ //#define MKS_12864OLED // Uses the SH1106 controller (default) //#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller +// +// Zonestar OLED 128×64 FULL GRAPHICS CONTROLLER +// +//#define ZONESTAR_12864LCD // Graphical (DOGM) with ST7920 controller +//#define ZONESTAR_12864OLED // 1.3" OLED with SH1106 controller (default) +//#define ZONESTAR_12864OLED_SSD1306 // 0.96" OLED with SSD1306 controller + // // Einstart S OLED SSD1306 // @@ -2108,7 +2115,7 @@ //#define OVERLORD_OLED // -// FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER with WS2812 RGB +// 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 diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index eb33258e26..32b9168a62 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -171,6 +171,7 @@ #define BOARD_STB_11 1508 // STB V1.1 #define BOARD_AZTEEG_X1 1509 // Azteeg X1 #define BOARD_ANET_10 1510 // Anet 1.0 (Melzi clone) +#define BOARD_ZMIB_V2 1511 // ZoneStar ZMIB V2 // // Other ATmega644P, ATmega644, ATmega1284P diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index cabca762ab..d8c8103a42 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -62,6 +62,19 @@ #define ENCODER_STEPS_PER_MENU_ITEM 1 #define ENCODER_FEEDRATE_DEADZONE 2 +#elif ENABLED(ZONESTAR_12864LCD) + #define DOGLCD + #define IS_RRD_SC + #define U8GLIB_ST7920 + +#elif ENABLED(ZONESTAR_12864OLED) + #define IS_RRD_SC + #define U8GLIB_SH1106 + +#elif ENABLED(ZONESTAR_12864OLED_SSD1306) + #define IS_RRD_SC + #define IS_U8GLIB_SSD1306 + #elif ENABLED(RADDS_DISPLAY) #define IS_ULTIPANEL #define ENCODER_PULSES_PER_STEP 2 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 556d57b669..6243d82aa8 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -312,6 +312,10 @@ #define _LCD_CONTRAST_INIT 17 #elif ENABLED(MINIPANEL) #define _LCD_CONTRAST_INIT 150 +#elif ENABLED(ZONESTAR_12864OLED) + #define _LCD_CONTRAST_MIN 64 + #define _LCD_CONTRAST_INIT 128 + #define _LCD_CONTRAST_MAX 255 #endif #ifdef _LCD_CONTRAST_INIT diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index d296eb2f15..7fbfda4fe1 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2227,6 +2227,9 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal + ENABLED(OLED_PANEL_TINYBOY2) \ + ENABLED(MKS_12864OLED) \ + ENABLED(MKS_12864OLED_SSD1306) \ + + ENABLED(ZONESTAR_12864LCD) \ + + ENABLED(ZONESTAR_12864OLED) \ + + ENABLED(ZONESTAR_12864OLED_SSD1306) \ + ENABLED(U8GLIB_SH1106_EINSTART) \ + ENABLED(OVERLORD_OLED) \ + ENABLED(FYSETC_242_OLED_12864) \ @@ -2242,7 +2245,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal + ENABLED(TFT_LVGL_UI_SPI) \ + ENABLED(ANYCUBIC_LCD_I3MEGA) \ + ENABLED(ANYCUBIC_LCD_CHIRON) - #error "Please select no more than one LCD controller option." + #error "Please select only one LCD controller option." #endif #undef IS_RRD_SC diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index 22f460afe7..c6c67bf97e 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 ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864, ZONESTAR_12864OLED) 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 40402fe5ac..228cee6848 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -33,6 +33,9 @@ //#define ALTERNATIVE_LCD #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) + + // RepRapWorld Graphical LCD + #define U8G_CLASS U8GLIB_ST7920_128X64_4X #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) #define U8G_PARAM LCD_PINS_RS @@ -43,6 +46,7 @@ #elif ENABLED(U8GLIB_ST7920) // RepRap Discount Full Graphics Smart Controller + // and other variant LCDs using ST7920 #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL // 2 stripes, HW SPI (Shared with SD card. Non-standard LCD adapter on AVR.) @@ -88,43 +92,28 @@ #define FORCE_SOFT_SPI // SW-SPI #endif -#elif ENABLED(MKS_12864OLED_SSD1306) +#elif ANY(FYSETC_MINI_12864, MKS_MINI_12864, ENDER2_STOCKDISPLAY) + + // The FYSETC Mini 12864 display // "4 stripes" + + // The MKS_MINI_12864 V1/V2 aren't exact copies of the MiniPanel. + // Panel management is in u8g_dev_uc1701_mini12864_HAL.cpp with + // extra delays added to remove glitches seen with fast MCUs. + + #define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 8 stripes (HW-SPI) + +#elif ENABLED(MINIPANEL) + + #if ENABLED(ALTERNATIVE_LCD) + #define U8G_CLASS U8GLIB_MINI12864 + #else + #define U8G_CLASS U8GLIB_MINI12864_2X // 8 stripes (HW-SPI) + #endif + +#elif EITHER(MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864) // MKS 128x64 (SSD1306) OLED I2C LCD - - #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_SSD1306) - - // Generic SSD1306 OLED I2C LCD - - #if ENABLED(ALTERNATIVE_LCD) - #define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE // 4 stripes - #else - #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes - #endif - #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) - -#elif ENABLED(MKS_12864OLED) - - // MKS 128x64 (SH1106) OLED I2C LCD - - #define FORCE_SOFT_SPI // SW-SPI - - #if ENABLED(ALTERNATIVE_LCD) - #define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes - #else - #define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes - #endif - -#elif ENABLED(FYSETC_242_OLED_12864) - + // - or - // FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER #define FORCE_SOFT_SPI // SW-SPI @@ -135,6 +124,37 @@ #define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes #endif +#elif ENABLED(ZONESTAR_12864OLED_SSD1306) + + // Zonestar SSD1306 OLED SPI LCD + + #define FORCE_SOFT_SPI // SW-SPI + #if ENABLED(ALTERNATIVE_LCD) + #define U8G_CLASS U8GLIB_SH1306_128X64_2X // 4 stripes + #else + #define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes + #endif + +#elif EITHER(MKS_12864OLED, ZONESTAR_12864OLED) + + // MKS 128x64 (SH1106) OLED I2C LCD + // - or - + // Zonestar SH1106 OLED SPI LCD + + #define FORCE_SOFT_SPI // SW-SPI + #if ENABLED(ALTERNATIVE_LCD) + #define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes + #else + #define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes + #endif + +#elif ENABLED(U8GLIB_SH1106_EINSTART) + + // Connected via motherboard header + + #define U8G_CLASS U8GLIB_SH1106_128X64 + #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS + #elif ENABLED(U8GLIB_SH1106) // Generic SH1106 OLED I2C LCD @@ -153,34 +173,16 @@ #define U8G_CLASS U8GLIB_SSD1309_128X64 #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // I2C -#elif ENABLED(FYSETC_MINI_12864) +#elif ENABLED(U8GLIB_SSD1306) - // The FYSETC Mini 12864 display - - #define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 4 stripes - -#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) - - // The MKS_MINI_12864 V1/V2 aren't exact copies of the MiniPanel. - // Panel management is in u8g_dev_uc1701_mini12864_HAL.cpp with - // extra delays added to remove glitches seen with fast MCUs. - - #define U8G_CLASS U8GLIB_MINI12864_2X_HAL // 8 stripes (HW-SPI) - -#elif ENABLED(MINIPANEL) + // Generic SSD1306 OLED I2C LCD #if ENABLED(ALTERNATIVE_LCD) - #define U8G_CLASS U8GLIB_MINI12864 + #define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE // 4 stripes #else - #define U8G_CLASS U8GLIB_MINI12864_2X // 8 stripes (HW-SPI) + #define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes #endif - -#elif ENABLED(U8GLIB_SH1106_EINSTART) - - // Connected via motherboard header - - #define U8G_CLASS U8GLIB_SH1106_128X64 - #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS + #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) #elif TFT_SCALED_DOGLCD diff --git a/Marlin/src/lcd/extui_anycubic_chiron_lcd.cpp b/Marlin/src/lcd/extui_anycubic_chiron_lcd.cpp index 9d00db3353..15cc96711c 100644 --- a/Marlin/src/lcd/extui_anycubic_chiron_lcd.cpp +++ b/Marlin/src/lcd/extui_anycubic_chiron_lcd.cpp @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * */ @@ -145,7 +145,7 @@ namespace ExtUI { if (rx[0] != 'A') { SERIAL_ECHOPGM("Unexpected RX: "); SERIAL_ECHOLN(rx); - + return; } @@ -490,7 +490,7 @@ namespace ExtUI { void onMediaRemoved() { SENDLINE_PGM("J01"); // SD Removed } - + void onPlayTone(const uint16_t frequency, const uint16_t duration) { tone(BEEPER_PIN, frequency, duration); } diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 1f120e0c12..9b6be5a6e1 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -300,6 +300,8 @@ #include "sanguino/pins_STB_11.h" // ATmega644P, ATmega1284P env:sanguino644p env:sanguino1284p #elif MB(AZTEEG_X1) #include "sanguino/pins_AZTEEG_X1.h" // ATmega644P, ATmega1284P env:sanguino644p env:sanguino1284p +#elif MB(ZMIB_V2) + #include "sanguino/pins_ZMIB_V2.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p // // Other ATmega644P, ATmega644, ATmega1284P diff --git a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h new file mode 100644 index 0000000000..262199e310 --- /dev/null +++ b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h @@ -0,0 +1,234 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644P' or 'ATmega1284P' in 'Tools > Processor.'" +#endif + +#define BOARD_INFO_NAME "Zonestar ZMIB_V2" +#define BOARD_WEBSITE_URL "https://www.aliexpress.com/item/32957490744.html" + +#define IS_ZMIB_V2 + +/** + * ZMIB pin assignments + * + * The ZMIB board needs a bootloader installed before Marlin can be uploaded. + * If you don't have a chip programmer you can use a spare Arduino plus a few + * electronic components to write the bootloader. + * + * See http://www.instructables.com/id/Burn-Arduino-Bootloader-with-Arduino-MEGA/ + */ + +/** + * PIN: 0 Port: B0 HEATER_0_PIN + * PIN: 1 Port: B1 HEATER_BED_PIN + * PIN: 2 Port: B2 EXP1_4(BTN_EN2) + * PIN: 3 Port: B3 V1: SD_DETECT_PIN + * PIN: 3 Port: B3 V2: EXP1_6 + * PIN: 4 Port: B4 SDSS + * PIN: 4 Port: B4 V1: EXP1_6 + * PIN: 5 Port: B5 AVR_MOSI_PIN + * . MOSI_PIN + * PIN: 6 Port: B6 AVR_MISO_PIN + * . EXP1_9(MISO_PIN) + * PIN: 7 Port: B7 AVR_SCK_PIN + * . EXP1_10(SCK_PIN) + * PIN: 8 Port: D0 RXD + * PIN: 9 Port: D1 TXD + * PIN: 10 Port: D2 EXP1_8 + * PIN: 11 Port: D3 EXP1_7 + * PIN: 12 Port: D4 EXP1_5(BTN_EN1) + * PIN: 13 Port: D5 Z_MIN_PIN + * PIN: 14 Port: D6 E1_DIR_PIN + * PIN: 15 Port: D7 E1_STEP_PIN + * PIN: 16 Port: C0 Z_DIR_PIN + * PIN: 17 Port: C1 Z_STEP_PIN + * PIN: 18 Port: C2 Y_MIN_PIN + * PIN: 19 Port: C3 Y_DIR_PIN + * PIN: 20 Port: C4 Y_STEP_PIN + * PIN: 21 Port: C5 X_MIN_PIN + * PIN: 22 Port: C6 X_DIR_PIN + * PIN: 23 Port: C7 X_STEP_PIN + * PIN: 24 Port: A7 X_ENABLE_PIN + * Y_ENABLE_PIN + * Z_ENABLE_PIN + * E0_ENABLE_PIN + * E1_ENABLE_PIN + * PIN: 25 Port: A6 FIL_RUNOUT_PIN + * PIN: 26 Port: A5 E0_DIR_PIN + * PIN: 27 Port: A4 E0_STEP_PIN + * PIN: 28 Port: A3 FAN_PIN + * PIN: 29 Port: A2 EXP1_3(BTN_ENC) + * ADC_KEY_PIN + * PIN: 30 Port: A1 TEMP_0_PIN + * PIN: 31 Port: A0 TEMP_BED_PIN + */ + +// +// Limit Switches +// +#define X_MIN_PIN 21 +#define Y_MIN_PIN 18 + +#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) + #define Z_MIN_PIN 25 +#else + #define Z_MIN_PIN 13 +#endif + +// +// Steppers +// +#define X_STEP_PIN 23 +#define X_DIR_PIN 22 +#define X_ENABLE_PIN 24 + +#define Y_STEP_PIN 20 +#define Y_DIR_PIN 19 +#define Y_ENABLE_PIN 24 + +#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) + #define Z_STEP_PIN 27 + #define Z_DIR_PIN 26 +#else + #define Z_STEP_PIN 17 + #define Z_DIR_PIN 16 +#endif + +#define Z_ENABLE_PIN 24 + +#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) + #define E0_STEP_PIN 15 + #define E0_DIR_PIN 14 +#else + #define E0_STEP_PIN 27 + #define E0_DIR_PIN 26 +#endif + +#define E0_ENABLE_PIN 24 + +#define E1_STEP_PIN 15 +#define E1_DIR_PIN 14 +#define E1_ENABLE_PIN 24 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 1 // Analog Input +#define TEMP_BED_PIN 0 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN 0 +#define HEATER_BED_PIN 1 +#define FAN_PIN 28 +#define FAN1_PIN -1 + +// +//filament run out sensor +// +#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) + #define FIL_RUNOUT_PIN 13 +#else + #define FIL_RUNOUT_PIN 25 // Z-MIN +#endif + +// +// SD card +// +#if ENABLED(SDSUPPORT) + #define SDSS 4 +#endif +#define SD_DETECT_PIN -1 + +/*=================================================== + * ZMIB Version 1 - EXP1 Connector + * MOSI(D5) TX1(D11) ENA(D12) ENC(D29/A2) 5V + * SCK(D7) RX1(D10) SCS(D4) ENB(D2) GND + *=================================================== + * ZMIB Version 2 - EXP1 Connector + * MOSI(D5) TX1(D11) ENA(D12) ENC(D29/A2) 5V + * SCK(D7) RX1(D10) SCS(D3) ENB(D2) GND + *=================================================== + * LCD 128x64 + *==================================================*/ + +#if ENABLED(ZONESTAR_12864LCD) + // + // LCD 128x64 + // + #define LCDSCREEN_NAME "ZONESTAR_12864LCD" + #define FORCE_SOFT_SPI + //#define LCD_SDSS 11 + #define LCD_PINS_RS 11 // ST7920_CS_PIN LCD_PIN_RS (PIN4 of LCD module) + #ifdef IS_ZMIB_V2 + #define LCD_PINS_ENABLE 3 // ST7920_DAT_PIN LCD_PIN_R/W (PIN5 of LCD module) + #else + #define LCD_PINS_ENABLE 4 // ST7920_DAT_PIN LCD_PIN_R/W (PIN5 of LCD module) + #endif + #define LCD_PINS_D4 10 // ST7920_CLK_PIN LCD_PIN_ENABLE (PIN6 of LCD module) + + // Alter timing for graphical display + #define ST7920_DELAY_1 DELAY_2_NOP + #define ST7920_DELAY_2 DELAY_2_NOP + #define ST7920_DELAY_3 DELAY_2_NOP + +#elif EITHER(ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) + // + // OLED 128x64 + // + #define LCDSCREEN_NAME "ZONESTAR 12864OLED" + #define FORCE_SOFT_SPI + #ifdef IS_ZMIB_V2 + #define LCD_PINS_RS 3 // RESET + #else + #define LCD_PINS_RS 4 // RESET + #endif + #define LCD_PINS_DC 10 // DC + #define DOGLCD_CS 11 // CS + #if ENABLED(OLED_HW_IIC) + #error "Oops! can't choose HW IIC for ZMIB board!!" + #elif ENABLED(OLED_HW_SPI) + // HW SPI + #define DOGLCD_A0 LCD_PINS_DC // A0 = DC + #else + // SW SPI + #define DOGLCD_A0 LCD_PINS_DC // A0 = DC + #define DOGLCD_MOSI AVR_MOSI_PIN // SDA + #define DOGLCD_SCK AVR_SCK_PIN // SCK + #endif + +#endif + +// +// All the above are also RRDSC with rotary encoder +// +#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) + #define BTN_EN1 2 + #define BTN_EN2 12 + #define BTN_ENC 29 + #define BEEPER_PIN -1 + #define KILL_PIN -1 +#endif diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index c56d690b2e..6ff2793e93 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -240,8 +240,15 @@ bool Sd2Card::init(const uint8_t sckRateID, const pin_t chipSelectPin) { watchdog_refresh(); // In case init takes too long // Set pin modes - extDigitalWrite(chipSelectPin_, HIGH); // For some CPUs pinMode can write the wrong data so init desired data value first - pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye + #if ENABLED(ZONESTAR_12864OLED) + if (chipSelectPin_ != DOGLCD_CS) { + SET_OUTPUT(DOGLCD_CS); + WRITE(DOGLCD_CS, HIGH); + } + #else + extDigitalWrite(chipSelectPin_, HIGH); // For some CPUs pinMode can write the wrong data so init desired data value first + pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye + #endif spiBegin(); // Set SCK rate for initialization commands diff --git a/platformio.ini b/platformio.ini index ee4d4e12f8..fdb120ae88 100644 --- a/platformio.ini +++ b/platformio.ini @@ -869,7 +869,6 @@ board = genericSTM32F103VE platform_packages = tool-stm32duino extra_scripts = ${common.extra_scripts} buildroot/share/PlatformIO/scripts/mks_robin_nano35.py -lib_deps = ${common_stm32f1.lib_deps} build_flags = ${common_stm32f1.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 debug_tool = jlink