mirror of
https://github.com/grblHAL/core.git
synced 2026-09-22 11:29:17 +08:00
Fix Z home movement when XY already at TLS position
When X and Y coordinates are already at the tool length sensor (TLS) position during tool change restore, Z was incorrectly not moving to the home position after probing. The issue was in the restore() function where Z movement was only executed inside a conditional block that checked if XY needed to move. This caused Z to remain at the probed position when starting from the TLS XY location. Fixed by decoupling Z home movement from XY position comparison, ensuring Z always returns to home after probing (unless $346 disables full position restore).
This commit is contained in:
+8
-6
@@ -139,18 +139,20 @@ static void reset (void)
|
||||
// Restore coolant and spindle status, return controlled point to original position.
|
||||
static bool restore (void)
|
||||
{
|
||||
bool ok;
|
||||
bool ok = true;
|
||||
plan_line_data_t plan_data;
|
||||
|
||||
plan_data_init(&plan_data);
|
||||
plan_data.condition.rapid_motion = On;
|
||||
|
||||
if(!(ok = (target.values[plane.axis_0] == previous.values[plane.axis_0] &&
|
||||
target.values[plane.axis_1] == previous.values[plane.axis_1]))) {
|
||||
// Always move Z to home position first (unless full restore is disabled)
|
||||
target.values[plane.axis_linear] = sys.home_position[plane.axis_linear];
|
||||
ok = mc_line(target.values, &plan_data);
|
||||
|
||||
target.values[plane.axis_linear] = sys.home_position[plane.axis_linear];
|
||||
|
||||
if((ok = mc_line(target.values, &plan_data)) && !settings.flags.no_restore_position_after_M6) {
|
||||
// Then move XY to previous position if needed and full restore is enabled
|
||||
if(ok && !settings.flags.no_restore_position_after_M6) {
|
||||
if(target.values[plane.axis_0] != previous.values[plane.axis_0] ||
|
||||
target.values[plane.axis_1] != previous.values[plane.axis_1]) {
|
||||
memcpy(&target, &previous, sizeof(coord_data_t));
|
||||
target.values[plane.axis_linear] = sys.home_position[plane.axis_linear];
|
||||
ok = mc_line(target.values, &plan_data);
|
||||
|
||||
Reference in New Issue
Block a user