Skip to content

Commit 96e1e20

Browse files
mriscocthinkyhead
authored andcommitted
✨ Ender-3 V2 CrealityUI Enhanced (MarlinFirmware#21942)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent 40514c3 commit 96e1e20

44 files changed

Lines changed: 6408 additions & 84 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Marlin/Configuration.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,6 +2774,11 @@
27742774
//
27752775
//#define DWIN_CREALITY_LCD
27762776

2777+
//
2778+
// Ender-3 v2 OEM display, enhanced.
2779+
//
2780+
//#define DWIN_CREALITY_LCD_ENHANCED
2781+
27772782
//
27782783
// Ender-3 v2 OEM display with enhancements by Jacob Myers
27792784
//

Marlin/src/MarlinCore.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
#if ENABLED(DWIN_CREALITY_LCD)
7878
#include "lcd/e3v2/creality/dwin.h"
7979
#include "lcd/e3v2/creality/rotary_encoder.h"
80+
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
81+
#include "lcd/e3v2/enhanced/dwin.h"
82+
#include "lcd/e3v2/enhanced/rotary_encoder.h"
8083
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
8184
#include "lcd/e3v2/jyersui/dwin.h"
8285
#include "lcd/e3v2/jyersui/rotary_encoder.h"
@@ -849,7 +852,7 @@ void idle(bool no_stepper_sleep/*=false*/) {
849852
TERN_(USE_BEEPER, buzzer.tick());
850853

851854
// Handle UI input / draw events
852-
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
855+
TERN(HAS_DWIN_E3V2_BASIC, DWIN_Update(), ui.update());
853856

854857
// Run i2c Position Encoders
855858
#if ENABLED(I2C_POSITION_ENCODERS)
@@ -904,7 +907,7 @@ void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr
904907
// Echo the LCD message to serial for extra context
905908
if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNPGM_P(lcd_error); }
906909

907-
#if HAS_DISPLAY
910+
#if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED)
908911
ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component ?: NUL_STR);
909912
#else
910913
UNUSED(lcd_error); UNUSED(lcd_component);
@@ -1315,7 +1318,7 @@ void setup() {
13151318
// UI must be initialized before EEPROM
13161319
// (because EEPROM code calls the UI).
13171320

1318-
#if ENABLED(DWIN_CREALITY_LCD)
1321+
#if HAS_DWIN_E3V2_BASIC
13191322
SETUP_RUN(DWIN_Startup());
13201323
#else
13211324
SETUP_RUN(ui.init());
@@ -1590,15 +1593,15 @@ void setup() {
15901593
SERIAL_ECHO_TERNARY(err, "BL24CXX Check ", "failed", "succeeded", "!\n");
15911594
#endif
15921595

1593-
#if ENABLED(DWIN_CREALITY_LCD)
1596+
#if HAS_DWIN_E3V2_BASIC
15941597
Encoder_Configuration();
15951598
HMI_Init();
15961599
HMI_SetLanguageCache();
15971600
HMI_StartFrame(true);
15981601
DWIN_StatusChanged_P(GET_TEXT(WELCOME_MSG));
15991602
#endif
16001603

1601-
#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)
1604+
#if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC
16021605
ui.reset_status(true); // Show service messages or keep current status
16031606
#endif
16041607

Marlin/src/feature/pause.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353

5454
#if ENABLED(EXTENSIBLE_UI)
5555
#include "../lcd/extui/ui_api.h"
56+
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
57+
#include "../lcd/e3v2/enhanced/dwin.h"
5658
#endif
5759

5860
#include "../lcd/marlinui.h"
@@ -242,6 +244,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
242244

243245
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE)));
244246
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
247+
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
245248
wait_for_user = true; // A click or M108 breaks the purge_length loop
246249
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
247250
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
@@ -265,7 +268,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
265268
// Show "Purge More" / "Resume" menu and wait for reply
266269
KEEPALIVE_STATE(PAUSED_FOR_USER);
267270
wait_for_user = false;
268-
#if HAS_LCD_MENU
271+
#if EITHER(HAS_LCD_MENU, DWIN_CREALITY_LCD_ENHANCED)
269272
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // Also sets PAUSE_RESPONSE_WAIT_FOR
270273
#else
271274
pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
@@ -525,6 +528,8 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
525528

526529
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged_P(GET_TEXT(MSG_REHEATING)));
527530

531+
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATING)));
532+
528533
// Re-enable the heaters if they timed out
529534
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
530535

@@ -538,8 +543,13 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
538543
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
539544

540545
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
546+
541547
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_REHEATDONE), CONTINUE_STR));
548+
542549
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE)));
550+
551+
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATDONE)));
552+
543553
wait_for_user = true;
544554
nozzle_timed_out = false;
545555

@@ -675,6 +685,7 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
675685

676686
TERN_(HAS_STATUS_MESSAGE, ui.reset_status());
677687
TERN_(HAS_LCD_MENU, ui.return_to_status());
688+
TERN_(DWIN_CREALITY_LCD_ENHANCED, HMI_ReturnScreen());
678689
}
679690

680691
#endif // ADVANCED_PAUSE_FEATURE

Marlin/src/feature/powerloss.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ uint8_t PrintJobRecovery::queue_index_r;
4040
uint32_t PrintJobRecovery::cmd_sdpos, // = 0
4141
PrintJobRecovery::sdpos[BUFSIZE];
4242

43-
#if ENABLED(DWIN_CREALITY_LCD)
43+
#if HAS_DWIN_E3V2_BASIC
4444
bool PrintJobRecovery::dwin_flag; // = false
4545
#endif
4646

Marlin/src/feature/powerloss.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class PrintJobRecovery {
145145
static uint32_t cmd_sdpos, //!< SD position of the next command
146146
sdpos[BUFSIZE]; //!< SD positions of queued commands
147147

148-
#if ENABLED(DWIN_CREALITY_LCD)
148+
#if HAS_DWIN_E3V2_BASIC
149149
static bool dwin_flag;
150150
#endif
151151

Marlin/src/feature/runout.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ bool FilamentMonitorBase::enabled = true,
6868

6969
#if ENABLED(EXTENSIBLE_UI)
7070
#include "../lcd/extui/ui_api.h"
71+
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
72+
#include "../lcd/e3v2/enhanced/dwin.h"
7173
#endif
7274

7375
void event_filament_runout(const uint8_t extruder) {
@@ -86,6 +88,7 @@ void event_filament_runout(const uint8_t extruder) {
8688
#endif
8789

8890
TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
91+
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_FilamentRunout(extruder));
8992

9093
#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
9194
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);

Marlin/src/gcode/bedlevel/abl/G29.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858

5959
#if ENABLED(EXTENSIBLE_UI)
6060
#include "../../../lcd/extui/ui_api.h"
61-
#endif
62-
63-
#if ENABLED(DWIN_CREALITY_LCD)
61+
#elif ENABLED(DWIN_CREALITY_LCD)
6462
#include "../../../lcd/e3v2/creality/dwin.h"
63+
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
64+
#include "../../../lcd/e3v2/enhanced/dwin.h"
6565
#endif
6666

6767
#if HAS_MULTI_HOTEND
@@ -403,10 +403,9 @@ G29_TYPE GcodeSuite::G29() {
403403
#if ENABLED(AUTO_BED_LEVELING_3POINT)
404404
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling");
405405
points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points
406-
#endif
407-
408-
#if BOTH(AUTO_BED_LEVELING_BILINEAR, EXTENSIBLE_UI)
409-
ExtUI::onMeshLevelingStart();
406+
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
407+
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
408+
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_MeshLevelingStart());
410409
#endif
411410

412411
if (!faux) {
@@ -886,9 +885,7 @@ G29_TYPE GcodeSuite::G29() {
886885
process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));
887886
#endif
888887

889-
#if ENABLED(DWIN_CREALITY_LCD)
890-
DWIN_CompletedLeveling();
891-
#endif
888+
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling());
892889

893890
report_current_position();
894891

Marlin/src/gcode/bedlevel/mbl/G29.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040

4141
#if ENABLED(EXTENSIBLE_UI)
4242
#include "../../../lcd/extui/ui_api.h"
43+
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
44+
#include "../../../lcd/e3v2/enhanced/dwin.h"
4345
#endif
4446

4547
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
@@ -191,6 +193,7 @@ void GcodeSuite::G29() {
191193
if (parser.seenval('Z')) {
192194
mbl.z_values[ix][iy] = parser.value_linear_units();
193195
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy]));
196+
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_MeshUpdate(ix, iy, mbl.z_values[ix][iy]));
194197
}
195198
else
196199
return echo_not_entered('Z');

Marlin/src/gcode/bedlevel/ubl/M421.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
#if ENABLED(EXTENSIBLE_UI)
3535
#include "../../../lcd/extui/ui_api.h"
36+
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
37+
#include "../../../lcd/e3v2/enhanced/dwin.h"
3638
#endif
3739

3840
/**
@@ -67,6 +69,7 @@ void GcodeSuite::M421() {
6769
float &zval = ubl.z_values[ij.x][ij.y]; // Altering this Mesh Point
6870
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL
6971
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh
72+
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_MeshUpdate(ij.x, ij.y, zval));
7073
}
7174
}
7275

Marlin/src/gcode/calibrate/G28.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@
4646
#endif
4747

4848
#include "../../lcd/marlinui.h"
49-
#if ENABLED(DWIN_CREALITY_LCD)
50-
#include "../../lcd/e3v2/creality/dwin.h"
51-
#endif
5249

5350
#if ENABLED(EXTENSIBLE_UI)
5451
#include "../../lcd/extui/ui_api.h"
52+
#elif ENABLED(DWIN_CREALITY_LCD)
53+
#include "../../lcd/e3v2/creality/dwin.h"
54+
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
55+
#include "../../lcd/e3v2/enhanced/dwin.h"
5556
#endif
5657

5758
#if HAS_L64XX // set L6470 absolute position registers to counts
@@ -238,7 +239,7 @@ void GcodeSuite::G28() {
238239
return;
239240
}
240241

241-
TERN_(DWIN_CREALITY_LCD, DWIN_StartHoming());
242+
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_StartHoming());
242243
TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart());
243244

244245
planner.synchronize(); // Wait for planner moves to finish!
@@ -522,7 +523,7 @@ void GcodeSuite::G28() {
522523

523524
ui.refresh();
524525

525-
TERN_(DWIN_CREALITY_LCD, DWIN_CompletedHoming());
526+
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedHoming());
526527
TERN_(EXTENSIBLE_UI, ExtUI::onHomingComplete());
527528

528529
report_current_position();

0 commit comments

Comments
 (0)