Prusa MINI Firmware overview
tool_change.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 #include "../inc/MarlinConfigPre.h"
25 #include "../core/types.h"
26 
27 #if EXTRUDERS > 1
28 
29  typedef struct {
30  #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
31  float swap_length, extra_prime;
32  int16_t prime_speed, retract_speed;
33  #endif
34  #if ENABLED(TOOLCHANGE_PARK)
35  xy_pos_t change_point;
36  #endif
37  float z_raise;
38  } toolchange_settings_t;
39 
40  extern toolchange_settings_t toolchange_settings;
41 
42 #endif
43 
44 #if DO_SWITCH_EXTRUDER
45  void move_extruder_servo(const uint8_t e);
46 #endif
47 
48 #if ENABLED(SWITCHING_NOZZLE)
49  #if SWITCHING_NOZZLE_TWO_SERVOS
50  void lower_nozzle(const uint8_t e);
51  void raise_nozzle(const uint8_t e);
52  #else
53  void move_nozzle_servo(const uint8_t angle_index);
54  #endif
55 #endif
56 
57 #if ENABLED(PARKING_EXTRUDER)
58 
59  #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
60  #define PE_MAGNET_ON_STATE !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
61  #else
62  #define PE_MAGNET_ON_STATE PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
63  #endif
64 
65  void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state);
66 
67  inline void pe_activate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, PE_MAGNET_ON_STATE); }
68  inline void pe_deactivate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, !PE_MAGNET_ON_STATE); }
69 
70  void pe_solenoid_init();
71 
72 #elif ENABLED(MAGNETIC_PARKING_EXTRUDER)
73 
74  typedef struct MPESettings {
75  float parking_xpos[2], // M951 L R
76  grab_distance; // M951 I
77  feedRate_t slow_feedrate, // M951 J
78  fast_feedrate; // M951 H
79  float travel_distance, // M951 D
80  compensation_factor; // M951 C
81  } mpe_settings_t;
82 
83  extern mpe_settings_t mpe_settings;
84 
85  void mpe_settings_init();
86 
87 #endif
88 
89 #if ENABLED(SINGLENOZZLE)
90  extern uint16_t singlenozzle_temp[EXTRUDERS];
91  #if FAN_COUNT > 0
92  extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
93  #endif
94 #endif
95 
96 #if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
97  void est_init();
98 #endif
99 
100 /**
101  * Perform a tool-change, which may result in moving the
102  * previous tool out of the way and the new tool into place.
103  */
104 void tool_change(const uint8_t tmp_extruder, bool no_move=false);
delta_clip_start_height
float delta_clip_start_height
planner.h
XYZval::z
T z
Definition: types.h:286
enable_solenoid_on_active_extruder
void enable_solenoid_on_active_extruder()
Definition: solenoid.cpp:77
SERIAL_CHAR
#define SERIAL_CHAR(x)
Definition: serial.h:69
MIXING_VIRTUAL_TOOLS
#define MIXING_VIRTUAL_TOOLS
Definition: mixing.h:47
XYZEval::z
T z
Definition: types.h:383
Planner::synchronize
static void synchronize()
Definition: planner.cpp:1556
temperature.h
axis_limits_t::max
xyz_pos_t max
Definition: motion.h:139
SERIAL_ECHO
#define SERIAL_ECHO(x)
Definition: serial.h:70
OUT_WRITE
#define OUT_WRITE(IO, V)
Definition: fastio.h:108
mixer
Mixer mixer
XYZval::x
T x
Definition: types.h:286
planner_settings_t::max_feedrate_mm_s
feedRate_t max_feedrate_mm_s[XYZE_N]
Definition: planner.h:182
slow_line_to_current
void slow_line_to_current(const AxisEnum fr_axis)
Definition: tool_change.cpp:139
LOW
#define LOW
Definition: wiring_constants.h:70
X_AXIS
Definition: types.h:37
g29_auto.gcode
list gcode
Definition: g29_auto.py:44
DEBUG_ECHOLNPGM
#define DEBUG_ECHOLNPGM(...)
Definition: debug_out.h:79
_MAX
#define _MAX(V...)
Definition: macros.h:346
do_blocking_move_to_z
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s)
Definition: motion.cpp:450
XYZEval::e
T e
Definition: types.h:383
set_axis_is_at_home
void set_axis_is_at_home(const AxisEnum axis)
Definition: motion.cpp:1361
state
static volatile fsensor_t state
Definition: filament_sensor.c:23
AxisEnum
AxisEnum
Definition: types.h:36
destination
xyze_pos_t destination
Definition: motion.cpp:110
DEBUG_ECHOLNPAIR
#define DEBUG_ECHOLNPAIR(...)
Definition: debug_out.h:82
SERIAL_ECHO_START
#define SERIAL_ECHO_START()
Definition: serial.h:179
motion.h
feedRate_t
float feedRate_t
Definition: types.h:80
mmu2
MMU2 mmu2
_line_to_current
void _line_to_current(const AxisEnum fr_axis, const float fscale=1)
Definition: tool_change.cpp:136
IsRunning
bool IsRunning()
Definition: Marlin.h:331
DEBUG_ECHOPGM
#define DEBUG_ECHOPGM(...)
Definition: debug_out.h:78
NOMORE
#define NOMORE(v, n)
Definition: macros.h:133
MOVE_SERVO
#define MOVE_SERVO(I, P)
Definition: servo.h:93
disable_all_solenoids
void disable_all_solenoids()
Definition: solenoid.cpp:79
SOL1_PIN
#define SOL1_PIN
Definition: pins_LEAPFROG.h:89
SERIAL_ECHO_MSG
#define SERIAL_ECHO_MSG(S)
Definition: serial.h:183
tool_change
void tool_change(const uint8_t new_tool, bool no_move)
Definition: tool_change.cpp:771
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
do_blocking_move_to
void do_blocking_move_to(const float rx, const float ry, const float rz, const feedRate_t &fr_mm_s)
Definition: motion.cpp:344
sync_plan_position
void sync_plan_position()
Definition: motion.cpp:216
REMEMBER
#define REMEMBER(N, X, V...)
Definition: utility.h:76
void
void
Definition: png.h:1083
XYZEval::x
T x
Definition: types.h:383
XY_PROBE_FEEDRATE_MM_S
#define XY_PROBE_FEEDRATE_MM_S
Definition: motion.h:77
fast_line_to_current
void fast_line_to_current(const AxisEnum fr_axis)
Definition: tool_change.cpp:140
Planner::buffer_line
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_mm_s
feedRate_t feedrate_mm_s
Definition: motion.cpp:138
SERIAL_ECHOLNPAIR
#define SERIAL_ECHOLNPAIR(V...)
Definition: serial.h:144
XYval
Definition: types.h:99
XYZEval::set
FI void set(const T px)
Definition: types.h:391
DEBUG_POS
#define DEBUG_POS(...)
Definition: debug_out.h:87
uint8_t
const uint8_t[]
Definition: 404_html.c:3
axis_unhomed_error
bool axis_unhomed_error(uint8_t axis_bits)
Definition: motion.cpp:1054
ui
MarlinUI ui
update_software_endstops
void update_software_endstops(const AxisEnum axis)
Definition: motion.cpp:503
_BV
#define _BV(bit)
Definition: wiring_constants.h:99
E_STEPPERS
#define E_STEPPERS
Definition: Conditionals_LCD.h:429
XYZval::y
T y
Definition: types.h:286
servo.h
select_multiplexed_stepper
void select_multiplexed_stepper(const uint8_t e)
Y_AXIS
Definition: types.h:38
HAS_HOTEND_OFFSET
#define HAS_HOTEND_OFFSET
Definition: Conditionals_LCD.h:441
Mixer::T
static FORCE_INLINE void T(const uint_fast8_t c)
Definition: mixing.h:113
hotend_offset
constexpr xyz_pos_t hotend_offset[1]
Definition: motion.h:136
Planner::set_e_position_mm
static void set_e_position_mm(const float &e)
Definition: planner.cpp:2764
Z_AXIS
Definition: types.h:39
EXTRUDERS
#define EXTRUDERS
Definition: Configuration_A3ides_2209_MINI.h:148
apply_motion_limits
void apply_motion_limits(xyz_pos_t &target)
Definition: motion.cpp:589
DEBUGGING
#define DEBUGGING(F)
Definition: serial.h:47
MSG_ERR_HOTEND_TOO_COLD
#define MSG_ERR_HOTEND_TOO_COLD
Definition: language.h:244
HIGH
#define HIGH
Definition: wiring_constants.h:71
DEBUG_ECHOPAIR
#define DEBUG_ECHOPAIR(...)
Definition: debug_out.h:80
MMM_TO_MMS
#define MMM_TO_MMS(MM_M)
Definition: types.h:83
tool_change
void tool_change(const uint8_t tmp_extruder, bool no_move=false)
Definition: tool_change.cpp:771
safe_delay
void safe_delay(millis_t ms)
Definition: utility.cpp:28
XYZval< float >
Planner::settings
static planner_settings_t settings
Definition: planner.h:251
SERIAL_ECHOLNPGM
#define SERIAL_ECHOLNPGM(S)
Definition: serial.h:174
MSG_ACTIVE_EXTRUDER
#define MSG_ACTIVE_EXTRUDER
Definition: language.h:183
soft_endstop
axis_limits_t soft_endstop
Definition: motion.cpp:489
probe.h
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
UNUSED
#define UNUSED(X)
Definition: stm32f4xx_hal_def.h:74
MSG_INVALID_EXTRUDER
#define MSG_INVALID_EXTRUDER
Definition: language.h:167
TEMPORARY_BED_LEVELING_STATE
#define TEMPORARY_BED_LEVELING_STATE(enable)
Definition: bedlevel.h:54
active_extruder
constexpr uint8_t active_extruder
Definition: motion.h:107
tool_change.h
MMU2::tool_change
static void tool_change(uint8_t index)
ENABLED
#define ENABLED(V...)
Definition: macros.h:177
planner
Planner planner
Definition: planner.cpp:111
all_axes_homed
FORCE_INLINE bool all_axes_homed()
Definition: motion.h:44
XYZEval::y
T y
Definition: types.h:383
fanmux_switch
void fanmux_switch(const uint8_t e)