Skip to content

Commit

Permalink
Separate integration
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 7, 2021
1 parent be6bcbe commit 8179ffe
Show file tree
Hide file tree
Showing 36 changed files with 136 additions and 167 deletions.
5 changes: 5 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,11 @@
//
//#define DWIN_CREALITY_LCD

//
// Ender-3 v2 OEM display, enhanced.
//
//#define DWIN_CREALITY_LCD_ENHANCED

//
// Ender-3 v2 OEM display with enhancements by Jacob Myers
//
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ void idle(bool no_stepper_sleep/*=false*/) {
TERN_(USE_BEEPER, buzzer.tick());

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

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

#if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD)
#if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED)
ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component ?: NUL_STR);
#else
UNUSED(lcd_error); UNUSED(lcd_component);
Expand Down Expand Up @@ -1318,7 +1318,7 @@ void setup() {
// UI must be initialized before EEPROM
// (because EEPROM code calls the UI).

#if ENABLED(DWIN_CREALITY_LCD)
#if HAS_DWIN_E3V2_BASIC
SETUP_RUN(DWIN_Startup());
#else
SETUP_RUN(ui.init());
Expand Down Expand Up @@ -1593,15 +1593,15 @@ void setup() {
SERIAL_ECHO_TERNARY(err, "BL24CXX Check ", "failed", "succeeded", "!\n");
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#if HAS_DWIN_E3V2_BASIC
Encoder_Configuration();
HMI_Init();
HMI_SetLanguageCache();
HMI_StartFrame(true);
DWIN_StatusChanged_P(GET_TEXT(WELCOME_MSG));
#endif

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

Expand Down
14 changes: 6 additions & 8 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@

#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#endif

Expand Down Expand Up @@ -246,7 +244,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load

TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE)));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
wait_for_user = true; // A click or M108 breaks the purge_length loop
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
Expand All @@ -270,7 +268,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
// Show "Purge More" / "Resume" menu and wait for reply
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
#if EITHER(HAS_LCD_MENU, DWIN_CREALITY_LCD)
#if EITHER(HAS_LCD_MENU, DWIN_CREALITY_LCD_ENHANCED)
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // Also sets PAUSE_RESPONSE_WAIT_FOR
#else
pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
Expand Down Expand Up @@ -530,7 +528,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep

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

TERN_(DWIN_CREALITY_LCD, ui.set_status_P(GET_TEXT(MSG_REHEATING)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATING)));

// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_hotend_idle_timer(e);
Expand All @@ -550,7 +548,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep

TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_REHEATDONE)));

TERN_(DWIN_CREALITY_LCD, ui.set_status_P(GET_TEXT(MSG_REHEATDONE)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status_P(GET_TEXT(MSG_REHEATDONE)));

wait_for_user = true;
nozzle_timed_out = false;
Expand Down Expand Up @@ -687,7 +685,7 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_

TERN_(HAS_STATUS_MESSAGE, ui.reset_status());
TERN_(HAS_LCD_MENU, ui.return_to_status());
TERN_(DWIN_CREALITY_LCD, HMI_ReturnScreen());
TERN_(DWIN_CREALITY_LCD_ENHANCED, HMI_ReturnScreen());
}

#endif // ADVANCED_PAUSE_FEATURE
2 changes: 1 addition & 1 deletion Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ uint8_t PrintJobRecovery::queue_index_r;
uint32_t PrintJobRecovery::cmd_sdpos, // = 0
PrintJobRecovery::sdpos[BUFSIZE];

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

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ 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)
#if HAS_DWIN_E3V2_BASIC
static bool dwin_flag;
#endif

Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/feature/runout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ bool FilamentMonitorBase::enabled = true,

#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#endif

Expand All @@ -90,7 +88,7 @@ void event_filament_runout(const uint8_t extruder) {
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
TERN_(DWIN_CREALITY_LCD, DWIN_FilamentRunout(extruder));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_FilamentRunout(extruder));

#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);
Expand Down
21 changes: 7 additions & 14 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@

#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#endif

Expand Down Expand Up @@ -403,14 +403,9 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(AUTO_BED_LEVELING_3POINT)
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling");
points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points
#endif

#if BOTH(AUTO_BED_LEVELING_BILINEAR, EXTENSIBLE_UI)
ExtUI::onMeshLevelingStart();
#endif

#if BOTH(AUTO_BED_LEVELING_BILINEAR, DWIN_CREALITY_LCD)
DWIN_MeshLevelingStart();
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_MeshLevelingStart());
#endif

if (!faux) {
Expand Down Expand Up @@ -890,9 +885,7 @@ G29_TYPE GcodeSuite::G29() {
process_subcommands_now_P(PSTR(Z_PROBE_END_SCRIPT));
#endif

#if ENABLED(DWIN_CREALITY_LCD)
DWIN_CompletedLeveling();
#endif
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling());

report_current_position();

Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/gcode/bedlevel/mbl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@

#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#endif

Expand Down Expand Up @@ -195,7 +193,7 @@ void GcodeSuite::G29() {
if (parser.seenval('Z')) {
mbl.z_values[ix][iy] = parser.value_linear_units();
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy]));
TERN_(DWIN_CREALITY_LCD, DWIN_MeshUpdate(ix, iy, mbl.z_values[ix][iy]));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_MeshUpdate(ix, iy, mbl.z_values[ix][iy]));
}
else
return echo_not_entered('Z');
Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/gcode/bedlevel/ubl/M421.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@

#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#endif

Expand Down Expand Up @@ -71,7 +69,7 @@ void GcodeSuite::M421() {
float &zval = ubl.z_values[ij.x][ij.y]; // Altering this Mesh Point
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh
TERN_(DWIN_CREALITY_LCD, DWIN_MeshUpdate(ij.x, ij.y, zval));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_MeshUpdate(ij.x, ij.y, zval));
}
}

Expand Down
11 changes: 6 additions & 5 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@
#endif

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

#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#endif

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

TERN_(DWIN_CREALITY_LCD, DWIN_StartHoming());
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_StartHoming());
TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart());

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

ui.refresh();

TERN_(DWIN_CREALITY_LCD, DWIN_CompletedHoming());
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedHoming());
TERN_(EXTENSIBLE_UI, ExtUI::onHomingComplete());

report_current_position();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/control/M997.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#if ENABLED(PLATFORM_M997_SUPPORT)

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

Expand All @@ -33,7 +33,7 @@
*/
void GcodeSuite::M997() {

TERN_(DWIN_CREALITY_LCD, DWIN_RebootScreen());
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_RebootScreen());

flashFirmware(parser.intval('S'));

Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/gcode/feature/powerloss/M1000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@
#include "../../gcode.h"
#include "../../../feature/powerloss.h"
#include "../../../module/motion.h"

#include "../../../lcd/marlinui.h"
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../../lcd/e3v2/jyersui/dwin.h" // Temporary fix until it can be better implemented
#endif
Expand Down Expand Up @@ -64,7 +69,7 @@ void GcodeSuite::M1000() {
if (parser.seen_test('S')) {
#if HAS_LCD_MENU
ui.goto_screen(menu_job_recovery);
#elif ENABLED(DWIN_CREALITY_LCD)
#elif HAS_DWIN_E3V2_BASIC
recovery.dwin_flag = true;
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented
CrealityDWIN.Popup_Handler(Resume);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/lcd/M0_M1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "../../lcd/marlinui.h"
#elif ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#endif

Expand Down Expand Up @@ -70,7 +70,7 @@ void GcodeSuite::M0_M1() {
ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string??
else
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT));
#elif ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg ?: GET_TEXT(MSG_STOPPED), GET_TEXT(MSG_USERWAIT));
#else

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/lcd/M73.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "../../lcd/marlinui.h"
#include "../../sd/cardreader.h"

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

Expand All @@ -40,7 +40,7 @@
*/
void GcodeSuite::M73() {

#if ENABLED(DWIN_CREALITY_LCD)
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)

DWIN_Progress_Update();

Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/gcode/sd/M1001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@

#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#endif

Expand Down Expand Up @@ -110,7 +108,7 @@ void GcodeSuite::M1001() {
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onPrintFinished());
TERN_(DWIN_CREALITY_LCD, DWIN_Print_Finished());
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Print_Finished());

// Re-select the last printed file in the UI
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
Expand Down
Loading

0 comments on commit 8179ffe

Please sign in to comment.