|
@@ -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-point' auto calibration iteration
|
|
64
|
+ * G33 - Delta '4-7-point' auto calibration : "G33 C<points> 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
|
|
@@ -4982,32 +4982,23 @@ inline void gcode_G28() {
|
4982
|
4982
|
|
4983
|
4983
|
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
4984
|
4984
|
/**
|
4985
|
|
- * G33: Delta '4-point' auto calibration iteration
|
4986
|
|
- *
|
4987
|
|
- * Usage: G33 <Cn> <Vn>
|
4988
|
|
- *
|
4989
|
|
- * C (default) = Calibrate endstops, height and delta radius
|
4990
|
|
- *
|
4991
|
|
- * -2, 1-4: n x n probe points, default 3 x 3
|
4992
|
|
- *
|
4993
|
|
- * 1: probe center
|
4994
|
|
- * set height only - useful when z_offset is changed
|
4995
|
|
- * 2: probe center and towers
|
4996
|
|
- * solve one '4 point' calibration
|
4997
|
|
- * -2: probe center and opposite the towers
|
4998
|
|
- * solve one '4 point' calibration
|
4999
|
|
- * 3: probe 3 center points, towers and opposite-towers
|
5000
|
|
- * averages between 2 '4 point' calibrations
|
5001
|
|
- * 4: probe 4 center points, towers, opposite-towers and itermediate points
|
5002
|
|
- * averages between 4 '4 point' calibrations
|
5003
|
|
- *
|
5004
|
|
- * V Verbose level (0-3, default 1)
|
5005
|
|
- *
|
5006
|
|
- * 0: Dry-run mode: no calibration
|
5007
|
|
- * 1: Settings
|
5008
|
|
- * 2: Setting + probe results
|
5009
|
|
- * 3: Expert mode: setting + iteration factors (see Configuration_adv.h)
|
5010
|
|
- * This prematurely stops the iteration process when factors are found
|
|
4985
|
+ * G33 - Delta '4-7-point' auto calibration (Requires DELTA)
|
|
4986
|
+ *
|
|
4987
|
+ * Usage:
|
|
4988
|
+ * G33 <Cn> <Vn>
|
|
4989
|
+ *
|
|
4990
|
+ * Cn = (default) = calibrates height ('1 point'), endstops, and delta radius with '4 point'
|
|
4991
|
+ * and calibrates tower angles with '7+ point'
|
|
4992
|
+ * n= -2, 1-7 : n*n probe points
|
|
4993
|
+ * n=1 probes center - sets height only - usefull when z_offset is changed
|
|
4994
|
+ * n=2 probes center and towers
|
|
4995
|
+ * n=-2 probes center and opposite towers
|
|
4996
|
+ * n=3 probes all points: center, towers and opposite towers
|
|
4997
|
+ * n>3 probes all points multiple times and averages
|
|
4998
|
+ * Vn = verbose level (n=0-3 default 1)
|
|
4999
|
+ * n=0 dry-run mode: no calibration
|
|
5000
|
+ * n=1 settings
|
|
5001
|
+ * n=2 setting + probe results
|
5011
|
5002
|
*/
|
5012
|
5003
|
inline void gcode_G33() {
|
5013
|
5004
|
|
|
@@ -5022,16 +5013,7 @@ inline void gcode_G28() {
|
5022
|
5013
|
|
5023
|
5014
|
int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
|
5024
|
5015
|
|
5025
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5026
|
|
- #define _MAX_M33_V 3
|
5027
|
|
- if (verbose_level == 3 && probe_points == 1) verbose_level--; // needs at least 4 points
|
5028
|
|
- #else
|
5029
|
|
- #define _MAX_M33_V 2
|
5030
|
|
- if (verbose_level > 2)
|
5031
|
|
- SERIAL_PROTOCOLLNPGM("Enable DELTA_CALIBRATE_EXPERT_MODE in Configuration_adv.h");
|
5032
|
|
- #endif
|
5033
|
|
-
|
5034
|
|
- if (!WITHIN(verbose_level, 0, _MAX_M33_V)) verbose_level = 1;
|
|
5016
|
+ if (!WITHIN(verbose_level, 0, 2)) verbose_level = 1;
|
5035
|
5017
|
|
5036
|
5018
|
float zero_std_dev = verbose_level ? 999.0 : 0.0; // 0.0 in dry-run mode : forced end
|
5037
|
5019
|
|
|
@@ -5041,20 +5023,12 @@ inline void gcode_G28() {
|
5041
|
5023
|
dr_old = delta_radius,
|
5042
|
5024
|
zh_old = home_offset[Z_AXIS];
|
5043
|
5025
|
COPY(e_old,endstop_adj);
|
5044
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5045
|
|
- // expert variables
|
5046
|
|
- float h_f_old = 1.00, r_f_old = 0.00,
|
5047
|
|
- h_diff_min = 1.00, r_diff_max = 0.10;
|
5048
|
|
- #endif
|
5049
|
5026
|
|
5050
|
5027
|
// print settings
|
5051
|
5028
|
|
5052
|
5029
|
SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
|
5053
|
5030
|
SERIAL_PROTOCOLPGM("Checking... AC");
|
5054
|
5031
|
if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
|
5055
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5056
|
|
- if (verbose_level == 3) SERIAL_PROTOCOLPGM(" (EXPERT)");
|
5057
|
|
- #endif
|
5058
|
5032
|
SERIAL_EOL;
|
5059
|
5033
|
LCD_MESSAGEPGM("Checking... AC");
|
5060
|
5034
|
|
|
@@ -5084,16 +5058,8 @@ inline void gcode_G28() {
|
5084
|
5058
|
|
5085
|
5059
|
setup_for_endstop_or_probe_move();
|
5086
|
5060
|
|
5087
|
|
- test_precision =
|
5088
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5089
|
|
- // Expert mode : forced end at std_dev < 0.1
|
5090
|
|
- (verbose_level == 3 && zero_std_dev < 0.1) ? 0.0 :
|
5091
|
|
- #endif
|
5092
|
|
- zero_std_dev
|
5093
|
|
- ;
|
5094
|
|
-
|
|
5061
|
+ test_precision = zero_std_dev;
|
5095
|
5062
|
float z_at_pt[13] = { 0 };
|
5096
|
|
-
|
5097
|
5063
|
iterations++;
|
5098
|
5064
|
|
5099
|
5065
|
// probe the points
|
|
@@ -5149,21 +5115,19 @@ inline void gcode_G28() {
|
5149
|
5115
|
zh_old = home_offset[Z_AXIS];
|
5150
|
5116
|
|
5151
|
5117
|
float e_delta[XYZ] = { 0.0 }, r_delta = 0.0;
|
5152
|
|
-
|
5153
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5154
|
|
- float h_f_new = 0.0, r_f_new = 0.0 , t_f_new = 0.0,
|
5155
|
|
- h_diff = 0.00, r_diff = 0.00;
|
5156
|
|
- #endif
|
|
5118
|
+ const float r_diff = delta_radius - delta_calibration_radius,
|
|
5119
|
+ h_factor = 1.00 + r_diff * 0.001,
|
|
5120
|
+ r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)); //2.25 for r_diff = 20mm
|
5157
|
5121
|
|
5158
|
5122
|
#define ZP(N,I) ((N) * z_at_pt[I])
|
5159
|
5123
|
#define Z1000(I) ZP(1.00, I)
|
5160
|
|
- #define Z1050(I) ZP(H_FACTOR, I)
|
5161
|
|
- #define Z0700(I) ZP((H_FACTOR) * 2.0 / 3.00, I)
|
5162
|
|
- #define Z0350(I) ZP((H_FACTOR) / 3.00, I)
|
5163
|
|
- #define Z0175(I) ZP((H_FACTOR) / 6.00, I)
|
5164
|
|
- #define Z2250(I) ZP(R_FACTOR, I)
|
5165
|
|
- #define Z0750(I) ZP((R_FACTOR) / 3.00, I)
|
5166
|
|
- #define Z0375(I) ZP((R_FACTOR) / 6.00, I)
|
|
5124
|
+ #define Z1050(I) ZP(h_factor, I)
|
|
5125
|
+ #define Z0700(I) ZP(h_factor * 2.0 / 3.00, I)
|
|
5126
|
+ #define Z0350(I) ZP(h_factor / 3.00, I)
|
|
5127
|
+ #define Z0175(I) ZP(h_factor / 6.00, I)
|
|
5128
|
+ #define Z2250(I) ZP(r_factor, I)
|
|
5129
|
+ #define Z0750(I) ZP(r_factor / 3.00, I)
|
|
5130
|
+ #define Z0375(I) ZP(r_factor / 6.00, I)
|
5167
|
5131
|
|
5168
|
5132
|
switch (probe_points) {
|
5169
|
5133
|
case 1:
|
|
@@ -5193,28 +5157,7 @@ inline void gcode_G28() {
|
5193
|
5157
|
break;
|
5194
|
5158
|
}
|
5195
|
5159
|
|
5196
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5197
|
|
- // Calculate h & r factors
|
5198
|
|
- if (verbose_level == 3) {
|
5199
|
|
- LOOP_XYZ(axis) h_f_new += e_delta[axis] / 3;
|
5200
|
|
- r_f_new = r_delta;
|
5201
|
|
- h_diff = (1.0 / H_FACTOR) * (h_f_old - h_f_new) / h_f_old;
|
5202
|
|
- if (h_diff < h_diff_min && h_diff > 0.9) h_diff_min = h_diff;
|
5203
|
|
- if (r_f_old != 0)
|
5204
|
|
- r_diff = ( 0.0301 * sq(R_FACTOR) * R_FACTOR
|
5205
|
|
- + 0.311 * sq(R_FACTOR)
|
5206
|
|
- + 1.1493 * R_FACTOR
|
5207
|
|
- + 1.7952
|
5208
|
|
- ) * (r_f_old - r_f_new) / r_f_old;
|
5209
|
|
- if (r_diff > r_diff_max && r_diff < 0.4444) r_diff_max = r_diff;
|
5210
|
|
- SERIAL_EOL;
|
5211
|
|
-
|
5212
|
|
- h_f_old = h_f_new;
|
5213
|
|
- r_f_old = r_f_new;
|
5214
|
|
- }
|
5215
|
|
- #endif // DELTA_CALIBRATE_EXPERT_MODE
|
5216
|
|
-
|
5217
|
|
- // Adjust delta_height and endstops by the max amount
|
|
5160
|
+ // adjust delta_height and endstops by the max amount
|
5218
|
5161
|
LOOP_XYZ(axis) endstop_adj[axis] += e_delta[axis];
|
5219
|
5162
|
delta_radius += r_delta;
|
5220
|
5163
|
|
|
@@ -5235,17 +5178,6 @@ inline void gcode_G28() {
|
5235
|
5178
|
|
5236
|
5179
|
// print report
|
5237
|
5180
|
|
5238
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5239
|
|
- if (verbose_level == 3) {
|
5240
|
|
- const float r_factor = 22.902 * sq(r_diff_max) * r_diff_max
|
5241
|
|
- - 44.988 * sq(r_diff_max)
|
5242
|
|
- + 31.697 * r_diff_max
|
5243
|
|
- - 9.4439;
|
5244
|
|
- SERIAL_PROTOCOLPAIR("h_factor:", 1.0 / h_diff_min);
|
5245
|
|
- SERIAL_PROTOCOLPAIR(" r_factor:", r_factor);
|
5246
|
|
- SERIAL_EOL;
|
5247
|
|
- }
|
5248
|
|
- #endif
|
5249
|
5181
|
if (verbose_level == 2) {
|
5250
|
5182
|
SERIAL_PROTOCOLPGM(". c:");
|
5251
|
5183
|
if (z_at_pt[0] > 0) SERIAL_CHAR('+');
|
|
@@ -5277,7 +5209,7 @@ inline void gcode_G28() {
|
5277
|
5209
|
}
|
5278
|
5210
|
}
|
5279
|
5211
|
if (test_precision != 0.0) { // !forced end
|
5280
|
|
- if (zero_std_dev >= test_precision) {
|
|
5212
|
+ if (zero_std_dev >= test_precision) { // end iterations
|
5281
|
5213
|
SERIAL_PROTOCOLPGM("Calibration OK");
|
5282
|
5214
|
SERIAL_PROTOCOLLNPGM(" rolling back 1");
|
5283
|
5215
|
LCD_MESSAGEPGM("Calibration OK");
|
|
@@ -5311,16 +5243,9 @@ inline void gcode_G28() {
|
5311
|
5243
|
SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h");
|
5312
|
5244
|
}
|
5313
|
5245
|
else { // forced end
|
5314
|
|
- #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE)
|
5315
|
|
- if (verbose_level == 3)
|
5316
|
|
- SERIAL_PROTOCOLLNPGM("Copy to Configuration_adv.h");
|
5317
|
|
- else
|
5318
|
|
- #endif
|
5319
|
|
- {
|
5320
|
|
- SERIAL_PROTOCOLPGM("End DRY-RUN std dev:");
|
5321
|
|
- SERIAL_PROTOCOL_F(zero_std_dev, 3);
|
5322
|
|
- SERIAL_EOL;
|
5323
|
|
- }
|
|
5246
|
+ SERIAL_PROTOCOLPGM("End DRY-RUN std dev:");
|
|
5247
|
+ SERIAL_PROTOCOL_F(zero_std_dev, 3);
|
|
5248
|
+ SERIAL_EOL;
|
5324
|
5249
|
}
|
5325
|
5250
|
|
5326
|
5251
|
clean_up_after_endstop_or_probe_move();
|