Skip to content

Commit

Permalink
Fix Ender-3 V2 DWIN Stop SD Print (MarlinFirmware#19642)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
signetica and thinkyhead committed Oct 16, 2020
1 parent 8a69147 commit 6fcbf11
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions Marlin/src/lcd/dwin/e3v2/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ uint8_t index_file = MROWS,
index_leveling = MROWS,
index_tune = MROWS;

bool dwin_abort_flag = false;
bool dwin_abort_flag = false; // Flag to reset feedrate, return to Home

constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE;
constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION;
Expand Down Expand Up @@ -1801,8 +1801,8 @@ void HMI_SDCardUpdate() {
// TODO: Move card removed abort handling
// to CardReader::manage_media.
card.flag.abort_sd_printing = true;
wait_for_heatup = false;
dwin_abort_flag = true;
wait_for_heatup = wait_for_user = false;
dwin_abort_flag = true; // Reset feedrate, return to Home
}
}
DWIN_UpdateLCD();
Expand Down Expand Up @@ -2097,7 +2097,7 @@ void HMI_Printing() {
if (HMI_flag.done_confirm_flag) {
if (encoder_diffState == ENCODER_DIFF_ENTER) {
HMI_flag.done_confirm_flag = false;
dwin_abort_flag = true;
dwin_abort_flag = true; // Reset feedrate, return to Home
}
return;
}
Expand Down Expand Up @@ -2206,25 +2206,15 @@ void HMI_PauseOrStop() {
}
else if (select_print.now == 2) { // stop window
if (HMI_flag.select_flag) {
wait_for_heatup = false; // Stop waiting for heater

#if 0
// TODO: In ExtUI or MarlinUI add a common stop event
// card.flag.abort_sd_printing = true;
#else
checkkey = Back_Main;
// Wait for planner moves to finish!
if (HMI_flag.home_flag) planner.synchronize();
card.endFilePrint();
#ifdef ACTION_ON_CANCEL
host_action_cancel();
#endif
#ifdef EVENT_GCODE_SD_ABORT
Popup_Window_Home(true);
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
#endif
dwin_abort_flag = true;
checkkey = Back_Main;
if (HMI_flag.home_flag) planner.synchronize(); // Wait for planner moves to finish!
wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user
card.flag.abort_sd_printing = true; // Let the main loop handle SD abort
dwin_abort_flag = true; // Reset feedrate, return to Home
#ifdef ACTION_ON_CANCEL
host_action_cancel();
#endif
Popup_Window_Home(true);
}
else
Goto_PrintProcess(); // cancel stop
Expand Down Expand Up @@ -3584,13 +3574,6 @@ void EachMomentUpdate() {
dwin_abort_flag = false;
HMI_ValueStruct.print_speed = feedrate_percentage = 100;
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);

planner.finish_and_disable();

#if DISABLED(SD_ABORT_NO_COOLDOWN)
thermalManager.disable_all_heaters();
#endif

select_page.set(0);
Goto_MainMenu();
}
Expand Down

0 comments on commit 6fcbf11

Please sign in to comment.