Prusa MINI Firmware overview
pause.h
Go to the documentation of this file.
1 /**
2  * Marlin 3D Printer Firmware
3  * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4  *
5  * Based on Sprinter and grbl.
6  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #pragma once
23 
24 /**
25  * feature/pause.h - Pause feature support functions
26  * This may be combined with related G-codes if features are consolidated.
27  */
28 
29 typedef struct {
30  float unload_length, load_length;
32 
33 #include "../inc/MarlinConfigPre.h"
34 
35 #if ENABLED(ADVANCED_PAUSE_FEATURE)
36 
37 #include "../libs/nozzle.h"
38 
39 enum PauseMode : char {
40  PAUSE_MODE_SAME,
41  PAUSE_MODE_PAUSE_PRINT,
42  PAUSE_MODE_CHANGE_FILAMENT,
43  PAUSE_MODE_LOAD_FILAMENT,
44  PAUSE_MODE_UNLOAD_FILAMENT
45 };
46 
47 enum PauseMessage : char {
48  PAUSE_MESSAGE_PAUSING,
49  PAUSE_MESSAGE_CHANGING,
50  PAUSE_MESSAGE_WAITING,
51  PAUSE_MESSAGE_UNLOAD,
52  PAUSE_MESSAGE_INSERT,
53  PAUSE_MESSAGE_LOAD,
54  PAUSE_MESSAGE_PURGE,
55  PAUSE_MESSAGE_OPTION,
56  PAUSE_MESSAGE_RESUME,
57  PAUSE_MESSAGE_STATUS,
58  PAUSE_MESSAGE_HEAT,
59  PAUSE_MESSAGE_HEATING
60 };
61 
62 enum PauseMenuResponse : char {
63  PAUSE_RESPONSE_WAIT_FOR,
64  PAUSE_RESPONSE_EXTRUDE_MORE,
65  PAUSE_RESPONSE_RESUME_PRINT
66 };
67 
68 extern PauseMode pause_mode;
69 extern PauseMenuResponse pause_menu_response;
70 
71 extern fil_change_settings_t fc_settings[EXTRUDERS];
72 
73 extern uint8_t did_pause_print;
74 
75 #if ENABLED(DUAL_X_CARRIAGE)
76  #define DXC_PARAMS , const int8_t DXC_ext=-1
77  #define DXC_ARGS , const int8_t DXC_ext
78  #define DXC_PASS , DXC_ext
79 #else
80  #define DXC_PARAMS
81  #define DXC_ARGS
82  #define DXC_PASS
83 #endif
84 
85 void do_pause_e_move(const float &length, const feedRate_t &fr_mm_s);
86 
87 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS);
88 
89 void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS);
90 
91 void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0 DXC_PARAMS);
92 
93 bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0, const bool show_lcd=false,
94  const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);
95 
96 bool unload_filament(const float &unload_length, const bool show_lcd=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT
97  #if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
98  , const float &mix_multiplier=1.0
99  #endif
100 );
101 
102 #endif // ADVANCED_PAUSE_FEATURE
Temperature::reset_heater_idle_timer
static void reset_heater_idle_timer(const uint8_t E_NAME)
Definition: temperature.h:728
SERIAL_CHAR
#define SERIAL_CHAR(x)
Definition: serial.h:69
XYZEval
Definition: types.h:101
XYZEval::z
T z
Definition: types.h:383
Planner::synchronize
static void synchronize()
Definition: planner.cpp:1556
host_action_prompt_end
void host_action_prompt_end()
Definition: marlin_server.cpp:1047
Temperature::hotEnoughToExtrude
static FORCE_INLINE bool hotEnoughToExtrude(const uint8_t e)
Definition: temperature.h:318
runout.h
host_action_resumed
void host_action_resumed()
Definition: marlin_server.cpp:1025
host_prompt_do
void host_prompt_do(const PromptReason type, const char *const pstr, const char *const pbtn)
Definition: marlin_server.cpp:1103
IS_SD_PRINTING
#define IS_SD_PRINTING()
Definition: cardreader.h:295
stepper
Stepper stepper
Definition: stepper.cpp:82
planner_settings_t::retract_acceleration
float retract_acceleration
Definition: planner.h:183
do_blocking_move_to_z
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s)
Definition: motion.cpp:450
print_job_timer
Stopwatch print_job_timer
Definition: printcounter.cpp:63
do_blocking_move_to_xy
void do_blocking_move_to_xy(const float &rx, const float &ry, const feedRate_t &fr_mm_s)
Definition: motion.cpp:454
g29_auto.start
start
Definition: g29_auto.py:150
FilamentMonitorBase::filament_ran_out
static bool filament_ran_out
Definition: runout.h:53
XYZEval::e
T e
Definition: types.h:383
fil_change_settings_t::unload_length
float unload_length
Definition: pause.h:30
destination
xyze_pos_t destination
Definition: motion.cpp:110
millis
uint32_t millis(void)
Definition: wiring_time.c:29
SERIAL_ECHO_START
#define SERIAL_ECHO_START()
Definition: serial.h:179
feedRate_t
float feedRate_t
Definition: types.h:80
KEEPALIVE_STATE
#define KEEPALIVE_STATE(N)
Definition: gcode.h:365
extruder_duplication_enabled
bool extruder_duplication_enabled
Definition: motion.cpp:876
wait_for_user
bool wait_for_user
Definition: Marlin.cpp:188
SERIAL_ECHO_MSG
#define SERIAL_ECHO_MSG(S)
Definition: serial.h:183
PSTR
#define PSTR(str)
Definition: pgmspace.h:31
current_position
xyze_pos_t current_position
Definition: motion.cpp:102
Temperature::targetTooColdToExtrude
static FORCE_INLINE bool targetTooColdToExtrude(const uint8_t)
Definition: temperature.h:315
line_to_current_position
void line_to_current_position(const feedRate_t &fr_mm_s)
Definition: motion.cpp:285
Stepper::set_directions
static void set_directions()
Definition: stepper.cpp:354
Temperature::hotend_idle
static heater_idle_t hotend_idle[HOTENDS]
Definition: temperature.h:322
runout
FilamentMonitor runout
TFilamentMonitor::reset
static void reset()
Definition: runout.h:76
HAS_FILAMENT_SENSOR
#define HAS_FILAMENT_SENSOR
Definition: Conditionals_LCD.h:535
Stopwatch::pause
static bool pause()
Pause the stopwatch.
Definition: stopwatch.cpp:52
Stopwatch::start
static bool start()
Start the stopwatch.
Definition: stopwatch.cpp:68
heater_idle_t::timed_out
bool timed_out
Definition: temperature.h:200
if
if(size<=((png_alloc_size_t) -1) - ob)
Definition: pngwrite.c:2176
HOTEND_LOOP
#define HOTEND_LOOP()
Definition: Conditionals_LCD.h:436
ELAPSED
#define ELAPSED(NOW, SOON)
Definition: millis_t.h:29
uint8_t
const uint8_t[]
Definition: 404_html.c:3
ui
MarlinUI ui
Stopwatch::isPaused
static FORCE_INLINE bool isPaused()
Check if the timer is paused.
Definition: stopwatch.h:100
pause.h
Planner::set_e_position_mm
static void set_e_position_mm(const float &e)
Definition: planner.cpp:2764
EXTRUDERS
#define EXTRUDERS
Definition: Configuration_A3ides_2209_MINI.h:148
DEBUGGING
#define DEBUGGING(F)
Definition: serial.h:47
host_action_prompt_button
void host_action_prompt_button(const char *const pstr)
Definition: marlin_server.cpp:1039
MSG_ERR_HOTEND_TOO_COLD
#define MSG_ERR_HOTEND_TOO_COLD
Definition: language.h:244
SERIAL_EOL
#define SERIAL_EOL()
Definition: serial.h:181
host_actions.h
axes_need_homing
uint8_t axes_need_homing(uint8_t axis_bits)
Definition: motion.cpp:1041
host_action_paused
void host_action_paused(const bool eol)
Definition: marlin_server.cpp:1021
safe_delay
void safe_delay(millis_t ms)
Definition: utility.cpp:28
host_action_pause
void host_action_pause(const bool eol)
Definition: marlin_server.cpp:1009
BOTH
#define BOTH(V1, V2)
Definition: macros.h:183
XYZval< float >
length
png_uint_32 length
Definition: png.c:2247
serialprintPGM
void serialprintPGM(PGM_P str)
Definition: serial.cpp:35
Planner::settings
static planner_settings_t settings
Definition: planner.h:251
ExtUI::onStatusChanged
void onStatusChanged(const char *const msg)
Definition: marlin_server.cpp:904
host_action_prompt_show
void host_action_prompt_show()
Definition: marlin_server.cpp:1053
mode
png_structrp int mode
Definition: png.h:1139
HAS_LCD_MENU
#define HAS_LCD_MENU
Definition: Conditionals_LCD.h:360
nozzle
Nozzle nozzle
Definition: nozzle.cpp:29
disable_e_stepper
void disable_e_stepper(const uint8_t e)
Definition: Marlin.cpp:297
idle
void idle()
Definition: Marlin.cpp:629
fil_change_settings_t
Definition: pause.h:29
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
UNUSED
#define UNUSED(X)
Definition: stm32f4xx_hal_def.h:74
host_action_resume
void host_action_resume()
Definition: marlin_server.cpp:1013
millis_t
uint32_t millis_t
Definition: millis_t.h:26
BUZZ
#define BUZZ(d, f)
Definition: buzzer.h:126
active_extruder
constexpr uint8_t active_extruder
Definition: motion.h:107
host_action_prompt_begin
void host_action_prompt_begin(const char *const pstr, const bool eol)
Definition: marlin_server.cpp:1033
host_prompt_reason
PromptReason host_prompt_reason
Definition: marlin_server.cpp:77
planner
Planner planner
Definition: planner.cpp:111
const
#define const
Definition: zconf.h:230
fwretract.h