1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

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" #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() { void GcodeSuite::G27() {
// Don't allow nozzle parking without homing first // 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; constexpr feedRate_t fr_z = NOZZLE_PARK_Z_FEEDRATE;
switch (z_action) { 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); do_blocking_move_to_z(park.z, fr_z);
break; 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); do_blocking_move_to_z(_MIN(current_position.z + park.z, Z_MAX_POS), fr_z);
break; 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); do_blocking_move_to_z(park_mode_0_height(park.z), fr_z);
break; break;
} }
#endif // HAS_Z_AXIS #endif // HAS_Z_AXIS
#ifndef NOZZLE_PARK_MOVE {
#define NOZZLE_PARK_MOVE 0 #ifndef NOZZLE_PARK_MOVE
#endif #define NOZZLE_PARK_MOVE 0
constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE; #endif
switch (NOZZLE_PARK_MOVE) { constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE;
case 0: do_blocking_move_to_xy(park, fr_xy); break; switch (NOZZLE_PARK_MOVE) {
case 1: do_blocking_move_to_x(park.x, fr_xy); break; case 0: do_blocking_move_to_xy(park, fr_xy); break;
case 2: do_blocking_move_to_y(park.y, fr_xy); break; case 1: do_blocking_move_to_x(park.x, fr_xy); break;
case 3: do_blocking_move_to_x(park.x, fr_xy); case 2: do_blocking_move_to_y(park.y, fr_xy); break;
do_blocking_move_to_y(park.y, fr_xy); break; case 3: do_blocking_move_to_x(park.x, fr_xy);
case 4: do_blocking_move_to_y(park.y, fr_xy); do_blocking_move_to_y(park.y, fr_xy); break;
do_blocking_move_to_x(park.x, 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(); report_current_position();
} }