|
@@ -2226,104 +2226,104 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
|
|
|
}
|
|
|
#endif
|
|
|
#ifdef MESH_BED_CALIBRATION_SHOW_LCD
|
|
|
- uint8_t next_line;
|
|
|
- lcd_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1), next_line);
|
|
|
- if (next_line > 3)
|
|
|
- next_line = 3;
|
|
|
+ uint8_t next_line;
|
|
|
+ lcd_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1), next_line);
|
|
|
+ if (next_line > 3)
|
|
|
+ next_line = 3;
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
- current_position[Z_AXIS] = MESH_HOME_Z_SEARCH + FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP * iteration * 0.3;
|
|
|
- for (int k = 0; k < 4; ++k) {
|
|
|
-
|
|
|
- refresh_cmd_timeout();
|
|
|
+
|
|
|
+ current_position[Z_AXIS] = MESH_HOME_Z_SEARCH + FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP * iteration * 0.3;
|
|
|
+ for (int k = 0; k < 4; ++k) {
|
|
|
+
|
|
|
+ refresh_cmd_timeout();
|
|
|
#ifdef MESH_BED_CALIBRATION_SHOW_LCD
|
|
|
- lcd_set_cursor(0, next_line);
|
|
|
- lcd_print(k + 1);
|
|
|
- lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));
|
|
|
+ lcd_set_cursor(0, next_line);
|
|
|
+ lcd_print(k + 1);
|
|
|
+ lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));
|
|
|
|
|
|
- if (iteration > 0) {
|
|
|
- lcd_puts_at_P(0, next_line + 1, _i("Iteration "));
|
|
|
- lcd_print(int(iteration + 1));
|
|
|
- }
|
|
|
+ if (iteration > 0) {
|
|
|
+ lcd_puts_at_P(0, next_line + 1, _i("Iteration "));
|
|
|
+ lcd_print(int(iteration + 1));
|
|
|
+ }
|
|
|
#endif
|
|
|
- float *pt = pts + k * 2;
|
|
|
-
|
|
|
-
|
|
|
- go_to_current(homing_feedrate[Z_AXIS] / 60.f);
|
|
|
- #ifdef SUPPORT_VERBOSITY
|
|
|
- if (verbosity_level >= 20) {
|
|
|
-
|
|
|
- current_position[Y_AXIS] = 0.f;
|
|
|
- go_to_current(homing_feedrate[X_AXIS] / 60.f);
|
|
|
- SERIAL_ECHOLNPGM("At Y0");
|
|
|
- delay_keep_alive(5000);
|
|
|
- current_position[Y_AXIS] = Y_MIN_POS;
|
|
|
- go_to_current(homing_feedrate[X_AXIS] / 60.f);
|
|
|
- SERIAL_ECHOLNPGM("At Y-4");
|
|
|
- delay_keep_alive(5000);
|
|
|
- }
|
|
|
- #endif
|
|
|
-
|
|
|
-
|
|
|
- current_position[X_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2);
|
|
|
- current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2 + 1);
|
|
|
-
|
|
|
- else {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[0] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[0];
|
|
|
- current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[1] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[1];
|
|
|
-
|
|
|
-
|
|
|
- if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION)
|
|
|
- current_position[Y_AXIS] = Y_MIN_POS_FOR_BED_CALIBRATION;
|
|
|
-
|
|
|
- }*/
|
|
|
- #ifdef SUPPORT_VERBOSITY
|
|
|
- if (verbosity_level >= 20) {
|
|
|
- SERIAL_ECHOPGM("current_position[X_AXIS]:");
|
|
|
- MYSERIAL.print(current_position[X_AXIS], 5);
|
|
|
- SERIAL_ECHOLNPGM("");
|
|
|
- SERIAL_ECHOPGM("current_position[Y_AXIS]:");
|
|
|
- MYSERIAL.print(current_position[Y_AXIS], 5);
|
|
|
- SERIAL_ECHOLNPGM("");
|
|
|
- SERIAL_ECHOPGM("current_position[Z_AXIS]:");
|
|
|
- MYSERIAL.print(current_position[Z_AXIS], 5);
|
|
|
- SERIAL_ECHOLNPGM("");
|
|
|
- }
|
|
|
- #endif
|
|
|
+ float *pt = pts + k * 2;
|
|
|
+
|
|
|
+
|
|
|
+ go_to_current(homing_feedrate[Z_AXIS] / 60.f);
|
|
|
+ #ifdef SUPPORT_VERBOSITY
|
|
|
+ if (verbosity_level >= 20) {
|
|
|
+
|
|
|
+ current_position[Y_AXIS] = 0.f;
|
|
|
+ go_to_current(homing_feedrate[X_AXIS] / 60.f);
|
|
|
+ SERIAL_ECHOLNPGM("At Y0");
|
|
|
+ delay_keep_alive(5000);
|
|
|
+ current_position[Y_AXIS] = Y_MIN_POS;
|
|
|
+ go_to_current(homing_feedrate[X_AXIS] / 60.f);
|
|
|
+ SERIAL_ECHOLNPGM("At Y-4");
|
|
|
+ delay_keep_alive(5000);
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+
|
|
|
+
|
|
|
+ current_position[X_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2);
|
|
|
+ current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2 + 1);
|
|
|
+
|
|
|
+ else {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[0] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[0];
|
|
|
+ current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[1] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[1];
|
|
|
+
|
|
|
+
|
|
|
+ if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION)
|
|
|
+ current_position[Y_AXIS] = Y_MIN_POS_FOR_BED_CALIBRATION;
|
|
|
+
|
|
|
+ }*/
|
|
|
+ #ifdef SUPPORT_VERBOSITY
|
|
|
+ if (verbosity_level >= 20) {
|
|
|
+ SERIAL_ECHOPGM("current_position[X_AXIS]:");
|
|
|
+ MYSERIAL.print(current_position[X_AXIS], 5);
|
|
|
+ SERIAL_ECHOLNPGM("");
|
|
|
+ SERIAL_ECHOPGM("current_position[Y_AXIS]:");
|
|
|
+ MYSERIAL.print(current_position[Y_AXIS], 5);
|
|
|
+ SERIAL_ECHOLNPGM("");
|
|
|
+ SERIAL_ECHOPGM("current_position[Z_AXIS]:");
|
|
|
+ MYSERIAL.print(current_position[Z_AXIS], 5);
|
|
|
+ SERIAL_ECHOLNPGM("");
|
|
|
+ }
|
|
|
+ #endif
|
|
|
|
|
|
- go_to_current(homing_feedrate[X_AXIS] / 60.f);
|
|
|
- #ifdef SUPPORT_VERBOSITY
|
|
|
- if (verbosity_level >= 10)
|
|
|
- delay_keep_alive(3000);
|
|
|
- #endif
|
|
|
- if (!find_bed_induction_sensor_point_xy(verbosity_level))
|
|
|
- return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND;
|
|
|
+ go_to_current(homing_feedrate[X_AXIS] / 60.f);
|
|
|
+ #ifdef SUPPORT_VERBOSITY
|
|
|
+ if (verbosity_level >= 10)
|
|
|
+ delay_keep_alive(3000);
|
|
|
+ #endif
|
|
|
+ if (!find_bed_induction_sensor_point_xy(verbosity_level))
|
|
|
+ return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND
|
|
|
#ifndef NEW_XYZCAL
|
|
|
#ifndef HEATBED_V2
|
|
|
|
|
|
- if (k == 0 || k == 1) {
|
|
|
-
|
|
|
- find_bed_induction_sensor_point_z();
|
|
|
- int8_t i = 4;
|
|
|
- for (;;) {
|
|
|
- if (improve_bed_induction_sensor_point3(verbosity_level))
|
|
|
- break;
|
|
|
- if (--i == 0)
|
|
|
- return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND;
|
|
|
-
|
|
|
- current_position[Z_AXIS] -= 0.025f;
|
|
|
- enable_endstops(false);
|
|
|
- enable_z_endstop(false);
|
|
|
- go_to_current(homing_feedrate[Z_AXIS]);
|
|
|
- }
|
|
|
- if (i == 0)
|
|
|
-
|
|
|
- return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND;
|
|
|
- }
|
|
|
+ if (k == 0 || k == 1) {
|
|
|
+
|
|
|
+ find_bed_induction_sensor_point_z();
|
|
|
+ int8_t i = 4;
|
|
|
+ for (;;) {
|
|
|
+ if (improve_bed_induction_sensor_point3(verbosity_level))
|
|
|
+ break;
|
|
|
+ if (--i == 0)
|
|
|
+ return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND;
|
|
|
+
|
|
|
+ current_position[Z_AXIS] -= 0.025f;
|
|
|
+ enable_endstops(false);
|
|
|
+ enable_z_endstop(false);
|
|
|
+ go_to_current(homing_feedrate[Z_AXIS]);
|
|
|
+ }
|
|
|
+ if (i == 0)
|
|
|
+
|
|
|
+ return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND;
|
|
|
+ }
|
|
|
#endif
|
|
|
#endif
|
|
|
#ifdef SUPPORT_VERBOSITY
|
|
@@ -2375,8 +2375,9 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
|
|
|
delay_keep_alive(3000);
|
|
|
}
|
|
|
#endif
|
|
|
- }
|
|
|
- delay_keep_alive(0);
|
|
|
+ }
|
|
|
+ DBG(_n("All 4 calibration points found.\n"));
|
|
|
+ delay_keep_alive(0);
|
|
|
|
|
|
#ifdef SUPPORT_VERBOSITY
|
|
|
if (verbosity_level >= 20) {
|
|
@@ -2386,7 +2387,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
|
|
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
current_position[X_AXIS] = pts[mesh_point * 2];
|
|
|
current_position[Y_AXIS] = pts[mesh_point * 2 + 1];
|
|
|
go_to_current(homing_feedrate[X_AXIS] / 60);
|
|
@@ -2450,7 +2451,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
|
|
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS;
|
|
|
uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS;
|
|
|
if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix;
|
|
@@ -2462,9 +2463,12 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
|
|
|
}
|
|
|
#endif
|
|
|
return result;
|
|
|
- }
|
|
|
- if (result == BED_SKEW_OFFSET_DETECTION_FITTING_FAILED && too_far_mask == 2) return result;
|
|
|
- iteration++;
|
|
|
+ }
|
|
|
+ if (result == BED_SKEW_OFFSET_DETECTION_FITTING_FAILED && too_far_mask == 2){
|
|
|
+ DBG(_n("Calibration failed.\n"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ iteration++;
|
|
|
}
|
|
|
return result;
|
|
|
}
|