G27 P3 / P4 (#26401)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Andrew 2023-11-09 17:34:48 -05:00 committed by GitHub
parent bf5612c0ed
commit b2758208c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 16 deletions

View file

@ -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

View file

@ -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();
}