From f887719a409cb562d98b4d2b340de428246e7c2d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 15 Jan 2018 03:14:23 -0600 Subject: [PATCH] Creality Ender board support --- Marlin/src/Makefile | 3 +++ Marlin/src/core/boards.h | 1 + Marlin/src/lcd/dogm/dogm_bitmaps.h | 22 ++++++++++++++++- Marlin/src/lcd/language/language_en.h | 2 +- Marlin/src/lcd/ultralcd_impl_DOGM.h | 13 +++++----- Marlin/src/pins/pins.h | 2 ++ Marlin/src/pins/pins_CREALITY_ENDER.h | 34 ++++++++++++++++++++++++++ Marlin/src/pins/pins_SANGUINOLOLU_11.h | 7 +++++- 8 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 Marlin/src/pins/pins_CREALITY_ENDER.h diff --git a/Marlin/src/Makefile b/Marlin/src/Makefile index aba82bbd0..e5a74cbbf 100644 --- a/Marlin/src/Makefile +++ b/Marlin/src/Makefile @@ -176,6 +176,9 @@ MCU ?= atmega1284p else ifeq ($(HARDWARE_MOTHERBOARD),69) HARDWARE_VARIANT ?= Sanguino MCU ?= atmega1284p +else ifeq ($(HARDWARE_MOTHERBOARD),601) +HARDWARE_VARIANT ?= Sanguino +MCU ?= atmega1284p #Ultimaker else ifeq ($(HARDWARE_MOTHERBOARD),7) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 58395dfe7..500c0ba67 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -115,6 +115,7 @@ #define BOARD_MELZI_MAKR3D 66 // Melzi with ATmega1284 (MaKr3d version) #define BOARD_MELZI_CREALITY 89 // Melzi Creality3D board (for CR-10 etc) #define BOARD_MELZI_MALYAN 92 // Melzi Malyan M150 board +#define BOARD_CREALITY_ENDER 601 // Creality Ender #define BOARD_STB_11 64 // STB V1.1 #define BOARD_AZTEEG_X1 65 // Azteeg X1 diff --git a/Marlin/src/lcd/dogm/dogm_bitmaps.h b/Marlin/src/lcd/dogm/dogm_bitmaps.h index 9ece59c2c..fd8363d2b 100644 --- a/Marlin/src/lcd/dogm/dogm_bitmaps.h +++ b/Marlin/src/lcd/dogm/dogm_bitmaps.h @@ -115,7 +115,14 @@ // When only one extruder is selected, the "1" on the symbol will not // be displayed. -#if HAS_TEMP_BED +#ifdef CUSTOM_STATUS_SCREEN_FILE + #undef STATUS_SCREENWIDTH + + // This file must define STATUS_SCREENWIDTH and status_screen{0,1}_bmp. + // It can also define STATUS_SCREEN_X, STATUS_SCREEN_{BED,FAN}_TEXT_X and + // STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations. + #include CUSTOM_STATUS_SCREEN_FILE +#elif HAS_TEMP_BED #if HOTENDS == 1 #define STATUS_SCREENWIDTH 115 //Width in pixels #define STATUS_SCREENHEIGHT 19 //Height in pixels @@ -513,3 +520,16 @@ }; #endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY + +#ifndef STATUS_SCREEN_X + #define STATUS_SCREEN_X 9 +#endif +#ifndef STATUS_SCREEN_HOTEND_TEXT_X + #define STATUS_SCREEN_HOTEND_TEXT_X(i) (5 + (i) * 25) +#endif +#ifndef STATUS_SCREEN_BED_TEXT_X + #define STATUS_SCREEN_BED_TEXT_X 81 +#endif +#ifndef STATUS_SCREEN_FAN_TEXT_X + #define STATUS_SCREEN_FAN_TEXT_X 104 +#endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index c1978069c..b1fe62b27 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -37,7 +37,7 @@ #undef en #ifndef WELCOME_MSG - #define WELCOME_MSG MACHINE_NAME _UxGT(" ready.") + #define WELCOME_MSG MACHINE_NAME _UxGT(" Ready.") #endif #ifndef MSG_BACK #define MSG_BACK _UxGT("Back") diff --git a/Marlin/src/lcd/ultralcd_impl_DOGM.h b/Marlin/src/lcd/ultralcd_impl_DOGM.h index 3ab6d08fb..0f1e147d9 100644 --- a/Marlin/src/lcd/ultralcd_impl_DOGM.h +++ b/Marlin/src/lcd/ultralcd_impl_DOGM.h @@ -324,7 +324,7 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) { u8g.firstPage(); do { - u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); + u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp); lcd_setFont(FONT_MENU); #ifndef STRING_SPLASH_LINE2 u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1); @@ -365,7 +365,6 @@ static void lcd_implementation_init() { #elif ENABLED(LCD_SCREEN_ROT_270) u8g.setRot270(); // Rotate screen by 270° #endif - } // The kill screen is displayed for unrecoverable conditions @@ -503,7 +502,9 @@ static void lcd_implementation_status_screen() { if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) { - u8g.drawBitmapP(9, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT, + u8g.drawBitmapP( + STATUS_SCREEN_X, 1, + (STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT, #if HAS_FAN0 blink && fanSpeeds[0] ? status_screen0_bmp : status_screen1_bmp #else @@ -519,11 +520,11 @@ static void lcd_implementation_status_screen() { if (PAGE_UNDER(28)) { // Extruders - HOTEND_LOOP() _draw_heater_status(5 + e * 25, e, blink); + HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink); // Heated bed #if HOTENDS < 4 && HAS_TEMP_BED - _draw_heater_status(81, -1, blink); + _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink); #endif #if HAS_FAN0 @@ -531,7 +532,7 @@ static void lcd_implementation_status_screen() { // Fan const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256; if (per) { - u8g.setPrintPos(104, 27); + u8g.setPrintPos(STATUS_SCREEN_FAN_TEXT_X, 27); lcd_print(itostr3(per)); u8g.print('%'); } diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 420f8df74..58f2bcee9 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -195,6 +195,8 @@ #include "pins_MELZI_CREALITY.h" // ATmega644P, ATmega1284P #elif MB(MELZI_MALYAN) #include "pins_MELZI_MALYAN.h" // ATmega644P, ATmega1284P +#elif MB(CREALITY_ENDER) + #include "pins_CREALITY_ENDER.h" // ATmega1284P #elif MB(STB_11) #include "pins_STB_11.h" // ATmega644P, ATmega1284P #elif MB(AZTEEG_X1) diff --git a/Marlin/src/pins/pins_CREALITY_ENDER.h b/Marlin/src/pins/pins_CREALITY_ENDER.h new file mode 100644 index 000000000..72cfcc6ee --- /dev/null +++ b/Marlin/src/pins/pins_CREALITY_ENDER.h @@ -0,0 +1,34 @@ +/** + * 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 . + * + */ + +/** + * Creality Ender pin assignments + * + * Applies to the following boards: + * + * Creality Ender-2 + * Creality Ender-4 + */ + +#define BOARD_NAME "Creality Ender" + +#include "pins_SANGUINOLOLU_12.h" diff --git a/Marlin/src/pins/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/pins_SANGUINOLOLU_11.h index 00c2c5842..e37af51bc 100644 --- a/Marlin/src/pins/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/pins_SANGUINOLOLU_11.h @@ -114,7 +114,7 @@ #endif -#if MB(AZTEEG_X1) || MB(STB_11) || ENABLED(IS_MELZI) +#if MB(AZTEEG_X1) || MB(STB_11) || MB(CREALITY_ENDER) || ENABLED(IS_MELZI) #define FAN_PIN 4 // Works for Panelolu2 too #endif @@ -187,6 +187,11 @@ #define DOGLCD_CS 17 #define LCD_BACKLIGHT_PIN 28 // PA3 + #elif MB(CREALITY_ENDER) + + #define BEEPER_PIN 27 + #define DOGLCD_CS 28 + #else // !MAKRPANEL #define DOGLCD_CS 29