Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
- rumba32_f446ve
- rumba32_mks
- mks_robin_pro
- STM32F103RET6_creality

# Put lengthy tests last

Expand Down
10 changes: 10 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,11 @@
*/
//#define BLTOUCH

/**
* Pressure sensor with a BLTouch-like interface
*/
//#define CREALITY_TOUCH

/**
* Touch-MI Probe by hotends.fr
*
Expand Down Expand Up @@ -2130,6 +2135,11 @@
//
//#define SPI_GRAPHICAL_TFT

//
// Ender-3 v2 OEM display. A DWIN display with Rotary Encoder.
//
//#define DWIN_CREALITY_LCD

//
// ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8
//
Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/HAL/STM32F1/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ typedef uint16_t hal_timer_t;

#define HAL_TIMER_RATE uint32_t(F_CPU) // frequency of timers peripherals

#define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#ifndef STEP_TIMER_CHAN
#define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#endif
#ifndef TEMP_TIMER_CHAN
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#endif

/**
* Note: Timers may be used by platforms and libraries
Expand Down
44 changes: 42 additions & 2 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@
#include "lcd/extui/lib/mks_ui/inc/draw_ui.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/dwin/dwin.h"
#include "lcd/dwin/dwin_lcd.h"
#include "lcd/dwin/rotary_encoder.h"
#endif

#if ENABLED(IIC_BL24CXX_EEPROM)
#include "lcd/dwin/eeprom_BL24CXX.h"
#endif

#if ENABLED(DIRECT_STEPPING)
#include "feature/direct_stepping.h"
#endif
Expand Down Expand Up @@ -689,6 +699,9 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Handle SD Card insert / remove
TERN_(SDSUPPORT, card.manage_media());

// Handle UI input / draw events
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());

// Handle USB Flash Drive insert / remove
TERN_(USB_FLASH_DRIVE_SUPPORT, Sd2Card::idle());

Expand Down Expand Up @@ -962,8 +975,19 @@ void setup() {
// UI must be initialized before EEPROM
// (because EEPROM code calls the UI).

SETUP_RUN(ui.init());
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
#if ENABLED(DWIN_CREALITY_LCD)
delay(800); // Required delay (since boot?)
SERIAL_ECHOPGM("\nDWIN handshake ");
if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");
DWIN_Frame_SetDir(1); // Orientation 90°
DWIN_UpdateLCD(); // Show bootscreen (first image)
#else
SETUP_RUN(ui.init());
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
SETUP_RUN(ui.show_bootscreen());
#endif
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
#endif

#if BOTH(HAS_SPI_LCD, SHOW_BOOTSCREEN)
SETUP_RUN(ui.show_bootscreen());
Expand Down Expand Up @@ -1143,6 +1167,22 @@ void setup() {
SETUP_RUN(mmu2.init());
#endif

#if ENABLED(IIC_BL24CXX_EEPROM)
BL24CXX::init();
const uint8_t err = BL24CXX::check();
SERIAL_ECHO_TERNARY(err, "I2C_EEPROM Check ", "failed", "succeeded", "!\n");
#endif

#if ENABLED(DWIN_CREALITY_LCD)
Encoder_Configuration();
HMI_Init();
HMI_StartFrame(true);
#endif

#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)
ui.reset_status(true); // Show service messages or keep current status
#endif

#if ENABLED(MAX7219_DEBUG)
SETUP_RUN(max7219.init());
#endif
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
#define BOARD_CCROBOT_MEEB_3DP 4029 // ccrobot-online.com MEEB_3DP (STM32F103RC)
#define BOARD_CHITU3D_V5 4030 // Chitu3D TronXY X5SA V5 Board
#define BOARD_CHITU3D_V6 4031 // Chitu3D TronXY X5SA V5 Board
#define BOARD_CREALITY_V4 4032 // Creality v4.x (STM32F103RE)

//
// ARM Cortex-M4F
Expand Down
14 changes: 10 additions & 4 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ extern uint8_t marlin_debug_flags;
extern int8_t serial_port_index;
#define _PORT_REDIRECT(n,p) REMEMBER(n,serial_port_index,p)
#define _PORT_RESTORE(n) RESTORE(n)
#define SERIAL_OUT(WHAT, V...) do{ \
if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \
if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \
}while(0)

#ifdef SERIAL_CATCHALL
#define SERIAL_OUT(WHAT, V...) (void)CAT(MYSERIAL,SERIAL_CATCHALL).WHAT(V)
#else
#define SERIAL_OUT(WHAT, V...) do{ \
if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \
if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \
}while(0)
#endif

#define SERIAL_ASSERT(P) if(serial_port_index!=(P)){ debugger(); }
#else
#define _PORT_REDIRECT(n,p) NOOP
Expand Down
14 changes: 11 additions & 3 deletions Marlin/src/feature/bltouch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@
// BLTouch commands are sent as servo angles
typedef unsigned char BLTCommand;

#define BLTOUCH_DEPLOY 10
#if ENABLED(CREALITY_TOUCH)
#define STOW_ALARM false
#define BLTOUCH_DEPLOY 170
#define BLTOUCH_STOW 20
#else
#define STOW_ALARM true
#define BLTOUCH_DEPLOY 10
#define BLTOUCH_STOW 90
#endif

#define BLTOUCH_SW_MODE 60
#define BLTOUCH_STOW 90
#define BLTOUCH_SELFTEST 120
#define BLTOUCH_MODE_STORE 130
#define BLTOUCH_5V_MODE 140
Expand Down Expand Up @@ -95,7 +103,7 @@ class BLTouch {

private:
FORCE_INLINE static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
FORCE_INLINE static bool _stow_query_alarm() { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
FORCE_INLINE static bool _stow_query_alarm() { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY) == STOW_ALARM; }

static void clear();
static bool command(const BLTCommand cmd, const millis_t &ms);
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ uint8_t PrintJobRecovery::queue_index_r;
uint32_t PrintJobRecovery::cmd_sdpos, // = 0
PrintJobRecovery::sdpos[BUFSIZE];

#if ENABLED(DWIN_CREALITY_LCD)
bool PrintJobRecovery::dwin_flag; // = false
#endif

#include "../sd/cardreader.h"
#include "../lcd/ultralcd.h"
#include "../gcode/queue.h"
Expand Down Expand Up @@ -105,6 +109,7 @@ void PrintJobRecovery::check() {
load();
if (!valid()) return cancel();
queue.inject_P(PSTR("M1000 S"));
TERN_(DWIN_CREALITY_LCD, dwin_flag = true);
}
}

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ class PrintJobRecovery {
static uint32_t cmd_sdpos, //!< SD position of the next command
sdpos[BUFSIZE]; //!< SD positions of queued commands

#if ENABLED(DWIN_CREALITY_LCD)
static bool dwin_flag;
#endif

static void init();
static void prepare();

Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
#include "../../../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/dwin/dwin.h"
#endif

#if HAS_MULTI_HOTEND
#include "../../../module/tool_change.h"
#endif
Expand Down Expand Up @@ -888,6 +892,10 @@ G29_TYPE GcodeSuite::G29() {
process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));
#endif

#if ENABLED(DWIN_CREALITY_LCD)
DWIN_CompletedLeveling();
#endif

report_current_position();

if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29");
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#endif

#include "../../lcd/ultralcd.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "../../lcd/dwin/dwin.h"
#endif

#if HAS_L64XX // set L6470 absolute position registers to counts
#include "../../libs/L64XX/L64XX_Marlin.h"
Expand Down Expand Up @@ -209,6 +212,8 @@ void GcodeSuite::G28() {
log_machine_info();
}

TERN_(DWIN_CREALITY_LCD, HMI_flag.home_flag = true);

#if ENABLED(DUAL_X_CARRIAGE)
bool IDEX_saved_duplication_state = extruder_duplication_enabled;
DualXMode IDEX_saved_mode = dual_x_carriage_mode;
Expand Down Expand Up @@ -475,6 +480,8 @@ void GcodeSuite::G28() {

ui.refresh();

TERN_(DWIN_CREALITY_LCD, DWIN_CompletedHoming());

report_current_position();

if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/sd/M24_M25.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../../feature/pause.h"
#include "../queue.h"
#endif

#if ENABLED(HOST_ACTION_COMMANDS)
Expand Down Expand Up @@ -98,7 +97,8 @@ void GcodeSuite::M25() {
#endif

print_job_timer.pause();
ui.reset_status();

TERN(DWIN_CREALITY_LCD,,ui.reset_status());

#if ENABLED(HOST_ACTION_COMMANDS)
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@
#define UNUSED_E(E) UNUSED(E)
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#define SERIAL_CATCHALL 0
#endif

// Pressure sensor with a BLTouch-like interface
#if ENABLED(CREALITY_TOUCH)
#define BLTOUCH
#endif

/**
* The BLTouch Probe emulates a servo probe
* and uses "special" angles for its state.
Expand Down
6 changes: 5 additions & 1 deletion Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2465,7 +2465,11 @@
#endif

// Number of VFAT entries used. Each entry has 13 UTF-16 characters
#define MAX_VFAT_ENTRIES TERN(SCROLL_LONG_FILENAMES, 5, 2)
#if EITHER(SCROLL_LONG_FILENAMES, DWIN_CREALITY_LCD)
#define MAX_VFAT_ENTRIES (5)
#else
#define MAX_VFAT_ENTRIES (2)
#endif

// Nozzle park for Delta
#if BOTH(NOZZLE_PARK_FEATURE, DELTA)
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
+ ENABLED(FIX_MOUNTED_PROBE) \
+ ENABLED(NOZZLE_AS_PROBE) \
+ (HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH)) \
+ ENABLED(BLTOUCH) \
+ ENABLED(BLTOUCH) && DISABLED(CREALITY_TOUCH) \
+ ENABLED(CREALITY_TOUCH) \
+ ENABLED(TOUCH_MI_PROBE) \
+ ENABLED(SOLENOID_PROBE) \
+ ENABLED(Z_PROBE_ALLEN_KEY) \
Expand Down Expand Up @@ -2150,6 +2151,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
+ ENABLED(FYSETC_MINI_12864_2_1) \
+ ENABLED(FYSETC_GENERIC_12864_1_1) \
+ ENABLED(CR10_STOCKDISPLAY) \
+ ENABLED(DWIN_CREALITY_LCD) \
+ ENABLED(ANET_FULL_GRAPHICS_LCD) \
+ ENABLED(AZSMZ_12864) \
+ ENABLED(SILVER_GATE_GLCD_CONTROLLER) \
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/lcd/dwin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# DWIN for Creality Ender 3 v2

Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.0.x/config/examples/Creality/Ender-3%20V2).

## Easy Install

Copy the `DWIN_SET` folder onto a Micro-SD card and insert the card into the slot on the DWIN screen. Cycle the machine and wait for the screen to go from blue to orange. Turn the machine off and remove the SD card. When you turn on the machine the screen will display a "Creality" loading screen.
Loading