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

🚸 Fix extra Z raises #27395

Merged

Conversation

thinkyhead
Copy link
Member

Before homing we don't know where Z is, but on most machines we know it's above 0. And once Z has been raised we can be pretty certain it's at or above current_position.z.

This PR adds a flag to indicate that Z has been powered on and its Z position should be trusted to be at or above current_position.z. If "Z" is disabled on a machine that has a falling toolhead then the flag is cleared when the Z stepper is powered off.

@thinkyhead thinkyhead merged commit 2c6f8a3 into MarlinFirmware:bugfix-2.1.x Sep 5, 2024
63 checks passed
@thinkyhead thinkyhead deleted the bf2_trust_minimal_z_PR branch September 5, 2024 17:07
@thijstriemstra
Copy link

thijstriemstra commented Oct 18, 2024

after this change (I think although my last marlin compile was few weeks ago) I had to define Z_AFTER_HOMING to 0 or otherwise the MPCNC would move to z of 5 after homing.

In Configuration.h the default comment is:

//#define Z_AFTER_HOMING         10   // (mm) Height to move to after homing (if Z was homed)

not sure why my machine moved to 5 and not 10 which seems to be the default value?

@thisiskeithb
Copy link
Member

not sure why my machine moved to 5 and not 10 which seems to be the default value?

@thijstriemstra: The reason your Z height after homing was 5 instead of 10 is due to how Marlin handles Z clearance settings:

  1. Z_AFTER_HOMING is not defined by default:

    //#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing (if Z was homed)

  2. When Z_AFTER_HOMING is not defined, Marlin falls back to Z_CLEARANCE_FOR_HOMING:

    #ifdef Z_AFTER_HOMING
    #define Z_POST_CLEARANCE Z_AFTER_HOMING
    #else
    #define Z_POST_CLEARANCE Z_CLEARANCE_FOR_HOMING
    #endif

  3. Z_CLEARANCE_FOR_HOMING is also not defined by default:

    //#define Z_CLEARANCE_FOR_HOMING 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...

  4. ...so Z_CLEARANCE_FOR_HOMING is defined as Z_CLEARANCE_BETWEEN_PROBES:

    #ifdef Z_CLEARANCE_BETWEEN_PROBES
    #define Z_CLEARANCE_FOR_HOMING Z_CLEARANCE_BETWEEN_PROBES
    #else
    #define Z_CLEARANCE_FOR_HOMING 5
    #endif

  5. Z_CLEARANCE_BETWEEN_PROBES is defined as 5 by default:

    #define Z_CLEARANCE_BETWEEN_PROBES 5 // (mm) Z Clearance between probe points

Enable & set your Z_AFTER_HOMING value (like you did), otherwise the "safe" default of 5 is used.

The conditionals are a bit spread out, but hopefully that clears things up.

@thijstriemstra
Copy link

thijstriemstra commented Oct 20, 2024

thanks for your excellent explanation @thisiskeithb. I previously had this defined:

# Z clearance between probe points (mm).
# Set to 0 since we're only using a single probe point,
# and consider the homed Z position to be Z0.
# Without this change, Marlin will use a default clearance
# of 5, and move the Z up by 5 after homing is done, which
# we don't want for this machine.
opt_set Z_CLEARANCE_BETWEEN_PROBES "0"

Which "stopped working" and the Z_AFTER_HOMING setting makes more sense when I look at the machine's behaviour, so looks like a bug was definitely fixed (here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants