zprobe_offset => probe_offset
This commit is contained in:
		@@ -79,36 +79,36 @@ void safe_delay(millis_t ms) {
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
      SERIAL_ECHOPAIR("Probe Offset X:", zprobe_offset[X_AXIS], " Y:", zprobe_offset[Y_AXIS], " Z:", zprobe_offset[Z_AXIS]);
 | 
			
		||||
      if (zprobe_offset[X_AXIS] > 0)
 | 
			
		||||
      SERIAL_ECHOPAIR("Probe Offset X:", probe_offset[X_AXIS], " Y:", probe_offset[Y_AXIS], " Z:", probe_offset[Z_AXIS]);
 | 
			
		||||
      if (probe_offset[X_AXIS] > 0)
 | 
			
		||||
        SERIAL_ECHOPGM(" (Right");
 | 
			
		||||
      else if (zprobe_offset[X_AXIS] < 0)
 | 
			
		||||
      else if (probe_offset[X_AXIS] < 0)
 | 
			
		||||
        SERIAL_ECHOPGM(" (Left");
 | 
			
		||||
      else if (zprobe_offset[Y_AXIS] != 0)
 | 
			
		||||
      else if (probe_offset[Y_AXIS] != 0)
 | 
			
		||||
        SERIAL_ECHOPGM(" (Middle");
 | 
			
		||||
      else
 | 
			
		||||
        SERIAL_ECHOPGM(" (Aligned With");
 | 
			
		||||
 | 
			
		||||
      if (zprobe_offset[Y_AXIS] > 0) {
 | 
			
		||||
      if (probe_offset[Y_AXIS] > 0) {
 | 
			
		||||
        #if IS_SCARA
 | 
			
		||||
          SERIAL_ECHOPGM("-Distal");
 | 
			
		||||
        #else
 | 
			
		||||
          SERIAL_ECHOPGM("-Back");
 | 
			
		||||
        #endif
 | 
			
		||||
      }
 | 
			
		||||
      else if (zprobe_offset[Y_AXIS] < 0) {
 | 
			
		||||
      else if (probe_offset[Y_AXIS] < 0) {
 | 
			
		||||
        #if IS_SCARA
 | 
			
		||||
          SERIAL_ECHOPGM("-Proximal");
 | 
			
		||||
        #else
 | 
			
		||||
          SERIAL_ECHOPGM("-Front");
 | 
			
		||||
        #endif
 | 
			
		||||
      }
 | 
			
		||||
      else if (zprobe_offset[X_AXIS] != 0)
 | 
			
		||||
      else if (probe_offset[X_AXIS] != 0)
 | 
			
		||||
        SERIAL_ECHOPGM("-Center");
 | 
			
		||||
 | 
			
		||||
      if (zprobe_offset[Z_AXIS] < 0)
 | 
			
		||||
      if (probe_offset[Z_AXIS] < 0)
 | 
			
		||||
        SERIAL_ECHOPGM(" & Below");
 | 
			
		||||
      else if (zprobe_offset[Z_AXIS] > 0)
 | 
			
		||||
      else if (probe_offset[Z_AXIS] > 0)
 | 
			
		||||
        SERIAL_ECHOPGM(" & Above");
 | 
			
		||||
      else
 | 
			
		||||
        SERIAL_ECHOPGM(" & Same Z as");
 | 
			
		||||
 
 | 
			
		||||
@@ -180,8 +180,8 @@
 | 
			
		||||
    // Add XY probe offset from extruder because probe_pt() subtracts them when
 | 
			
		||||
    // moving to the xy position to be measured. This ensures better agreement between
 | 
			
		||||
    // the current Z position after G28 and the mesh values.
 | 
			
		||||
    const float current_xi = find_closest_x_index(current_position[X_AXIS] + zprobe_offset[X_AXIS]),
 | 
			
		||||
                current_yi = find_closest_y_index(current_position[Y_AXIS] + zprobe_offset[Y_AXIS]);
 | 
			
		||||
    const float current_xi = find_closest_x_index(current_position[X_AXIS] + probe_offset[X_AXIS]),
 | 
			
		||||
                current_yi = find_closest_y_index(current_position[Y_AXIS] + probe_offset[Y_AXIS]);
 | 
			
		||||
 | 
			
		||||
    if (!lcd) SERIAL_EOL();
 | 
			
		||||
    for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) {
 | 
			
		||||
 
 | 
			
		||||
@@ -453,7 +453,7 @@
 | 
			
		||||
              SERIAL_ECHO(g29_y_pos);
 | 
			
		||||
              SERIAL_ECHOLNPGM(").\n");
 | 
			
		||||
            }
 | 
			
		||||
            probe_entire_mesh(g29_x_pos + zprobe_offset[X_AXIS], g29_y_pos + zprobe_offset[Y_AXIS],
 | 
			
		||||
            probe_entire_mesh(g29_x_pos + probe_offset[X_AXIS], g29_y_pos + probe_offset[Y_AXIS],
 | 
			
		||||
                              parser.seen('T'), parser.seen('E'), parser.seen('U'));
 | 
			
		||||
 | 
			
		||||
            report_current_position();
 | 
			
		||||
@@ -482,8 +482,8 @@
 | 
			
		||||
                g29_x_pos = X_HOME_POS;
 | 
			
		||||
                g29_y_pos = Y_HOME_POS;
 | 
			
		||||
              #else // cartesian
 | 
			
		||||
                g29_x_pos = zprobe_offset[X_AXIS] > 0 ? X_BED_SIZE : 0;
 | 
			
		||||
                g29_y_pos = zprobe_offset[Y_AXIS] < 0 ? Y_BED_SIZE : 0;
 | 
			
		||||
                g29_x_pos = probe_offset[X_AXIS] > 0 ? X_BED_SIZE : 0;
 | 
			
		||||
                g29_y_pos = probe_offset[Y_AXIS] < 0 ? Y_BED_SIZE : 0;
 | 
			
		||||
              #endif
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -800,8 +800,8 @@
 | 
			
		||||
      restore_ubl_active_state_and_leave();
 | 
			
		||||
 | 
			
		||||
      do_blocking_move_to_xy(
 | 
			
		||||
        constrain(rx - zprobe_offset[X_AXIS], MESH_MIN_X, MESH_MAX_X),
 | 
			
		||||
        constrain(ry - zprobe_offset[Y_AXIS], MESH_MIN_Y, MESH_MAX_Y)
 | 
			
		||||
        constrain(rx - probe_offset[X_AXIS], MESH_MIN_X, MESH_MAX_X),
 | 
			
		||||
        constrain(ry - probe_offset[Y_AXIS], MESH_MIN_Y, MESH_MAX_Y)
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -1281,8 +1281,8 @@
 | 
			
		||||
    out_mesh.distance = -99999.9f;
 | 
			
		||||
 | 
			
		||||
    // Get our reference position. Either the nozzle or probe location.
 | 
			
		||||
    const float px = rx + (probe_as_reference == USE_PROBE_AS_REFERENCE ? zprobe_offset[X_AXIS] : 0),
 | 
			
		||||
                py = ry + (probe_as_reference == USE_PROBE_AS_REFERENCE ? zprobe_offset[Y_AXIS] : 0);
 | 
			
		||||
    const float px = rx + (probe_as_reference == USE_PROBE_AS_REFERENCE ? probe_offset[X_AXIS] : 0),
 | 
			
		||||
                py = ry + (probe_as_reference == USE_PROBE_AS_REFERENCE ? probe_offset[Y_AXIS] : 0);
 | 
			
		||||
 | 
			
		||||
    float best_so_far = 99999.99f;
 | 
			
		||||
 | 
			
		||||
@@ -1500,7 +1500,7 @@
 | 
			
		||||
                DEBUG_ECHOPAIR_F("   correction: ", get_z_correction(rx, ry), 7);
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              measured_z -= get_z_correction(rx, ry) /* + zprobe_offset[Z_AXIS] */ ;
 | 
			
		||||
              measured_z -= get_z_correction(rx, ry) /* + probe_offset[Z_AXIS] */ ;
 | 
			
		||||
 | 
			
		||||
              if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_F("   final >>>---> ", measured_z, 7);
 | 
			
		||||
 | 
			
		||||
@@ -1712,7 +1712,7 @@
 | 
			
		||||
      adjust_mesh_to_mean(g29_c_flag, g29_constant);
 | 
			
		||||
 | 
			
		||||
      #if HAS_BED_PROBE
 | 
			
		||||
        SERIAL_ECHOLNPAIR_F("Probe Offset M851 Z", zprobe_offset[Z_AXIS], 7);
 | 
			
		||||
        SERIAL_ECHOLNPAIR_F("Probe Offset M851 Z", probe_offset[Z_AXIS], 7);
 | 
			
		||||
      #endif
 | 
			
		||||
 | 
			
		||||
      SERIAL_ECHOLNPAIR("MESH_MIN_X  " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); serial_delay(50);
 | 
			
		||||
 
 | 
			
		||||
@@ -49,8 +49,8 @@ void GcodeSuite::G42() {
 | 
			
		||||
    if (hasJ) destination[Y_AXIS] = _GET_MESH_Y(iy);
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
      if (parser.boolval('P')) {
 | 
			
		||||
        if (hasI) destination[X_AXIS] -= zprobe_offset[X_AXIS];
 | 
			
		||||
        if (hasJ) destination[Y_AXIS] -= zprobe_offset[Y_AXIS];
 | 
			
		||||
        if (hasI) destination[X_AXIS] -= probe_offset[X_AXIS];
 | 
			
		||||
        if (hasJ) destination[Y_AXIS] -= probe_offset[Y_AXIS];
 | 
			
		||||
      }
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -947,8 +947,8 @@ G29_TYPE GcodeSuite::G29() {
 | 
			
		||||
        planner.leveling_active = false;
 | 
			
		||||
 | 
			
		||||
        // Use the last measured distance to the bed, if possible
 | 
			
		||||
        if ( NEAR(current_position[X_AXIS], xProbe - zprobe_offset[X_AXIS])
 | 
			
		||||
          && NEAR(current_position[Y_AXIS], yProbe - zprobe_offset[Y_AXIS])
 | 
			
		||||
        if ( NEAR(current_position[X_AXIS], xProbe - probe_offset[X_AXIS])
 | 
			
		||||
          && NEAR(current_position[Y_AXIS], yProbe - probe_offset[Y_AXIS])
 | 
			
		||||
        ) {
 | 
			
		||||
          const float simple_z = current_position[Z_AXIS] - measured_z;
 | 
			
		||||
          if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Probed Z", simple_z, "  Matrix Z", converted[Z_AXIS], "  Discrepancy ", simple_z - converted[Z_AXIS]);
 | 
			
		||||
 
 | 
			
		||||
@@ -136,8 +136,8 @@
 | 
			
		||||
    destination[Z_AXIS] = current_position[Z_AXIS]; // Z is already at the right height
 | 
			
		||||
 | 
			
		||||
    #if HOMING_Z_WITH_PROBE
 | 
			
		||||
      destination[X_AXIS] -= zprobe_offset[X_AXIS];
 | 
			
		||||
      destination[Y_AXIS] -= zprobe_offset[Y_AXIS];
 | 
			
		||||
      destination[X_AXIS] -= probe_offset[X_AXIS];
 | 
			
		||||
      destination[Y_AXIS] -= probe_offset[Y_AXIS];
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    if (position_is_reachable(destination[X_AXIS], destination[Y_AXIS])) {
 | 
			
		||||
 
 | 
			
		||||
@@ -77,8 +77,8 @@ void GcodeSuite::M48() {
 | 
			
		||||
  float X_current = current_position[X_AXIS],
 | 
			
		||||
        Y_current = current_position[Y_AXIS];
 | 
			
		||||
 | 
			
		||||
  const float X_probe_location = parser.linearval('X', X_current + zprobe_offset[X_AXIS]),
 | 
			
		||||
              Y_probe_location = parser.linearval('Y', Y_current + zprobe_offset[Y_AXIS]);
 | 
			
		||||
  const float X_probe_location = parser.linearval('X', X_current + probe_offset[X_AXIS]),
 | 
			
		||||
              Y_probe_location = parser.linearval('Y', Y_current + probe_offset[Y_AXIS]);
 | 
			
		||||
 | 
			
		||||
  if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) {
 | 
			
		||||
    SERIAL_ECHOLNPGM("? (X,Y) out of bounds.");
 | 
			
		||||
@@ -165,8 +165,8 @@ void GcodeSuite::M48() {
 | 
			
		||||
          while (angle < 0.0) angle += 360.0;   // outside of this range.   It looks like they behave correctly with
 | 
			
		||||
                                                // numbers outside of the range, but just to be safe we clamp them.
 | 
			
		||||
 | 
			
		||||
          X_current = X_probe_location - zprobe_offset[X_AXIS] + cos(RADIANS(angle)) * radius;
 | 
			
		||||
          Y_current = Y_probe_location - zprobe_offset[Y_AXIS] + sin(RADIANS(angle)) * radius;
 | 
			
		||||
          X_current = X_probe_location - probe_offset[X_AXIS] + cos(RADIANS(angle)) * radius;
 | 
			
		||||
          Y_current = Y_probe_location - probe_offset[Y_AXIS] + sin(RADIANS(angle)) * radius;
 | 
			
		||||
 | 
			
		||||
          #if DISABLED(DELTA)
 | 
			
		||||
            LIMIT(X_current, X_MIN_POS, X_MAX_POS);
 | 
			
		||||
 
 | 
			
		||||
@@ -42,9 +42,9 @@
 | 
			
		||||
        && active_extruder == 0
 | 
			
		||||
      #endif
 | 
			
		||||
    ) {
 | 
			
		||||
      zprobe_offset[Z_AXIS] += offs;
 | 
			
		||||
      probe_offset[Z_AXIS] += offs;
 | 
			
		||||
      SERIAL_ECHO_START();
 | 
			
		||||
      SERIAL_ECHOLNPAIR(MSG_PROBE_OFFSET MSG_Z ": ", zprobe_offset[Z_AXIS]);
 | 
			
		||||
      SERIAL_ECHOLNPAIR(MSG_PROBE_OFFSET MSG_Z ": ", probe_offset[Z_AXIS]);
 | 
			
		||||
    }
 | 
			
		||||
    #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
 | 
			
		||||
      else {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,8 @@
 | 
			
		||||
 *   E   Engage the probe for each probe (default 1)
 | 
			
		||||
 */
 | 
			
		||||
void GcodeSuite::G30() {
 | 
			
		||||
  const float xpos = parser.linearval('X', current_position[X_AXIS] + zprobe_offset[X_AXIS]),
 | 
			
		||||
              ypos = parser.linearval('Y', current_position[Y_AXIS] + zprobe_offset[Y_AXIS]);
 | 
			
		||||
  const float xpos = parser.linearval('X', current_position[X_AXIS] + probe_offset[X_AXIS]),
 | 
			
		||||
              ypos = parser.linearval('Y', current_position[Y_AXIS] + probe_offset[Y_AXIS]);
 | 
			
		||||
 | 
			
		||||
  if (!position_is_reachable_by_probe(xpos, ypos)) return;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,17 +36,17 @@ void GcodeSuite::M851() {
 | 
			
		||||
  // Show usage with no parameters
 | 
			
		||||
  if (!parser.seen("XYZ")) {
 | 
			
		||||
    SERIAL_ECHO_START();
 | 
			
		||||
    SERIAL_ECHOLNPAIR(MSG_PROBE_OFFSET " X", zprobe_offset[X_AXIS],
 | 
			
		||||
                                       " Y", zprobe_offset[Y_AXIS],
 | 
			
		||||
                                       " Z", zprobe_offset[Z_AXIS]);
 | 
			
		||||
    SERIAL_ECHOLNPAIR(MSG_PROBE_OFFSET " X", probe_offset[X_AXIS],
 | 
			
		||||
                                       " Y", probe_offset[Y_AXIS],
 | 
			
		||||
                                       " Z", probe_offset[Z_AXIS]);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Get the modified offsets
 | 
			
		||||
  const float offs[] = {
 | 
			
		||||
    parser.floatval('X', zprobe_offset[X_AXIS]),
 | 
			
		||||
    parser.floatval('Y', zprobe_offset[Y_AXIS]),
 | 
			
		||||
    parser.floatval('Z', zprobe_offset[Z_AXIS])
 | 
			
		||||
    parser.floatval('X', probe_offset[X_AXIS]),
 | 
			
		||||
    parser.floatval('Y', probe_offset[Y_AXIS]),
 | 
			
		||||
    parser.floatval('Z', probe_offset[Z_AXIS])
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  // Error-check
 | 
			
		||||
@@ -64,7 +64,7 @@ void GcodeSuite::M851() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Save the new offsets
 | 
			
		||||
  LOOP_XYZ(a) zprobe_offset[a] = offs[a];
 | 
			
		||||
  LOOP_XYZ(a) probe_offset[a] = offs[a];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // HAS_BED_PROBE
 | 
			
		||||
 
 | 
			
		||||
@@ -708,7 +708,7 @@ namespace ExtUI {
 | 
			
		||||
          #if EXTRUDERS > 1
 | 
			
		||||
            && (linked_nozzles || active_extruder == 0)
 | 
			
		||||
          #endif
 | 
			
		||||
        ) zprobe_offset[Z_AXIS] += mm;
 | 
			
		||||
        ) probe_offset[Z_AXIS] += mm;
 | 
			
		||||
      #else
 | 
			
		||||
        UNUSED(mm);
 | 
			
		||||
      #endif
 | 
			
		||||
@@ -746,7 +746,7 @@ namespace ExtUI {
 | 
			
		||||
 | 
			
		||||
  float getZOffset_mm() {
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
      return zprobe_offset[Z_AXIS];
 | 
			
		||||
      return probe_offset[Z_AXIS];
 | 
			
		||||
    #elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
 | 
			
		||||
      return babystep.axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
 | 
			
		||||
    #else
 | 
			
		||||
@@ -757,7 +757,7 @@ namespace ExtUI {
 | 
			
		||||
  void setZOffset_mm(const float value) {
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
      if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
 | 
			
		||||
        zprobe_offset[Z_AXIS] = value;
 | 
			
		||||
        probe_offset[Z_AXIS] = value;
 | 
			
		||||
    #elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
 | 
			
		||||
      babystep.add_mm(Z_AXIS, (value - babystep.axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]));
 | 
			
		||||
    #else
 | 
			
		||||
 
 | 
			
		||||
@@ -402,7 +402,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
 | 
			
		||||
      ui.encoderPosition = 0;
 | 
			
		||||
 | 
			
		||||
      const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
 | 
			
		||||
                  new_probe_offset = zprobe_offset[Z_AXIS] + diff,
 | 
			
		||||
                  new_probe_offset = probe_offset[Z_AXIS] + diff,
 | 
			
		||||
                  new_offs =
 | 
			
		||||
                    #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
 | 
			
		||||
                      do_probe ? new_probe_offset : hotend_offset[Z_AXIS][active_extruder] - diff
 | 
			
		||||
@@ -414,7 +414,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
 | 
			
		||||
 | 
			
		||||
        babystep.add_steps(Z_AXIS, babystep_increment);
 | 
			
		||||
 | 
			
		||||
        if (do_probe) zprobe_offset[Z_AXIS] = new_offs;
 | 
			
		||||
        if (do_probe) probe_offset[Z_AXIS] = new_offs;
 | 
			
		||||
        #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
 | 
			
		||||
          else hotend_offset[Z_AXIS][active_extruder] = new_offs;
 | 
			
		||||
        #endif
 | 
			
		||||
@@ -428,10 +428,10 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
 | 
			
		||||
          draw_edit_screen(PSTR(MSG_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder]));
 | 
			
		||||
        else
 | 
			
		||||
      #endif
 | 
			
		||||
          draw_edit_screen(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_offset[Z_AXIS]));
 | 
			
		||||
          draw_edit_screen(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(probe_offset[Z_AXIS]));
 | 
			
		||||
 | 
			
		||||
      #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY)
 | 
			
		||||
        if (do_probe) _lcd_zoffset_overlay_gfx(zprobe_offset[Z_AXIS]);
 | 
			
		||||
        if (do_probe) _lcd_zoffset_overlay_gfx(probe_offset[Z_AXIS]);
 | 
			
		||||
      #endif
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -279,7 +279,7 @@ void menu_bed_leveling() {
 | 
			
		||||
  #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
 | 
			
		||||
    MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
 | 
			
		||||
  #elif HAS_BED_PROBE
 | 
			
		||||
    MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_offset[Z_AXIS], Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
 | 
			
		||||
    MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &probe_offset[Z_AXIS], Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(LEVEL_BED_CORNERS)
 | 
			
		||||
 
 | 
			
		||||
@@ -347,7 +347,7 @@ void menu_configuration() {
 | 
			
		||||
  #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
 | 
			
		||||
    MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
 | 
			
		||||
  #elif HAS_BED_PROBE
 | 
			
		||||
    MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_offset[Z_AXIS], Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
 | 
			
		||||
    MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &probe_offset[Z_AXIS], Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  const bool busy = printer_busy();
 | 
			
		||||
 
 | 
			
		||||
@@ -176,7 +176,7 @@ typedef struct SettingsDataStruct {
 | 
			
		||||
  // HAS_BED_PROBE
 | 
			
		||||
  //
 | 
			
		||||
 | 
			
		||||
  float zprobe_offset[XYZ];
 | 
			
		||||
  float probe_offset[XYZ];
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // ABL_PLANAR
 | 
			
		||||
@@ -613,8 +613,8 @@ void MarlinSettings::postprocess() {
 | 
			
		||||
    // Probe Z Offset
 | 
			
		||||
    //
 | 
			
		||||
    {
 | 
			
		||||
      _FIELD_TEST(zprobe_offset[Z_AXIS]);
 | 
			
		||||
      EEPROM_WRITE(zprobe_offset);
 | 
			
		||||
      _FIELD_TEST(probe_offset[Z_AXIS]);
 | 
			
		||||
      EEPROM_WRITE(probe_offset);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //
 | 
			
		||||
@@ -1415,10 +1415,10 @@ void MarlinSettings::postprocess() {
 | 
			
		||||
      // Probe Z Offset
 | 
			
		||||
      //
 | 
			
		||||
      {
 | 
			
		||||
        _FIELD_TEST(zprobe_offset[Z_AXIS]);
 | 
			
		||||
        _FIELD_TEST(probe_offset[Z_AXIS]);
 | 
			
		||||
 | 
			
		||||
        #if HAS_BED_PROBE
 | 
			
		||||
          float (&zpo)[XYZ] = zprobe_offset;
 | 
			
		||||
          float (&zpo)[XYZ] = probe_offset;
 | 
			
		||||
        #else
 | 
			
		||||
          float zpo[XYZ];
 | 
			
		||||
        #endif
 | 
			
		||||
@@ -2322,7 +2322,7 @@ void MarlinSettings::reset() {
 | 
			
		||||
    #endif
 | 
			
		||||
    constexpr float dpo[XYZ] = NOZZLE_TO_PROBE_OFFSET;
 | 
			
		||||
    static_assert(COUNT(dpo) == 3, "NOZZLE_TO_PROBE_OFFSET must contain offsets for X, Y, and Z.");
 | 
			
		||||
    LOOP_XYZ(a) zprobe_offset[a] = dpo[a];
 | 
			
		||||
    LOOP_XYZ(a) probe_offset[a] = dpo[a];
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
@@ -3071,9 +3071,9 @@ void MarlinSettings::reset() {
 | 
			
		||||
        say_units(true);
 | 
			
		||||
      }
 | 
			
		||||
      CONFIG_ECHO_START();
 | 
			
		||||
      SERIAL_ECHOLNPAIR("  M851 X", LINEAR_UNIT(zprobe_offset[X_AXIS]),
 | 
			
		||||
                              " Y", LINEAR_UNIT(zprobe_offset[Y_AXIS]),
 | 
			
		||||
                              " Z", LINEAR_UNIT(zprobe_offset[Z_AXIS]));
 | 
			
		||||
      SERIAL_ECHOLNPAIR("  M851 X", LINEAR_UNIT(probe_offset[X_AXIS]),
 | 
			
		||||
                              " Y", LINEAR_UNIT(probe_offset[Y_AXIS]),
 | 
			
		||||
                              " Z", LINEAR_UNIT(probe_offset[Z_AXIS]));
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -233,7 +233,7 @@ void home_delta() {
 | 
			
		||||
  // Move all carriages together linearly until an endstop is hit.
 | 
			
		||||
  destination[Z_AXIS] = (delta_height
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
      - zprobe_offset[Z_AXIS]
 | 
			
		||||
      - probe_offset[Z_AXIS]
 | 
			
		||||
    #endif
 | 
			
		||||
    + 10);
 | 
			
		||||
  buffer_line_to_destination(homing_feedrate(X_AXIS));
 | 
			
		||||
 
 | 
			
		||||
@@ -505,7 +505,7 @@ void restore_feedrate_and_scaling() {
 | 
			
		||||
      soft_endstop[axis].min = base_min_pos(axis);
 | 
			
		||||
      soft_endstop[axis].max = (axis == Z_AXIS ? delta_height
 | 
			
		||||
      #if HAS_BED_PROBE
 | 
			
		||||
        - zprobe_offset[Z_AXIS]
 | 
			
		||||
        - probe_offset[Z_AXIS]
 | 
			
		||||
      #endif
 | 
			
		||||
      : base_max_pos(axis));
 | 
			
		||||
 | 
			
		||||
@@ -1340,7 +1340,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
 | 
			
		||||
  #elif ENABLED(DELTA)
 | 
			
		||||
    current_position[axis] = (axis == Z_AXIS ? delta_height
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
      - zprobe_offset[Z_AXIS]
 | 
			
		||||
      - probe_offset[Z_AXIS]
 | 
			
		||||
    #endif
 | 
			
		||||
    : base_home_pos(axis));
 | 
			
		||||
  #else
 | 
			
		||||
@@ -1354,9 +1354,9 @@ void set_axis_is_at_home(const AxisEnum axis) {
 | 
			
		||||
    if (axis == Z_AXIS) {
 | 
			
		||||
      #if HOMING_Z_WITH_PROBE
 | 
			
		||||
 | 
			
		||||
        current_position[Z_AXIS] -= zprobe_offset[Z_AXIS];
 | 
			
		||||
        current_position[Z_AXIS] -= probe_offset[Z_AXIS];
 | 
			
		||||
 | 
			
		||||
        if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***\n> zprobe_offset[Z_AXIS] = ", zprobe_offset[Z_AXIS]);
 | 
			
		||||
        if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***\n> probe_offset[Z_AXIS] = ", probe_offset[Z_AXIS]);
 | 
			
		||||
 | 
			
		||||
      #else
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -284,7 +284,7 @@ void homeaxis(const AxisEnum axis);
 | 
			
		||||
    // Return true if the both nozzle and the probe can reach the given point.
 | 
			
		||||
    // Note: This won't work on SCARA since the probe offset rotates with the arm.
 | 
			
		||||
    inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
 | 
			
		||||
      return position_is_reachable(rx - zprobe_offset[X_AXIS], ry - zprobe_offset[Y_AXIS])
 | 
			
		||||
      return position_is_reachable(rx - probe_offset[X_AXIS], ry - probe_offset[Y_AXIS])
 | 
			
		||||
             && position_is_reachable(rx, ry, ABS(MIN_PROBE_EDGE));
 | 
			
		||||
    }
 | 
			
		||||
  #endif
 | 
			
		||||
@@ -313,7 +313,7 @@ void homeaxis(const AxisEnum axis);
 | 
			
		||||
     *          nozzle must be be able to reach +10,-10.
 | 
			
		||||
     */
 | 
			
		||||
    inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
 | 
			
		||||
      return position_is_reachable(rx - zprobe_offset[X_AXIS], ry - zprobe_offset[Y_AXIS])
 | 
			
		||||
      return position_is_reachable(rx - probe_offset[X_AXIS], ry - probe_offset[Y_AXIS])
 | 
			
		||||
          && WITHIN(rx, probe_min_x() - slop, probe_max_x() + slop)
 | 
			
		||||
          && WITHIN(ry, probe_min_y() - slop, probe_max_y() + slop);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@
 | 
			
		||||
  #include "../feature/backlash.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
float zprobe_offset[XYZ]; // Initialized by settings.load()
 | 
			
		||||
float probe_offset[XYZ]; // Initialized by settings.load()
 | 
			
		||||
 | 
			
		||||
#if ENABLED(BLTOUCH)
 | 
			
		||||
  #include "../feature/bltouch.h"
 | 
			
		||||
@@ -91,7 +91,7 @@ float probe_min_x() {
 | 
			
		||||
    #if ENABLED(DELTA) || IS_SCARA
 | 
			
		||||
      PROBE_X_MIN, MESH_MIN_X
 | 
			
		||||
    #else
 | 
			
		||||
      (X_MIN_BED) + (MIN_PROBE_EDGE), (X_MIN_POS) + zprobe_offset[X_AXIS]
 | 
			
		||||
      (X_MIN_BED) + (MIN_PROBE_EDGE), (X_MIN_POS) + probe_offset[X_AXIS]
 | 
			
		||||
    #endif
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
@@ -100,7 +100,7 @@ float probe_max_x() {
 | 
			
		||||
    #if ENABLED(DELTA) || IS_SCARA
 | 
			
		||||
      PROBE_X_MAX, MESH_MAX_X
 | 
			
		||||
    #else
 | 
			
		||||
      (X_MAX_BED) - (MIN_PROBE_EDGE), (X_MAX_POS) + zprobe_offset[X_AXIS]
 | 
			
		||||
      (X_MAX_BED) - (MIN_PROBE_EDGE), (X_MAX_POS) + probe_offset[X_AXIS]
 | 
			
		||||
    #endif
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
@@ -109,7 +109,7 @@ float probe_min_y() {
 | 
			
		||||
    #if ENABLED(DELTA) || IS_SCARA
 | 
			
		||||
      PROBE_Y_MIN, MESH_MIN_Y
 | 
			
		||||
    #else
 | 
			
		||||
      (Y_MIN_BED) + (MIN_PROBE_EDGE), (Y_MIN_POS) + zprobe_offset[Y_AXIS]
 | 
			
		||||
      (Y_MIN_BED) + (MIN_PROBE_EDGE), (Y_MIN_POS) + probe_offset[Y_AXIS]
 | 
			
		||||
    #endif
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
@@ -118,7 +118,7 @@ float probe_max_y() {
 | 
			
		||||
    #if ENABLED(DELTA) || IS_SCARA
 | 
			
		||||
      PROBE_Y_MAX, MESH_MAX_Y
 | 
			
		||||
    #else
 | 
			
		||||
      (Y_MAX_BED) - (MIN_PROBE_EDGE), (Y_MAX_POS) + zprobe_offset[Y_AXIS]
 | 
			
		||||
      (Y_MAX_BED) - (MIN_PROBE_EDGE), (Y_MAX_POS) + probe_offset[Y_AXIS]
 | 
			
		||||
    #endif
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
@@ -300,7 +300,7 @@ inline void do_probe_raise(const float z_raise) {
 | 
			
		||||
  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("do_probe_raise(", z_raise, ")");
 | 
			
		||||
 | 
			
		||||
  float z_dest = z_raise;
 | 
			
		||||
  if (zprobe_offset[Z_AXIS] < 0) z_dest -= zprobe_offset[Z_AXIS];
 | 
			
		||||
  if (probe_offset[Z_AXIS] < 0) z_dest -= probe_offset[Z_AXIS];
 | 
			
		||||
 | 
			
		||||
  NOMORE(z_dest, Z_MAX_POS);
 | 
			
		||||
 | 
			
		||||
@@ -580,7 +580,7 @@ static float run_z_probe() {
 | 
			
		||||
 | 
			
		||||
  // Stop the probe before it goes too low to prevent damage.
 | 
			
		||||
  // If Z isn't known then probe to -10mm.
 | 
			
		||||
  const float z_probe_low_point = TEST(axis_known_position, Z_AXIS) ? -zprobe_offset[Z_AXIS] + Z_PROBE_LOW_POINT : -10.0;
 | 
			
		||||
  const float z_probe_low_point = TEST(axis_known_position, Z_AXIS) ? -probe_offset[Z_AXIS] + Z_PROBE_LOW_POINT : -10.0;
 | 
			
		||||
 | 
			
		||||
  // Double-probing does a fast probe followed by a slow probe
 | 
			
		||||
  #if TOTAL_PROBING == 2
 | 
			
		||||
@@ -605,7 +605,7 @@ static float run_z_probe() {
 | 
			
		||||
 | 
			
		||||
    // If the nozzle is well over the travel height then
 | 
			
		||||
    // move down quickly before doing the slow probe
 | 
			
		||||
    const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (zprobe_offset[Z_AXIS] < 0 ? -zprobe_offset[Z_AXIS] : 0);
 | 
			
		||||
    const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (probe_offset[Z_AXIS] < 0 ? -probe_offset[Z_AXIS] : 0);
 | 
			
		||||
    if (current_position[Z_AXIS] > z) {
 | 
			
		||||
      // Probe down fast. If the probe never triggered, raise for probe clearance
 | 
			
		||||
      if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))
 | 
			
		||||
@@ -735,8 +735,8 @@ float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_
 | 
			
		||||
  float nx = rx, ny = ry;
 | 
			
		||||
  if (probe_relative) {
 | 
			
		||||
    if (!position_is_reachable_by_probe(rx, ry)) return NAN;  // The given position is in terms of the probe
 | 
			
		||||
    nx -= zprobe_offset[X_AXIS];                     // Get the nozzle position
 | 
			
		||||
    ny -= zprobe_offset[Y_AXIS];
 | 
			
		||||
    nx -= probe_offset[X_AXIS];                     // Get the nozzle position
 | 
			
		||||
    ny -= probe_offset[Y_AXIS];
 | 
			
		||||
  }
 | 
			
		||||
  else if (!position_is_reachable(nx, ny)) return NAN;        // The given position is in terms of the nozzle
 | 
			
		||||
 | 
			
		||||
@@ -757,7 +757,7 @@ float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_
 | 
			
		||||
 | 
			
		||||
  float measured_z = NAN;
 | 
			
		||||
  if (!DEPLOY_PROBE()) {
 | 
			
		||||
    measured_z = run_z_probe() + zprobe_offset[Z_AXIS];
 | 
			
		||||
    measured_z = run_z_probe() + probe_offset[Z_AXIS];
 | 
			
		||||
 | 
			
		||||
    const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
 | 
			
		||||
    if (big_raise || raise_after == PROBE_PT_RAISE)
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@
 | 
			
		||||
 | 
			
		||||
#if HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
  extern float zprobe_offset[XYZ];
 | 
			
		||||
  extern float probe_offset[XYZ];
 | 
			
		||||
  bool set_probe_deployed(const bool deploy);
 | 
			
		||||
  #ifdef Z_AFTER_PROBING
 | 
			
		||||
    void move_z_after_probing();
 | 
			
		||||
@@ -51,7 +51,7 @@
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
  constexpr float zprobe_offset[XYZ] = { 0 };
 | 
			
		||||
  constexpr float probe_offset[XYZ] = { 0 };
 | 
			
		||||
  #define DEPLOY_PROBE()
 | 
			
		||||
  #define STOW_PROBE()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user