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

do_probe_raise() again #4282

Closed
AnHardt opened this issue Jul 12, 2016 · 2 comments
Closed

do_probe_raise() again #4282

AnHardt opened this issue Jul 12, 2016 · 2 comments
Labels
F: Calibration T: Design Concept Technical ideas about ways and methods.

Comments

@AnHardt
Copy link
Contributor

AnHardt commented Jul 12, 2016

Currently we have:

  /**
   * Raise Z to a minimum height to make room for a probe to move
   *
   * zprobe_zoffset: Negative of the Z height where the probe engages
   *        z_raise: The probing raise distance
   *
   * The zprobe_zoffset is negative for a switch below the nozzle, so
   * multiply by Z_HOME_DIR (-1) to move enough away from the bed.
   */
  inline void do_probe_raise(float z_raise) {
    #if ENABLED(DEBUG_LEVELING_FEATURE)
      if (DEBUGGING(LEVELING)) {
        SERIAL_ECHOPAIR("do_probe_raise(", z_raise);
        SERIAL_ECHOLNPGM(")");
      }
    #endif
    float z_dest = home_offset[Z_AXIS] + z_raise;

    if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
      z_dest -= zprobe_zoffset;

    if (z_dest > current_position[Z_AXIS])
      do_blocking_move_to_z(z_dest);
  }

To better see what is going on:

  /**
   * Raise Z to a minimum height to make room for a probe to move
   *
   * zprobe_zoffset: Negative of the Z height where the probe engages
   *        z_raise: The probing raise distance
   *
   * The zprobe_zoffset is negative for a switch below the nozzle.
   */
  inline void do_probe_raise(float z_raise) {
    float z_dest = home_offset[Z_AXIS];         // This is bed level
/*
    if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0) // if nozzle is above the probes trigger point
      z_dest -= zprobe_zoffset;                 // raise by the distance between nozzle ant trigger point.
                                                // That's wrong. The distance must be larger. There is a additional 
                                                // way the probe needs from touching the bed to the trigger point.

                                                // While we are at it.
    if ((Z_HOME_DIR) < 0 && zprobe_zoffset > 0) // if nozzle is pressing on the bed when triggered
      z_dest += zprobe_zoffset;                 // raise by the distance between nozzle ant trigger point
                                                // to be at least at bed level.

*/                                              // Together this is
    if (Z_HOME_DIR) < 0)
      z_dest += abs(zprobe_zoffset);            // raise by the distance between nozzle ant trigger point

    z_dest += z_raise;                          // Now raise by the amount of the highest obstacle.

    #if ENABLED(DEBUG_LEVELING_FEATURE)
      if (DEBUGGING(LEVELING)) {
        SERIAL_ECHOPAIR("do_probe_raise(", z_raise);
        SERIAL_ECHOLNPGM(")");
      }
    #endif

    if (z_dest > current_position[Z_AXIS])
      do_blocking_move_to_z(z_dest);
  }

Lets take a break and look at the different predefined heights.

//#define MIN_Z_HEIGHT_FOR_HOMING 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
                                    // Be sure you have this distance over your Z_MAX_POS in case.

Used for x/y-moves when the probe is not deployed/extended. (obstacle-height + safety margin)

#define Z_RAISE_BETWEEN_PROBINGS 5  // Raise between probing points.

Used for x/y-moves when the probe is deployed/extended. (obstacle-height + safety margin + (distance between nozzle and deepest point of the probe when hanging (not triggered)))

#define Z_RAISE_PROBE_DEPLOY_STOW 15 // Raise to make room for the probe to deploy / stow

User while the probe is deployed/stowed. (obstacle-height + safety margin + (distance between nozzle and deepest point of the probe while (the servo is) deployed/stowed))

If this are our definitions, zprobe_zoffset is irrelevant.
When zprobe_zoffset is positive, it is in sub mm magnitude. Probably smaller than what i'd take as safety margin.
When zprobe_zoffset is negative, it is the wrong, too small, value and irrelevant for MIN_Z_HEIGHT_FOR_HOMING.

  /**
   * Raise Z to a minimum height to make room for a probe to move
   *
   *        z_raise: The minimal target height.
   *
   */
  inline void do_probe_raise(float z_raise) {
    float z_dest = home_offset[Z_AXIS] + z_dest += z_raise;

    #if ENABLED(DEBUG_LEVELING_FEATURE)
      if (DEBUGGING(LEVELING)) {
        SERIAL_ECHOPAIR("do_probe_raise(", z_raise);
        SERIAL_ECHOLNPGM(")");
      }
    #endif

    do_blocking_move_to_z( max(z_dest, current_position[Z_AXIS]) );
  }
@thinkyhead
Copy link
Member

thinkyhead commented Jul 13, 2016

The reason I chose to include the zprobe_zoffset is specifically to make the raise apply to the distance between the deployed (and triggered) probe and the bed, rather than between the nozzle and the bed. This is the most safe baseline, so even a small raise like 1mm is good enough (maybe not for inductive probe, but you get the idea).

The extra spacing below the nozzle is only applied when the probe extends below the nozzle (i.e., zprobe_zoffset is negative). (Of course we don't want to lower the nozzle for a positive zprobe_zoffset even when the user has overridden it – whether on purpose, or by mistake).

The one thing that does jump out as being irrelevant in do_probe_raise is the direction of homing (Z_HOME_DIR), because probing is always down, towards the bed, of course. If you happen to home to a max Z (as on a Delta) this raise should apply the same way.

@github-actions
Copy link

github-actions bot commented Apr 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F: Calibration T: Design Concept Technical ideas about ways and methods.
Projects
None yet
Development

No branches or pull requests

2 participants