Skip to content

Commit

Permalink
✨ Improve pause/filament change for ExtUI (#22655)
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanityAutomation authored and thinkyhead committed Oct 3, 2021
1 parent 023eaab commit e7a25a4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,8 @@
#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
//#define FILAMENT_CHANGE_RESUME_ON_INSERT // Automatically continue / load filament when runout sensor is triggered again.
//#define PAUSE_REHEAT_FAST_RESUME // Reduce number of waits by not prompting again post-timeout before continuing.
//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
//#define HOME_BEFORE_FILAMENT_CHANGE // If needed, home before parking for filament change
Expand Down
16 changes: 12 additions & 4 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load

while (wait_for_user) {
impatient_beep(max_beep_count);
#if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
#if ENABLED(MULTI_FILAMENT_SENSOR)
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
switch (active_extruder) {
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_INSERTED)
}
#else
if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) wait_for_user = false;
#endif
#endif
idle_no_sleep();
}
}
Expand Down Expand Up @@ -545,14 +555,12 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);

TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_REHEATDONE), CONTINUE_STR));

TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_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;
IF_DISABLED(PAUSE_REHEAT_FAST_RESUME, wait_for_user = true);

nozzle_timed_out = false;
first_impatient_beep(max_beep_count);
}
idle_no_sleep();
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/extui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,8 @@ namespace ExtUI {

#if M600_PURGE_MORE_RESUMABLE
void setPauseMenuResponse(PauseMenuResponse response) { pause_menu_response = response; }
PauseMessage pauseModeStatus = PAUSE_MESSAGE_STATUS;
PauseMode getPauseMode() { return pause_mode;}
#endif

void printFile(const char *filename) {
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/extui/ui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ namespace ExtUI {

#if M600_PURGE_MORE_RESUMABLE
void setPauseMenuResponse(PauseMenuResponse);
extern PauseMessage pauseModeStatus;
PauseMode getPauseMode();
#endif

#if ENABLED(LIN_ADVANCE)
Expand Down
9 changes: 2 additions & 7 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1723,9 +1723,8 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
const PauseMode mode/*=PAUSE_MODE_SAME*/,
const uint8_t extruder/*=active_extruder*/
) {
if (mode == PAUSE_MODE_SAME)
return;
pause_mode = mode;
ExtUI::pauseModeStatus = message;
switch (message) {
case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PAUSE_PRINT_PARKING));
case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INIT));
Expand All @@ -1734,11 +1733,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INSERT));
case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_LOAD));
case PAUSE_MESSAGE_PURGE:
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_CONT_PURGE));
#else
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE));
#endif
ExtUI::onUserConfirmRequired_P(GET_TEXT(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE)));
case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_RESUME));
case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEAT));
case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING));
Expand Down
7 changes: 4 additions & 3 deletions buildroot/tests/BIGTREE_GTR_V1_0
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
# Not necessary to enable auto-fan for all extruders to hit problematic code paths
opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_PIN PF13 \
X_DRIVER_TYPE TMC2208 Y_DRIVER_TYPE TMC2130 \
FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 \
FIL_RUNOUT4_STATE HIGH FIL_RUNOUT8_STATE HIGH
NUM_RUNOUT_SENSORS 8 FIL_RUNOUT_PIN 3 FIL_RUNOUT2_PIN 4 FIL_RUNOUT3_PIN 5 FIL_RUNOUT4_PIN 6 FIL_RUNOUT5_PIN 7 \
FIL_RUNOUT6_PIN 8 FIL_RUNOUT7_PIN 9 FIL_RUNOUT8_PIN 10 FIL_RUNOUT4_STATE HIGH FIL_RUNOUT8_STATE HIGH \
FILAMENT_RUNOUT_SCRIPT '"M600 T%c"'
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH NEOPIXEL_LED Z_SAFE_HOMING NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \
FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP
FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME
exec_test $1 $2 "BigTreeTech GTR | 8 Extruders | Auto-Fan | Mixed TMC Drivers | Runout Sensors w/ distinct states" "$3"

restore_configs
Expand Down

0 comments on commit e7a25a4

Please sign in to comment.