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

Unify run_z_probe #57

Closed
wants to merge 1 commit into from
Closed

Unify run_z_probe #57

wants to merge 1 commit into from

Conversation

AnHardt
Copy link
Owner

@AnHardt AnHardt commented Jul 13, 2016

Unify run_z_probe
Add double touch for DELTAs.

@AnHardt
Copy link
Owner Author

AnHardt commented Jul 13, 2016

@thinkyhead
Here i have one to make you pseudonym honer.

Tested as working for my Prusa i3.
Untested for Deltas. But i'm quite sure my mathematics are correct.

For the reasons why see:
Unifying run_z_probe.txt

@AnHardt AnHardt force-pushed the delta-double-touch branch from ed8e42b to 71541c8 Compare July 13, 2016 01:08
if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);
#endif
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
planner.bed_level_matrix.set_to_identity();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, odd this wasn't already being done for delta. Should this also contain "#if (DELTA) reset_bed_level()"?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This should be done in the callers (G29, G30, M48). Will check.

A unified 'switch_of_leveling()' would be nice. Only one place to decide what kind of leveling to switch of - and compensate.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aiii. That opens a can of worms

run_z_probe() {

    #if ENABLED(AUTO_BED_LEVELING_FEATURE)
      planner.bed_level_matrix.set_to_identity();
    #endif

-----------------------------
gcode_G28() {

  // For auto bed leveling, clear the level matrix
  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
    planner.bed_level_matrix.set_to_identity();
    #if ENABLED(DELTA)
      reset_bed_level();
    #endif
  #endif

  /**
   * For mesh bed leveling deactivate the mesh calculations, will be turned
   * on again when homing all axis
   */
  #if ENABLED(MESH_BED_LEVELING)
    float pre_home_z = MESH_HOME_SEARCH_Z;
    if (mbl.active()) {
      // Save known Z position if already homed
      if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
        pre_home_z = current_position[Z_AXIS];
        pre_home_z += mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS));
      }
      mbl.set_active(false);
      current_position[Z_AXIS] = pre_home_z;
    }
  #endif

  --------------------------------------
  G29 (mesh)

        case MeshReset:
        if (mbl.active()) {
          current_position[Z_AXIS] +=
            mbl.get_z(RAW_CURRENT_POSITION(X_AXIS), RAW_CURRENT_POSITION(Y_AXIS)) - MESH_HOME_SEARCH_Z;
          mbl.reset();
          SYNC_PLAN_POSITION_KINEMATIC();
        }
        else
          mbl.reset();

  -------------------------------------
  G29 (grid)

      // make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
      planner.bed_level_matrix.set_to_identity();

      #if ENABLED(DELTA)
        reset_bed_level();
      #else //!DELTA

-------------------------------------------
gcode_G30() {

    // TODO: clear the leveling matrix or the planner will be set incorrectly

--------------------------------------------
M48

    #if ENABLED(DELTA)
      // we don't do bed level correction in M48 because we want the raw data when we probe
      reset_bed_level();
    #elif ENABLED(AUTO_BED_LEVELING_FEATURE)
      // we don't do bed level correction in M48 because we want the raw data when we probe
      planner.bed_level_matrix.set_to_identity();
    #endif
---------------------------

  • Not two of these do the same.
  • If the matrix is involved it theoretically needs a correction in x, y and z when the matrix is set to identity.
  • In DELTA leveling it needs a correction in z when switching off.
  • Dito for MESH.
    *

Enough stuff to think about.

@thinkyhead
Copy link

thinkyhead commented Jul 13, 2016

This is great. Amazing how much the leveling code is condensing.

❓ But will it fix our friend's probing-in-only-one-quadrant problem❓ That would be a bonus.

@AnHardt
Copy link
Owner Author

AnHardt commented Jul 18, 2016

But will it fix our friend's probing-in-only-one-quadrant problem

That's hopefully fixed by MarlinFirmware#4303.

@AnHardt AnHardt force-pushed the delta-double-touch branch 3 times, most recently from 8d0255c to 2d8eeb2 Compare July 19, 2016 23:48
Unify run_z_probe
Add double touch for DELTAs.
Introduce Z_PROBE_SPEED_FAST and Z_PROBE_SPEED_SLOW
  defaulting to homing_feedrate_mm_m[Z_AXIS] and homing_feedrate_mm_m[Z_AXIS]/2
@AnHardt AnHardt closed this Jul 20, 2016
@AnHardt AnHardt deleted the delta-double-touch branch July 20, 2016 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants