Prusa MINI Firmware overview
|
Go to the source code of this file.
◆ tool_change()
Marlin 3D Printer Firmware Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
Based on Sprinter and grbl. Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. Perform a tool-change, which may result in moving the previous tool out of the way and the new tool into place.
Perform a tool-change, which may result in moving the previous tool out of the way and the new tool into place.
773 #if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
777 #if ENABLED(MIXING_EXTRUDER)
782 return invalid_extruder_error(new_tool);
784 #if MIXING_VIRTUAL_TOOLS > 1
789 #elif ENABLED(PRUSA_MMU2)
804 if (new_tool) invalid_extruder_error(new_tool);
807 #else // EXTRUDERS > 1
811 #if ENABLED(DUAL_X_CARRIAGE) // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_MIRRORED_MODE
812 if (new_tool != 0 && dxc_is_duplicating())
813 return invalid_extruder_error(new_tool);
817 return invalid_extruder_error(new_tool);
825 ui.return_to_status();
828 #if ENABLED(DUAL_X_CARRIAGE)
829 const bool idex_full_control = dual_x_carriage_mode == DXC_FULL_CONTROL_MODE;
831 constexpr
bool idex_full_control =
false;
835 const bool can_move_away = !no_move && !idex_full_control;
837 #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
838 const bool should_swap = can_move_away && toolchange_settings.swap_length;
839 #if ENABLED(PREVENT_COLD_EXTRUSION)
842 constexpr
bool too_cold =
false;
847 #if ENABLED(SINGLENOZZLE)
853 #if ENABLED(ADVANCED_PAUSE_FEATURE)
854 do_pause_e_move(-toolchange_settings.swap_length,
MMM_TO_MMS(toolchange_settings.retract_speed));
862 #endif // TOOLCHANGE_FILAMENT_SWAP
869 if (new_tool != old_tool) {
871 #if SWITCHING_NOZZLE_TWO_SERVOS
872 raise_nozzle(old_tool);
877 #if HAS_SOFTWARE_ENDSTOPS
878 #if HAS_HOTEND_OFFSET
879 #define _EXT_ARGS , old_tool, new_tool
884 #if DISABLED(DUAL_X_CARRIAGE)
892 #if DISABLED(SWITCHING_NOZZLE)
896 #if HAS_SOFTWARE_ENDSTOPS
900 #if ENABLED(TOOLCHANGE_PARK)
908 #if HAS_HOTEND_OFFSET
910 #if ENABLED(DUAL_X_CARRIAGE)
917 #if ENABLED(DUAL_X_CARRIAGE)
918 dualx_tool_change(new_tool, no_move);
919 #elif ENABLED(PARKING_EXTRUDER) // Dual Parking extruder
920 parking_extruder_tool_change(new_tool, no_move);
921 #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) // Magnetic Parking extruder
922 magnetic_parking_extruder_tool_change(new_tool);
923 #elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead
924 switching_toolhead_tool_change(new_tool, no_move);
925 #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching Toolhead
926 magnetic_switching_toolhead_tool_change(new_tool, no_move);
927 #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching ToolChanger
928 em_switching_toolhead_tool_change(new_tool, no_move);
929 #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS // Switching Nozzle (single servo)
933 #if HAS_SOFTWARE_ENDSTOPS
937 move_nozzle_servo(new_tool);
940 #if DISABLED(DUAL_X_CARRIAGE)
955 constexpr
bool safe_to_move =
true;
959 if (safe_to_move && !no_move &&
IsRunning()) {
961 #if ENABLED(SINGLENOZZLE)
967 singlenozzle_temp[old_tool] =
thermalManager.temp_hotend[0].target;
968 if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
977 #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
978 if (should_swap && !too_cold) {
979 #if ENABLED(ADVANCED_PAUSE_FEATURE)
980 do_pause_e_move(toolchange_settings.swap_length,
MMM_TO_MMS(toolchange_settings.prime_speed));
981 do_pause_e_move(toolchange_settings.extra_prime, ADVANCED_PAUSE_PURGE_FEEDRATE);
994 #if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
996 if (
destination.
y < SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR) {
1006 if (can_move_away) {
1007 #if ENABLED(TOOLCHANGE_NO_RETURN)
1019 #if ENABLED(DUAL_X_CARRIAGE)
1020 active_extruder_parked =
false;
1023 #if ENABLED(SWITCHING_NOZZLE)
1030 #if ENABLED(PRUSA_MMU2)
1034 #if SWITCHING_NOZZLE_TWO_SERVOS
1035 lower_nozzle(new_tool);
1042 #if ENABLED(EXT_SOLENOID) && DISABLED(PARKING_EXTRUDER)
1047 #if ENABLED(MK2_MULTIPLEXER)
1048 if (new_tool >=
E_STEPPERS)
return invalid_extruder_error(new_tool);
1052 #if DO_SWITCH_EXTRUDER
1064 #endif // EXTRUDERS > 1
float delta_clip_start_height
T z
Definition: types.h:286
void enable_solenoid_on_active_extruder()
Definition: solenoid.cpp:77
#define MIXING_VIRTUAL_TOOLS
Definition: mixing.h:47
T z
Definition: types.h:383
static void synchronize()
Definition: planner.cpp:1556
xyz_pos_t max
Definition: motion.h:139
T x
Definition: types.h:286
feedRate_t max_feedrate_mm_s[XYZE_N]
Definition: planner.h:182
#define DEBUG_ECHOLNPGM(...)
Definition: debug_out.h:79
#define _MAX(V...)
Definition: macros.h:346
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s)
Definition: motion.cpp:450
T e
Definition: types.h:383
xyze_pos_t destination
Definition: motion.cpp:110
#define DEBUG_ECHOLNPAIR(...)
Definition: debug_out.h:82
#define SERIAL_ECHO_START()
Definition: serial.h:179
bool IsRunning()
Definition: Marlin.h:331
#define NOMORE(v, n)
Definition: macros.h:133
void disable_all_solenoids()
Definition: solenoid.cpp:79
#define SERIAL_ECHO_MSG(S)
Definition: serial.h:183
xyze_pos_t current_position
Definition: motion.cpp:102
static FORCE_INLINE bool targetTooColdToExtrude(const uint8_t)
Definition: temperature.h:315
void do_blocking_move_to(const float rx, const float ry, const float rz, const feedRate_t &fr_mm_s)
Definition: motion.cpp:344
void sync_plan_position()
Definition: motion.cpp:216
#define REMEMBER(N, X, V...)
Definition: utility.h:76
void
Definition: png.h:1083
T x
Definition: types.h:383
#define XY_PROBE_FEEDRATE_MM_S
Definition: motion.h:77
static bool buffer_line(const float &rx, const float &ry, const float &rz, const float &e, const feedRate_t &fr_mm_s, const uint8_t extruder, const float millimeters=0.0)
Definition: planner.cpp:2663
feedRate_t feedrate_mm_s
Definition: motion.cpp:138
#define SERIAL_ECHOLNPAIR(V...)
Definition: serial.h:144
#define DEBUG_POS(...)
Definition: debug_out.h:87
const uint8_t[]
Definition: 404_html.c:3
void update_software_endstops(const AxisEnum axis)
Definition: motion.cpp:503
#define E_STEPPERS
Definition: Conditionals_LCD.h:429
T y
Definition: types.h:286
void select_multiplexed_stepper(const uint8_t e)
static FORCE_INLINE void T(const uint_fast8_t c)
Definition: mixing.h:113
constexpr xyz_pos_t hotend_offset[1]
Definition: motion.h:136
static void set_e_position_mm(const float &e)
Definition: planner.cpp:2764
#define EXTRUDERS
Definition: Configuration_A3ides_2209_MINI.h:148
void apply_motion_limits(xyz_pos_t &target)
Definition: motion.cpp:589
#define DEBUGGING(F)
Definition: serial.h:47
#define MSG_ERR_HOTEND_TOO_COLD
Definition: language.h:244
#define MMM_TO_MMS(MM_M)
Definition: types.h:83
static planner_settings_t settings
Definition: planner.h:251
#define MSG_ACTIVE_EXTRUDER
Definition: language.h:183
axis_limits_t soft_endstop
Definition: motion.cpp:489
Temperature thermalManager
Definition: temperature.cpp:89
#define UNUSED(X)
Definition: stm32f4xx_hal_def.h:74
#define TEMPORARY_BED_LEVELING_STATE(enable)
Definition: bedlevel.h:54
constexpr uint8_t active_extruder
Definition: motion.h:107
static void tool_change(uint8_t index)
Planner planner
Definition: planner.cpp:111
FORCE_INLINE bool all_axes_homed()
Definition: motion.h:44
T y
Definition: types.h:383
void fanmux_switch(const uint8_t e)