|
@@ -61,7 +61,7 @@
|
61
|
61
|
* G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
|
62
|
62
|
* G31 - Dock sled (Z_PROBE_SLED only)
|
63
|
63
|
* G32 - Undock sled (Z_PROBE_SLED only)
|
64
|
|
- * G33 - Delta '4-7-point' auto calibration : "G33 C<points> V<verbose>" (Requires DELTA)
|
|
64
|
+ * G33 - Delta '1-4-7-point' auto calibration : "G33 P<points> <A> <O> <T> V<verbose>" (Requires DELTA)
|
65
|
65
|
* G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes
|
66
|
66
|
* G90 - Use Absolute Coordinates
|
67
|
67
|
* G91 - Use Relative Coordinates
|
|
@@ -4991,65 +4991,67 @@ inline void gcode_G28() {
|
4991
|
4991
|
|
4992
|
4992
|
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
4993
|
4993
|
/**
|
4994
|
|
- * G33 - Delta Auto Calibration
|
4995
|
|
- * Utility to calibrate height, endstop offsets, delta radius, and tower angles.
|
4996
|
|
- *
|
4997
|
|
- * Parameters:
|
4998
|
|
- *
|
4999
|
|
- * C0 Calibrate height
|
5000
|
|
- * C1 Probe the center to set the Z height
|
5001
|
|
- * C-1 same but 1 iteration only
|
5002
|
|
- * C2 probe center and towers, set height, endstops, and delta radius
|
5003
|
|
- * C-2 same but opposite towers
|
5004
|
|
- *
|
5005
|
|
- * C3 probe all points: center, towers and opposite towers / sets all
|
5006
|
|
- *
|
5007
|
|
- * C4-C7 probe all points multiple times and average
|
5008
|
|
- * C0-C3 same but tower angle calibration disabled
|
5009
|
|
- *
|
5010
|
|
- * V0 Dry-run mode
|
5011
|
|
- * V1 Output settings
|
5012
|
|
- * V2 Output setting and probe results
|
|
4994
|
+ * G33 - Delta '1-4-7-point' auto calibration (Requires DELTA)
|
|
4995
|
+ *
|
|
4996
|
+ * Usage:
|
|
4997
|
+ * G33 <Pn> <A> <O> <T> <Vn>
|
|
4998
|
+ *
|
|
4999
|
+ * Pn = n=-7 -> +7 : n*n probe points
|
|
5000
|
+ * calibrates height ('1 point'), endstops, and delta radius ('4 points')
|
|
5001
|
+ * and tower angles with n > 2 ('7+ points')
|
|
5002
|
+ * n=1 probes center / sets height only
|
|
5003
|
+ * n=2 probes center and towers / sets height, endstops and delta radius
|
|
5004
|
+ * n=3 probes all points: center, towers and opposite towers / sets all
|
|
5005
|
+ * n>3 probes all points multiple times and averages
|
|
5006
|
+ * A = abort 1 point delta height calibration after 1 probe
|
|
5007
|
+ * O = use oposite tower points instead of tower points with 4 point calibration
|
|
5008
|
+ * T = do not calibrate tower angles with 7+ point calibration
|
|
5009
|
+ * Vn = verbose level (n=0-2 default 1)
|
|
5010
|
+ * n=0 dry-run mode: no calibration
|
|
5011
|
+ * n=1 settings
|
|
5012
|
+ * n=2 setting + probe results
|
5013
|
5013
|
*/
|
5014
|
5014
|
inline void gcode_G33() {
|
5015
|
5015
|
|
5016
|
|
- if (axis_unhomed_error(true, true, true)) return;
|
5017
|
|
-
|
5018
|
|
- const int8_t c_value = code_seen('C') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS;
|
5019
|
|
- if (!WITHIN(c_value, -7, 7)) {
|
5020
|
|
- SERIAL_PROTOCOLLNPGM("?C parameter is implausible (-7 to 7).");
|
5021
|
|
- return;
|
5022
|
|
- }
|
5023
|
|
-
|
5024
|
|
- const int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
|
5025
|
|
- if (!WITHIN(verbose_level, 0, 2)) {
|
5026
|
|
- SERIAL_PROTOCOLLNPGM("?(V)erbose Level is implausible (0-2).");
|
5027
|
|
- return;
|
5028
|
|
- }
|
5029
|
|
-
|
5030
|
5016
|
stepper.synchronize();
|
5031
|
5017
|
|
5032
|
5018
|
#if PLANNER_LEVELING
|
5033
|
5019
|
set_bed_leveling_enabled(false);
|
5034
|
5020
|
#endif
|
5035
|
5021
|
|
5036
|
|
- const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
|
|
5022
|
+ int8_t pp = code_seen('P') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS,
|
|
5023
|
+ probe_mode = (WITHIN(pp, 1, 7)) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS;
|
|
5024
|
+
|
|
5025
|
+ probe_mode = (code_seen('A') && probe_mode == 1) ? -probe_mode : probe_mode;
|
|
5026
|
+ probe_mode = (code_seen('O') && probe_mode == 2) ? -probe_mode : probe_mode;
|
|
5027
|
+ probe_mode = (code_seen('T') && probe_mode > 2) ? -probe_mode : probe_mode;
|
|
5028
|
+
|
|
5029
|
+ int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
|
5037
|
5030
|
|
5038
|
|
- const uint8_t probe_points = abs(c_value);
|
|
5031
|
+ if (!WITHIN(verbose_level, 0, 2)) verbose_level = 1;
|
5039
|
5032
|
|
5040
|
|
- const bool neg = c_value < 0,
|
5041
|
|
- equals4 = probe_points == 4,
|
5042
|
|
- over4 = probe_points > 4,
|
5043
|
|
- over5 = probe_points > 5;
|
|
5033
|
+ gcode_G28();
|
5044
|
5034
|
|
5045
|
|
- float e_old[XYZ],
|
|
5035
|
+ const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
|
|
5036
|
+ float test_precision,
|
|
5037
|
+ zero_std_dev = verbose_level ? 999.0 : 0.0, // 0.0 in dry-run mode : forced end
|
|
5038
|
+ e_old[XYZ] = {
|
|
5039
|
+ endstop_adj[A_AXIS],
|
|
5040
|
+ endstop_adj[B_AXIS],
|
|
5041
|
+ endstop_adj[C_AXIS]
|
|
5042
|
+ },
|
5046
|
5043
|
dr_old = delta_radius,
|
5047
|
5044
|
zh_old = home_offset[Z_AXIS],
|
5048
|
5045
|
alpha_old = delta_tower_angle_trim[A_AXIS],
|
5049
|
|
- beta_old = delta_tower_angle_trim[B_AXIS];
|
5050
|
|
-
|
5051
|
|
- COPY(e_old, endstop_adj);
|
5052
|
|
-
|
|
5046
|
+ beta_old = delta_tower_angle_trim[B_AXIS];
|
|
5047
|
+ int8_t iterations = 0,
|
|
5048
|
+ probe_points = abs(probe_mode);
|
|
5049
|
+ bool _1_point = (probe_points <= 1),
|
|
5050
|
+ _7_point = (probe_mode > 2),
|
|
5051
|
+ o_mode = (probe_mode == -2),
|
|
5052
|
+ towers = (probe_points > 2 || probe_mode == 2),
|
|
5053
|
+ opposites = (probe_points > 2 || o_mode);
|
|
5054
|
+
|
5053
|
5055
|
// print settings
|
5054
|
5056
|
|
5055
|
5057
|
SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
|
|
@@ -5059,7 +5061,7 @@ inline void gcode_G28() {
|
5059
|
5061
|
LCD_MESSAGEPGM("Checking... AC");
|
5060
|
5062
|
|
5061
|
5063
|
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
|
5062
|
|
- if (probe_points > 1) {
|
|
5064
|
+ if (!_1_point) {
|
5063
|
5065
|
SERIAL_PROTOCOLPGM(" Ex:");
|
5064
|
5066
|
if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+');
|
5065
|
5067
|
SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2);
|
|
@@ -5072,7 +5074,7 @@ inline void gcode_G28() {
|
5072
|
5074
|
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
|
5073
|
5075
|
}
|
5074
|
5076
|
SERIAL_EOL;
|
5075
|
|
- if (c_value > 2) {
|
|
5077
|
+ if (_7_point) {
|
5076
|
5078
|
SERIAL_PROTOCOLPGM(".Tower angle : Tx:");
|
5077
|
5079
|
if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+');
|
5078
|
5080
|
SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2);
|
|
@@ -5087,62 +5089,70 @@ inline void gcode_G28() {
|
5087
|
5089
|
DEPLOY_PROBE();
|
5088
|
5090
|
#endif
|
5089
|
5091
|
|
5090
|
|
- float zero_std_dev = verbose_level ? 999.0 : 0.0, // 0.0 in dry-run mode : forced end
|
5091
|
|
- test_precision;
|
5092
|
|
- int8_t iterations = 0;
|
5093
|
5092
|
do {
|
5094
|
5093
|
|
5095
|
|
- setup_for_endstop_or_probe_move();
|
|
5094
|
+ float z_at_pt[13] = { 0 },
|
|
5095
|
+ S1 = z_at_pt[0],
|
|
5096
|
+ S2 = sq(S1);
|
|
5097
|
+ int16_t N = 1;
|
|
5098
|
+ bool _4_probe = (probe_points == 2),
|
|
5099
|
+ _7_probe = (probe_points > 2),
|
|
5100
|
+ center_probe = (probe_points != 3 && probe_points != 6),
|
|
5101
|
+ multi_circle = (probe_points > 4),
|
|
5102
|
+ diff_circle = (probe_points > 5),
|
|
5103
|
+ max_circle = (probe_points > 6),
|
|
5104
|
+ intermediates = (probe_points == 4 || diff_circle);
|
5096
|
5105
|
|
|
5106
|
+ setup_for_endstop_or_probe_move();
|
5097
|
5107
|
test_precision = zero_std_dev;
|
5098
|
|
- float z_at_pt[13] = { 0 };
|
5099
|
5108
|
iterations++;
|
5100
|
5109
|
|
5101
|
5110
|
// probe the points
|
5102
|
5111
|
|
5103
|
5112
|
int16_t center_points = 0;
|
5104
|
5113
|
|
5105
|
|
- if (probe_points != 3 && probe_points != 6) { // probe center
|
|
5114
|
+ if (center_probe) { // probe centre
|
5106
|
5115
|
z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1);
|
5107
|
5116
|
center_points = 1;
|
5108
|
5117
|
}
|
5109
|
5118
|
|
5110
|
|
- int16_t step_axis = over4 ? 2 : 4;
|
5111
|
|
- if (probe_points >= 3) { // probe extra 3 or 6 center points
|
5112
|
|
- for (int8_t axis = over4 ? 11 : 9; axis > 0; axis -= step_axis) {
|
|
5119
|
+ int16_t step_axis = (multi_circle) ? 2 : 4,
|
|
5120
|
+ start = (multi_circle) ? 11 : 9;
|
|
5121
|
+ if (_7_probe) { // probe extra 3 or 6 centre points
|
|
5122
|
+ for (int8_t axis = start; axis > 0; axis -= step_axis) {
|
5113
|
5123
|
z_at_pt[0] += probe_pt(
|
5114
|
5124
|
cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius),
|
5115
|
5125
|
sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1);
|
5116
|
5126
|
}
|
5117
|
|
- center_points += over4 ? 6 : 3; // average center points
|
|
5127
|
+ center_points += (multi_circle) ? 6 : 3; // average centre points
|
5118
|
5128
|
z_at_pt[0] /= center_points;
|
5119
|
5129
|
}
|
5120
|
5130
|
|
5121
|
|
- float S1 = z_at_pt[0], S2 = sq(S1);
|
|
5131
|
+ start = (o_mode) ? 3 : 1;
|
|
5132
|
+ step_axis = (_4_probe) ? 4 : (intermediates) ? 1 : 2;
|
5122
|
5133
|
|
5123
|
|
- int16_t N = 1, start = (c_value == -2) ? 3 : 1;
|
5124
|
|
- step_axis = (probe_points == 2) ? 4 : (equals4 || over5) ? 1 : 2;
|
5125
|
|
-
|
5126
|
|
- if (probe_points > 1) {
|
5127
|
|
- float start_circles = (probe_points > 6) ? -1.5 : over4 ? -1 : 0, // one or multi radius points
|
5128
|
|
- end_circles = -start_circles;
|
|
5134
|
+ if (!_1_point) {
|
|
5135
|
+ float start_circles = (max_circle) ? -1.5 : (multi_circle) ? -1 : 0, // one or multi radius points
|
|
5136
|
+ end_circles = -start_circles;
|
5129
|
5137
|
bool zig_zag = true;
|
5130
|
5138
|
for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius
|
5131
|
5139
|
for (float circles = start_circles ; circles <= end_circles; circles++) // one or multi radius points
|
5132
|
5140
|
z_at_pt[axis] += probe_pt(
|
5133
|
|
- cos(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius),
|
5134
|
|
- sin(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius), true, 1);
|
|
5141
|
+ cos(RADIANS(180 + 30 * axis)) * (1 + circles * 0.1 * ((zig_zag) ? 1 : -1)) * delta_calibration_radius,
|
|
5142
|
+ sin(RADIANS(180 + 30 * axis)) * (1 + circles * 0.1 * ((zig_zag) ? 1 : -1)) * delta_calibration_radius, true, 1);
|
5135
|
5143
|
|
5136
|
|
- if (over5) start_circles += zig_zag ? +0.5 : -0.5; // opposites: one radius point less
|
5137
|
|
- if (over5) end_circles += zig_zag ? -0.5 : +0.5;
|
|
5144
|
+ if (diff_circle) {
|
|
5145
|
+ start_circles += (zig_zag) ? 0.5 : -0.5; // opposites: one radius point less
|
|
5146
|
+ end_circles = -start_circles;
|
|
5147
|
+ }
|
5138
|
5148
|
zig_zag = !zig_zag;
|
5139
|
|
- if (over4) z_at_pt[axis] /= (zig_zag ? 3.0 : 2.0); // average between radius points
|
|
5149
|
+ if (multi_circle) z_at_pt[axis] /= (zig_zag) ? 3.0 : 2.0; // average between radius points
|
5140
|
5150
|
}
|
5141
|
5151
|
}
|
|
5152
|
+ if (intermediates) step_axis = 2;
|
5142
|
5153
|
|
5143
|
|
- if (equals4 || over5) step_axis = 2;
|
5144
|
5154
|
for (uint8_t axis = start; axis < 13; axis += step_axis) { // average half intermediates to towers and opposites
|
5145
|
|
- if (equals4 || over5)
|
|
5155
|
+ if (intermediates)
|
5146
|
5156
|
z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0;
|
5147
|
5157
|
|
5148
|
5158
|
S1 += z_at_pt[axis];
|
|
@@ -5181,7 +5191,7 @@ inline void gcode_G28() {
|
5181
|
5191
|
#define Z0444(I) ZP(a_factor * 4.0 / 9.0, I)
|
5182
|
5192
|
#define Z0888(I) ZP(a_factor * 8.0 / 9.0, I)
|
5183
|
5193
|
|
5184
|
|
- switch (c_value) {
|
|
5194
|
+ switch (probe_mode) {
|
5185
|
5195
|
case -1:
|
5186
|
5196
|
test_precision = 0.00;
|
5187
|
5197
|
case 1:
|
|
@@ -5207,8 +5217,8 @@ inline void gcode_G28() {
|
5207
|
5217
|
e_delta[Y_AXIS] = Z1050(0) - Z0175(1) + Z0350(5) - Z0175(9) + Z0175(7) - Z0350(11) + Z0175(3);
|
5208
|
5218
|
e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3);
|
5209
|
5219
|
r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3);
|
5210
|
|
-
|
5211
|
|
- if (c_value > 0) { //probe points negative disables tower angles
|
|
5220
|
+
|
|
5221
|
+ if (probe_mode > 0) { //probe points negative disables tower angles
|
5212
|
5222
|
t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3);
|
5213
|
5223
|
t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3);
|
5214
|
5224
|
}
|
|
@@ -5241,10 +5251,10 @@ inline void gcode_G28() {
|
5241
|
5251
|
// print report
|
5242
|
5252
|
|
5243
|
5253
|
if (verbose_level == 2) {
|
5244
|
|
- SERIAL_PROTOCOLPGM(". c:");
|
|
5254
|
+ SERIAL_PROTOCOLPGM(". c:");
|
5245
|
5255
|
if (z_at_pt[0] > 0) SERIAL_CHAR('+');
|
5246
|
5256
|
SERIAL_PROTOCOL_F(z_at_pt[0], 2);
|
5247
|
|
- if (probe_points > 2 || c_value == 2) {
|
|
5257
|
+ if (towers) {
|
5248
|
5258
|
SERIAL_PROTOCOLPGM(" x:");
|
5249
|
5259
|
if (z_at_pt[1] >= 0) SERIAL_CHAR('+');
|
5250
|
5260
|
SERIAL_PROTOCOL_F(z_at_pt[1], 2);
|
|
@@ -5255,9 +5265,9 @@ inline void gcode_G28() {
|
5255
|
5265
|
if (z_at_pt[9] >= 0) SERIAL_CHAR('+');
|
5256
|
5266
|
SERIAL_PROTOCOL_F(z_at_pt[9], 2);
|
5257
|
5267
|
}
|
5258
|
|
- if (c_value != -2) SERIAL_EOL;
|
5259
|
|
- if (probe_points > 2 || c_value == -2) {
|
5260
|
|
- if (probe_points > 2) {
|
|
5268
|
+ if (!o_mode) SERIAL_EOL;
|
|
5269
|
+ if (opposites) {
|
|
5270
|
+ if (_7_probe) {
|
5261
|
5271
|
SERIAL_CHAR('.');
|
5262
|
5272
|
SERIAL_PROTOCOL_SP(12);
|
5263
|
5273
|
}
|
|
@@ -5293,7 +5303,7 @@ inline void gcode_G28() {
|
5293
|
5303
|
lcd_setstatus(mess);
|
5294
|
5304
|
}
|
5295
|
5305
|
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
|
5296
|
|
- if (probe_points > 1) {
|
|
5306
|
+ if (!_1_point) {
|
5297
|
5307
|
SERIAL_PROTOCOLPGM(" Ex:");
|
5298
|
5308
|
if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+');
|
5299
|
5309
|
SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2);
|
|
@@ -5306,7 +5316,7 @@ inline void gcode_G28() {
|
5306
|
5316
|
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
|
5307
|
5317
|
}
|
5308
|
5318
|
SERIAL_EOL;
|
5309
|
|
- if (c_value > 2) {
|
|
5319
|
+ if (_7_point) {
|
5310
|
5320
|
SERIAL_PROTOCOLPGM(".Tower angle : Tx:");
|
5311
|
5321
|
if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+');
|
5312
|
5322
|
SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2);
|