From a2d2e19f84042e4941cc21f37c9b8d9ba71d6049 Mon Sep 17 00:00:00 2001 From: "K.3D" <40525619+KA8888@users.noreply.github.com> Date: Mon, 15 Mar 2021 17:02:40 +0100 Subject: [PATCH] KRATOS32 / K.32 board and LCD controllers (#21334) --- Marlin/Configuration.h | 16 ++- Marlin/src/core/boards.h | 1 + Marlin/src/inc/Conditionals_LCD.h | 8 +- Marlin/src/inc/SanityCheck.h | 4 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 2 +- Marlin/src/lcd/dogm/marlinui_DOGM.h | 5 +- Marlin/src/pins/pins.h | 2 + Marlin/src/pins/sam/pins_KRATOS32.h | 179 ++++++++++++++++++++++++++ 8 files changed, 208 insertions(+), 9 deletions(-) create mode 100644 Marlin/src/pins/sam/pins_KRATOS32.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 1098351d4e..726ff1ec0b 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2181,6 +2181,11 @@ // //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +// +// K.3D Full Graphic Smart Controller +// +//#define K3D_FULL_GRAPHIC_SMART_CONTROLLER + // // ReprapWorld Graphical LCD // https://reprapworld.com/?products_details&products_id/1218 @@ -2318,7 +2323,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 @@ -2327,7 +2332,7 @@ //#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller // -// Zonestar OLED 128×64 FULL GRAPHICS 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) @@ -2344,10 +2349,15 @@ //#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 +// +// K.3D SSD1309 OLED 2.42" 128×64 Full Graphics Controller +// +//#define K3D_242_OLED_CONTROLLER // Software SPI + //============================================================================= //========================== Extensible UI Displays =========================== //============================================================================= diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index cfde52ddb9..f0d967c763 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -279,6 +279,7 @@ #define BOARD_ARCHIM2 3024 // UltiMachine Archim2 (with TMC2130 drivers) #define BOARD_ALLIGATOR 3025 // Alligator Board R2 #define BOARD_CNCONTROLS_15D 3026 // Cartesio CN Controls V15 on DUE +#define BOARD_KRATOS32 3027 // K.3D Kratos32 (Arduino Due Shield) // // SAM3X8C ARM Cortex M3 diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index b9b86a7bf3..fc7eec84ee 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -229,14 +229,18 @@ #define BOARD_ST7920_DELAY_2 DELAY_NS(125) #define BOARD_ST7920_DELAY_3 DELAY_NS(125) -#elif ANY(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING, BQ_LCD_SMART_CONTROLLER) +#elif ANY(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING, BQ_LCD_SMART_CONTROLLER, K3D_FULL_GRAPHIC_SMART_CONTROLLER) #define IS_RRD_FG_SC 1 #elif ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - // RepRapDiscount LCD or Graphical LCD with rotary click encoder + #define IS_RRD_SC 1 // RepRapDiscount LCD or Graphical LCD with rotary click encoder + +#elif ENABLED(K3D_242_OLED_CONTROLLER) + #define IS_RRD_SC 1 + #define U8GLIB_SSD1309 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 6802bff1dd..5302aac208 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2372,7 +2372,9 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal + ENABLED(ULTIPANEL) \ + ENABLED(ULTRA_LCD) \ + ENABLED(YHCB2004) \ - + ENABLED(ZONESTAR_LCD) + + ENABLED(ZONESTAR_LCD) \ + + ENABLED(K3D_FULL_GRAPHIC_SMART_CONTROLLER) \ + + ENABLED(K3D_242_OLED_CONTROLLER) #error "Please select only one LCD controller option." #endif diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index d2b1ce7740..7334ba5f26 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -256,7 +256,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, ZONESTAR_12864OLED) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864, ZONESTAR_12864OLED, K3D_242_OLED_CONTROLLER) SET_OUTPUT(LCD_PINS_DC); #ifndef LCD_RESET_PIN #define LCD_RESET_PIN LCD_PINS_RS diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.h b/Marlin/src/lcd/dogm/marlinui_DOGM.h index e5862d670f..e3ceb63f96 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.h +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.h @@ -123,9 +123,10 @@ #define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes #endif -#elif ENABLED(FYSETC_242_OLED_12864) +#elif EITHER(FYSETC_242_OLED_12864, K3D_242_OLED_CONTROLLER) - // FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER + // FYSETC OLED 2.42" 128 × 64 Full Graphics Controller + // or K3D OLED 2.42" 128 × 64 Full Graphics Controller #define FORCE_SOFT_SPI // SW-SPI diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index b8cf695fb5..58a87f2313 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -447,6 +447,8 @@ #include "sam/pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB #elif MB(CNCONTROLS_15D) #include "sam/pins_CNCONTROLS_15D.h" // SAM3X8E env:DUE env:DUE_USB +#elif MB(KRATOS32) + #include "sam/pins_KRATOS32.h" // SAM3X8E env:DUE env:DUE_USB // // STM32 ARM Cortex-M0 diff --git a/Marlin/src/pins/sam/pins_KRATOS32.h b/Marlin/src/pins/sam/pins_KRATOS32.h new file mode 100644 index 0000000000..f429e56347 --- /dev/null +++ b/Marlin/src/pins/sam/pins_KRATOS32.h @@ -0,0 +1,179 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 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 + +/** + * KRATOS32 + */ + +#include "env_validate.h" + +#define BOARD_INFO_NAME "K.3D KRATOS32" + +// +// EEPROM +// +#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) + #define I2C_EEPROM + #define MARLIN_EEPROM_SIZE 0x1F400 // 16KB +#endif + +// +// Servos +// +#define SERVO0_PIN 6 +#define SERVO1_PIN 5 +#define SERVO2_PIN 39 +#define SERVO3_PIN 40 // CAMERA_PIN (extended to the top of the LCD module) +#define SERVO4_PIN 45 // FIL_RUNOUT_PIN + +// +// Limit Switches +// +#define X_MIN_PIN 28 +#define X_MAX_PIN 34 +#define Y_MIN_PIN 30 +#define Y_MAX_PIN 36 +#define Z_MIN_PIN 32 +#define Z_MAX_PIN 38 + +// +// Steppers +// +#define X_STEP_PIN 24 +#define X_DIR_PIN 23 +#define X_ENABLE_PIN 26 +#ifndef X_CS_PIN + #define X_CS_PIN 25 +#endif + +#define Y_STEP_PIN 17 +#define Y_DIR_PIN 16 +#define Y_ENABLE_PIN 22 +#ifndef Y_CS_PIN + #define Y_CS_PIN 27 +#endif + +#define Z_STEP_PIN 2 +#define Z_DIR_PIN 3 +#define Z_ENABLE_PIN 15 +#ifndef Z_CS_PIN + #define Z_CS_PIN 29 +#endif + +#define E0_STEP_PIN 61 +#define E0_DIR_PIN 60 +#define E0_ENABLE_PIN 62 +#ifndef E0_CS_PIN + #define E0_CS_PIN 31 +#endif + +#define E1_STEP_PIN 64 +#define E1_DIR_PIN 63 +#define E1_ENABLE_PIN 65 +#ifndef E1_CS_PIN + #define E1_CS_PIN 37 +#endif + +#define E2_STEP_PIN 68 +#define E2_DIR_PIN 67 +#define E2_ENABLE_PIN 69 +#ifndef E2_CS_PIN + #define E2_CS_PIN 35 +#endif + +#define E3_STEP_PIN 51 +#define E3_DIR_PIN 53 +#define E3_ENABLE_PIN 49 +#ifndef E3_CS_PIN + #define E3_CS_PIN 33 +#endif + +// +// Temperature Sensors +// +#define TEMP_0_PIN 0 // Analog Input +#define TEMP_1_PIN 1 // Analog Input +#define TEMP_2_PIN 2 // Analog Input +#define TEMP_3_PIN 3 // Analog Input +#define TEMP_BED_PIN 4 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN 13 +#define HEATER_1_PIN 12 +#define HEATER_2_PIN 11 +#define HEATER_3_PIN 10 +#define HEATER_BED_PIN 7 // BED + +#ifndef FAN_PIN + #define FAN_PIN 9 +#endif +#define FAN1_PIN 8 + +// +// Misc. Functions +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 45 // SERVO4_PIN +#endif + +#ifndef PS_ON_PIN + #define PS_ON_PIN 59 +#endif + +// +// LCD / Controller +// +#if HAS_WIRED_LCD + + #define BTN_EN1 48 + #define BTN_EN2 50 + #define BTN_ENC 46 + + #define SDSS 4 + #define SD_DETECT_PIN 14 + + #define BEEPER_PIN 41 + #define KILL_PIN 66 + + #if IS_RRD_FG_SC + + #define LCD_PINS_RS 42 + #define LCD_PINS_ENABLE 43 + #define LCD_PINS_D4 44 + + #define BTN_BACK 52 + + #elif ENABLED(K3D_242_OLED_CONTROLLER) + + #define LCD_PINS_DC 44 + #define LCD_PINS_RS 42 + #define DOGLCD_CS 52 + #define DOGLCD_MOSI 43 + #define DOGLCD_SCK 47 + #define DOGLCD_A0 LCD_PINS_DC + + #endif + +#endif // HAS_WIRED_LCD