Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 2 more commands to G27 - P3/P4 park #26401

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Marlin/src/gcode/feature/pause/G27.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
#include "../../../module/motion.h"

/**
* G27: Park the nozzle
* G27: Park the nozzle according with the given style
*
* P<style> - Parking style:
* 0 = (Default) Relative raise by NOZZLE_PARK_Z_RAISE_MIN (>= NOZZLE_PARK_POINT.z) before XY parking.
* 1 = Absolute move to NOZZLE_PARK_POINT.z before XY parking. (USE WITH CAUTION!)
* 2 = Relative raise by NOZZLE_PARK_POINT.z before XY parking.
* 3 = Relative raise by NOZZLE_PARK_Z_RAISE_MIN, skip XY parking.
* 4 = No Z raise. Just XY parking.
*/
void GcodeSuite::G27() {
// Don't allow nozzle parking without homing first
Expand Down
41 changes: 26 additions & 15 deletions Marlin/src/libs/nozzle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,34 +266,45 @@ Nozzle nozzle;
constexpr feedRate_t fr_z = NOZZLE_PARK_Z_FEEDRATE;

switch (z_action) {
case 1: // Go to Z-park height
case 1: // Go to Z-park height
do_blocking_move_to_z(park.z, fr_z);
break;

case 2: // Raise by Z-park height
case 2: // Raise by Z-park height
do_blocking_move_to_z(_MIN(current_position.z + park.z, Z_MAX_POS), fr_z);
break;

default: // Raise by NOZZLE_PARK_Z_RAISE_MIN, use park.z as a minimum height
case 3: { // Raise by NOZZLE_PARK_Z_RAISE_MIN, bypass XY-park position
do_blocking_move_to_z(park_mode_0_height(0), fr_z);
goto SKIP_XY_MOVE;
} break;

case 4: // Skip Z raise, go to XY position
break;

default: // Raise by NOZZLE_PARK_Z_RAISE_MIN, use park.z as a minimum height
do_blocking_move_to_z(park_mode_0_height(park.z), fr_z);
break;
}
#endif // HAS_Z_AXIS

#ifndef NOZZLE_PARK_MOVE
#define NOZZLE_PARK_MOVE 0
#endif
constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE;
switch (NOZZLE_PARK_MOVE) {
case 0: do_blocking_move_to_xy(park, fr_xy); break;
case 1: do_blocking_move_to_x(park.x, fr_xy); break;
case 2: do_blocking_move_to_y(park.y, fr_xy); break;
case 3: do_blocking_move_to_x(park.x, fr_xy);
do_blocking_move_to_y(park.y, fr_xy); break;
case 4: do_blocking_move_to_y(park.y, fr_xy);
do_blocking_move_to_x(park.x, fr_xy); break;
{
#ifndef NOZZLE_PARK_MOVE
#define NOZZLE_PARK_MOVE 0
#endif
constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE;
switch (NOZZLE_PARK_MOVE) {
case 0: do_blocking_move_to_xy(park, fr_xy); break;
case 1: do_blocking_move_to_x(park.x, fr_xy); break;
case 2: do_blocking_move_to_y(park.y, fr_xy); break;
case 3: do_blocking_move_to_x(park.x, fr_xy);
do_blocking_move_to_y(park.y, fr_xy); break;
case 4: do_blocking_move_to_y(park.y, fr_xy);
do_blocking_move_to_x(park.x, fr_xy); break;
}
}

SKIP_XY_MOVE:
report_current_position();
}

Expand Down
Loading