Browse Source

G34 Mechanical Gantry Calibration (like Prusa M915) (#18972)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
InsanityAutomation 4 years ago
parent
commit
e7838c5f79
No account linked to committer's email address

+ 19
- 0
Marlin/Configuration_adv.h View File

3377
 #endif
3377
 #endif
3378
 
3378
 
3379
 /**
3379
 /**
3380
+ * Mechanical Gantry Calibration
3381
+ * Modern replacement for the Prusa TMC_Z_CALIBRATION.
3382
+ * Adds capability to work with any adjustable current drivers.
3383
+ * Implemented as G34 because M915 is deprecated.
3384
+ */
3385
+//#define MECHANICAL_GANTRY_CALIBRATION
3386
+#if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
3387
+  #define GANTRY_CALIBRATION_CURRENT          600     // Default calibration current in ma
3388
+  #define GANTRY_CALIBRATION_EXTRA_HEIGHT      15     // Extra distance in mm past Z_###_POS to move
3389
+  #define GANTRY_CALIBRATION_FEEDRATE         500     // Feedrate for correction move
3390
+  //#define GANTRY_CALIBRATION_TO_MIN                 // Enable to calibrate Z in the MIN direction
3391
+
3392
+  //#define GANTRY_CALIBRATION_SAFE_POSITION  { X_CENTER, Y_CENTER } // Safe position for nozzle
3393
+  //#define GANTRY_CALIBRATION_XY_PARK_FEEDRATE 3000  // XY Park Feedrate - MMM
3394
+  //#define GANTRY_CALIBRATION_COMMANDS_PRE   ""
3395
+  #define GANTRY_CALIBRATION_COMMANDS_POST  "G28"     // G28 highly recommended to ensure an accurate position
3396
+#endif
3397
+
3398
+/**
3380
  * MAX7219 Debug Matrix
3399
  * MAX7219 Debug Matrix
3381
  *
3400
  *
3382
  * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display.
3401
  * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display.

+ 153
- 0
Marlin/src/gcode/calibrate/G34.cpp View File

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../inc/MarlinConfigPre.h"
24
+
25
+#if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
26
+
27
+#include "../gcode.h"
28
+#include "../../module/motion.h"
29
+#include "../../module/stepper.h"
30
+#include "../../module/endstops.h"
31
+
32
+#if HAS_LEVELING
33
+  #include "../../feature/bedlevel/bedlevel.h"
34
+#endif
35
+
36
+#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
37
+#include "../../core/debug_out.h"
38
+
39
+void GcodeSuite::G34() {
40
+
41
+  if (homing_needed()) return;
42
+
43
+  TEMPORARY_SOFT_ENDSTOP_STATE(false);
44
+  TEMPORARY_BED_LEVELING_STATE(false);
45
+  TemporaryGlobalEndstopsState unlock_z(false);
46
+
47
+  #ifdef GANTRY_CALIBRATION_COMMANDS_PRE
48
+    gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_PRE));
49
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Sub Commands Processed");
50
+  #endif
51
+
52
+  #ifdef GANTRY_CALIBRATION_SAFE_POSITION
53
+    // Move XY to safe position
54
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Parking XY");
55
+    const xy_pos_t safe_pos = GANTRY_CALIBRATION_SAFE_POSITION;
56
+    do_blocking_move_to(safe_pos, MMM_TO_MMS(GANTRY_CALIBRATION_XY_PARK_FEEDRATE));
57
+  #endif
58
+
59
+  const float move_distance = parser.intval('Z', GANTRY_CALIBRATION_EXTRA_HEIGHT),
60
+              zbase = ENABLED(GANTRY_CALIBRATION_TO_MIN) ? Z_MIN_POS : Z_MAX_POS,
61
+              zpounce = zbase - move_distance, zgrind = zbase + move_distance;
62
+
63
+  // Move Z to pounce position
64
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Setting Z Pounce");
65
+  do_blocking_move_to_z(zpounce, MMM_TO_MMS(HOMING_FEEDRATE_Z));
66
+
67
+  // Store current motor settings, then apply reduced value
68
+
69
+  #define _REDUCE_CURRENT ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_DAC, HAS_MOTOR_CURRENT_I2C, HAS_TRINAMIC_CONFIG)
70
+  #if _REDUCE_CURRENT
71
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Reducing Current");
72
+  #endif
73
+
74
+  #if HAS_MOTOR_CURRENT_SPI
75
+    const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
76
+    const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
77
+    stepper.set_digipot_current(Z_AXIS, target_current);
78
+  #elif HAS_MOTOR_CURRENT_PWM
79
+    const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
80
+    const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
81
+    stepper.set_digipot_current(1, target_current);
82
+  #elif HAS_MOTOR_CURRENT_DAC
83
+    const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);
84
+    const float previous_current = dac_amps(Z_AXIS, target_current);
85
+    stepper_dac.set_current_value(Z_AXIS, target_current);
86
+  #elif ENABLED(HAS_MOTOR_CURRENT_I2C)
87
+    const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
88
+    previous_current = dac_amps(Z_AXIS);
89
+    digipot_i2c.set_current(Z_AXIS, target_current)
90
+  #elif HAS_TRINAMIC_CONFIG
91
+    const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
92
+    static uint16_t previous_current_arr[NUM_Z_STEPPER_DRIVERS];
93
+    #if AXIS_IS_TMC(Z)
94
+      previous_current_arr[0] = stepperZ.getMilliamps();
95
+      stepperZ.rms_current(target_current);
96
+    #endif
97
+    #if AXIS_IS_TMC(Z2)
98
+      previous_current_arr[1] = stepperZ2.getMilliamps();
99
+      stepperZ2.rms_current(target_current);
100
+    #endif
101
+    #if AXIS_IS_TMC(Z3)
102
+      previous_current_arr[2] = stepperZ3.getMilliamps();
103
+      stepperZ3.rms_current(target_current);
104
+    #endif
105
+    #if AXIS_IS_TMC(Z4)
106
+      previous_current_arr[3] = stepperZ4.getMilliamps();
107
+      stepperZ4.rms_current(target_current);
108
+    #endif
109
+  #endif
110
+
111
+  // Do Final Z move to adjust
112
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Final Z Move");
113
+  do_blocking_move_to_z(zgrind, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
114
+
115
+  // Back off end plate, back to normal motion range
116
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Backoff");
117
+  do_blocking_move_to_z(zpounce, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE));
118
+
119
+  #if _REDUCE_CURRENT
120
+    // Reset current to original values
121
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Restore Current");
122
+  #endif
123
+
124
+  #if HAS_MOTOR_CURRENT_SPI
125
+    stepper.set_digipot_current(Z_AXIS, previous_current);
126
+  #elif HAS_MOTOR_CURRENT_PWM
127
+    stepper.set_digipot_current(1, previous_current);
128
+  #elif HAS_MOTOR_CURRENT_DAC
129
+    stepper_dac.set_current_value(Z_AXIS, previous_current);
130
+  #elif ENABLED(HAS_MOTOR_CURRENT_I2C)
131
+    digipot_i2c.set_current(Z_AXIS, previous_current)
132
+  #elif HAS_TRINAMIC_CONFIG
133
+    #if AXIS_IS_TMC(Z)
134
+      stepperZ.rms_current(previous_current_arr[0]);
135
+    #endif
136
+    #if AXIS_IS_TMC(Z2)
137
+      stepperZ2.rms_current(previous_current_arr[1]);
138
+    #endif
139
+    #if AXIS_IS_TMC(Z3)
140
+      stepperZ3.rms_current(previous_current_arr[2]);
141
+    #endif
142
+    #if AXIS_IS_TMC(Z4)
143
+      stepperZ4.rms_current(previous_current_arr[3]);
144
+    #endif
145
+  #endif
146
+
147
+  #ifdef GANTRY_CALIBRATION_COMMANDS_POST
148
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Running Post Commands");
149
+    gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_POST));
150
+  #endif
151
+}
152
+
153
+#endif // MECHANICAL_GANTRY_CALIBRATION

+ 70
- 28
Marlin/src/gcode/calibrate/G34_M422.cpp View File

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
-#include "../../inc/MarlinConfig.h"
23
+#include "../../inc/MarlinConfigPre.h"
24
 
24
 
25
 #if ENABLED(Z_STEPPER_AUTO_ALIGN)
25
 #if ENABLED(Z_STEPPER_AUTO_ALIGN)
26
 
26
 
27
 #include "../../feature/z_stepper_align.h"
27
 #include "../../feature/z_stepper_align.h"
28
 
28
 
29
 #include "../gcode.h"
29
 #include "../gcode.h"
30
-#include "../../module/planner.h"
31
-#include "../../module/stepper.h"
32
 #include "../../module/motion.h"
30
 #include "../../module/motion.h"
31
+#include "../../module/stepper.h"
32
+#include "../../module/planner.h"
33
 #include "../../module/probe.h"
33
 #include "../../module/probe.h"
34
-
35
-#if HAS_MULTI_HOTEND
36
-  #include "../../module/tool_change.h"
37
-#endif
34
+#include "../../lcd/ultralcd.h" // for LCD_MESSAGEPGM
38
 
35
 
39
 #if HAS_LEVELING
36
 #if HAS_LEVELING
40
   #include "../../feature/bedlevel/bedlevel.h"
37
   #include "../../feature/bedlevel/bedlevel.h"
41
 #endif
38
 #endif
42
 
39
 
40
+#if HAS_MULTI_HOTEND
41
+  #include "../../module/tool_change.h"
42
+#endif
43
+
43
 #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
44
 #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
44
-   #include "../../libs/least_squares_fit.h"
45
+  #include "../../libs/least_squares_fit.h"
45
 #endif
46
 #endif
46
 
47
 
47
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
48
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
117
     // In BLTOUCH HS mode, the probe travels in a deployed state.
118
     // In BLTOUCH HS mode, the probe travels in a deployed state.
118
     // Users of G34 might have a badly misaligned bed, so raise Z by the
119
     // Users of G34 might have a badly misaligned bed, so raise Z by the
119
     // length of the deployed pin (BLTOUCH stroke < 7mm)
120
     // length of the deployed pin (BLTOUCH stroke < 7mm)
120
-    #define Z_BASIC_CLEARANCE Z_CLEARANCE_BETWEEN_PROBES + 7.0f * BOTH(BLTOUCH, BLTOUCH_HS_MODE)
121
+    #define Z_BASIC_CLEARANCE (Z_CLEARANCE_BETWEEN_PROBES + 7.0f * BOTH(BLTOUCH, BLTOUCH_HS_MODE))
121
 
122
 
122
     // Compute a worst-case clearance height to probe from. After the first
123
     // Compute a worst-case clearance height to probe from. After the first
123
     // iteration this will be re-calculated based on the actual bed position
124
     // iteration this will be re-calculated based on the actual bed position
154
           z_maxdiff = 0.0f,
155
           z_maxdiff = 0.0f,
155
           amplification = z_auto_align_amplification;
156
           amplification = z_auto_align_amplification;
156
 
157
 
157
-    // These are needed after the for-loop
158
-    uint8_t iteration;
159
-    bool err_break = false;
160
-    float z_measured_min;
161
-
162
     #if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
158
     #if DISABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
163
       bool adjustment_reverse = false;
159
       bool adjustment_reverse = false;
164
     #endif
160
     #endif
165
 
161
 
166
-    // 'iteration' is declared above and is also used after the for-loop.
167
-    // *not* the same as LOOP_L_N(iteration, z_auto_align_iterations)
168
-    for (iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
162
+    #if HAS_DISPLAY
163
+      PGM_P const msg_iteration = GET_TEXT(MSG_ITERATION);
164
+      const uint8_t iter_str_len = strlen_P(msg_iteration);
165
+    #endif
166
+
167
+    // Final z and iteration values will be used after breaking the loop
168
+    float z_measured_min;
169
+    uint8_t iteration = 0;
170
+    bool err_break = false; // To break out of nested loops
171
+    while (iteration < z_auto_align_iterations) {
169
       if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> probing all positions.");
172
       if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> probing all positions.");
170
 
173
 
171
-      SERIAL_ECHOLNPAIR("\nITERATION: ", int(iteration + 1));
174
+      const int iter = iteration + 1;
175
+      SERIAL_ECHOLNPAIR("\nG34 Iteration: ", iter);
176
+      #if HAS_DISPLAY
177
+        char str[iter_str_len + 2 + 1];
178
+        sprintf_P(str, msg_iteration, iter);
179
+        ui.set_status(str);
180
+      #endif
172
 
181
 
173
       // Initialize minimum value
182
       // Initialize minimum value
174
       z_measured_min =  100000.0f;
183
       z_measured_min =  100000.0f;
190
         // current_position.z has been manually altered in the "dirty trick" above.
199
         // current_position.z has been manually altered in the "dirty trick" above.
191
         const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false);
200
         const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false);
192
         if (isnan(z_probed_height)) {
201
         if (isnan(z_probed_height)) {
193
-          SERIAL_ECHOLNPGM("Probing failed.");
202
+          SERIAL_ECHOLNPGM("Probing failed");
203
+          LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
194
           err_break = true;
204
           err_break = true;
195
           break;
205
           break;
196
         }
206
         }
249
           , " Z3-Z1=", ABS(z_measured[2] - z_measured[0])
259
           , " Z3-Z1=", ABS(z_measured[2] - z_measured[0])
250
         #endif
260
         #endif
251
       );
261
       );
262
+      #if HAS_DISPLAY
263
+        char fstr1[10];
264
+        #if NUM_Z_STEPPER_DRIVERS == 2
265
+          char msg[6 + (6 + 5) * 1 + 1];
266
+        #else
267
+          char msg[6 + (6 + 5) * 3 + 1], fstr2[10], fstr3[10];
268
+        #endif
269
+        sprintf_P(msg,
270
+          PSTR("Diffs Z1-Z2=%s"
271
+            #if NUM_Z_STEPPER_DRIVERS == 3
272
+              " Z2-Z3=%s"
273
+              " Z3-Z1=%s"
274
+            #endif
275
+          ), dtostrf(ABS(z_measured[0] - z_measured[1]), 1, 3, fstr1)
276
+          #if NUM_Z_STEPPER_DRIVERS == 3
277
+            , dtostrf(ABS(z_measured[1] - z_measured[2]), 1, 3, fstr2)
278
+            , dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3)
279
+          #endif
280
+        );
281
+        ui.set_status(msg);
282
+      #endif
283
+
284
+      auto decreasing_accuracy = [](const float &v1, const float &v2){
285
+        if (v1 < v2 * 0.7f) {
286
+          SERIAL_ECHOLNPGM("Decreasing Accuracy Detected.");
287
+          LCD_MESSAGEPGM(MSG_DECREASING_ACCURACY);
288
+          return true;
289
+        }
290
+        return false;
291
+      };
252
 
292
 
253
       #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
293
       #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
294
+
254
         // Check if the applied corrections go in the correct direction.
295
         // Check if the applied corrections go in the correct direction.
255
         // Calculate the sum of the absolute deviations from the mean of the probe measurements.
296
         // Calculate the sum of the absolute deviations from the mean of the probe measurements.
256
         // Compare to the last iteration to ensure it's getting better.
297
         // Compare to the last iteration to ensure it's getting better.
266
           z_align_level_indicator += ABS(z_measured[zstepper] - z_measured_mean);
307
           z_align_level_indicator += ABS(z_measured[zstepper] - z_measured_mean);
267
 
308
 
268
         // If it's getting worse, stop and throw an error
309
         // If it's getting worse, stop and throw an error
269
-        if (last_z_align_level_indicator < z_align_level_indicator * 0.7f) {
270
-          SERIAL_ECHOLNPGM("Decreasing accuracy detected.");
271
-          err_break = true;
272
-          break;
273
-        }
310
+        err_break = decreasing_accuracy(last_z_align_level_indicator, z_align_level_indicator);
311
+        if (err_break) break;
274
 
312
 
275
         last_z_align_level_indicator = z_align_level_indicator;
313
         last_z_align_level_indicator = z_align_level_indicator;
276
       #endif
314
       #endif
290
           if (z_align_abs) amplification = (iteration == 1) ? _MIN(last_z_align_move[zstepper] / z_align_abs, 2.0f) : z_auto_align_amplification;
328
           if (z_align_abs) amplification = (iteration == 1) ? _MIN(last_z_align_move[zstepper] / z_align_abs, 2.0f) : z_auto_align_amplification;
291
 
329
 
292
           // Check for less accuracy compared to last move
330
           // Check for less accuracy compared to last move
293
-          if (last_z_align_move[zstepper] < z_align_abs * 0.7f) {
294
-            SERIAL_ECHOLNPGM("Decreasing accuracy detected.");
331
+          if (decreasing_accuracy(last_z_align_move[zstepper], z_align_abs)) {
295
             if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " last_z_align_move = ", last_z_align_move[zstepper]);
332
             if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " last_z_align_move = ", last_z_align_move[zstepper]);
296
             if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " z_align_abs = ", z_align_abs);
333
             if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " z_align_abs = ", z_align_abs);
297
             adjustment_reverse = !adjustment_reverse;
334
             adjustment_reverse = !adjustment_reverse;
329
 
366
 
330
       if (err_break) break;
367
       if (err_break) break;
331
 
368
 
332
-      if (success_break) { SERIAL_ECHOLNPGM("Target accuracy achieved."); break; }
369
+      if (success_break) {
370
+        SERIAL_ECHOLNPGM("Target accuracy achieved.");
371
+        LCD_MESSAGEPGM(MSG_ACCURACY_ACHIEVED);
372
+        break;
373
+      }
333
 
374
 
334
-    } // for (iteration)
375
+      iteration++;
376
+    } // while (iteration < z_auto_align_iterations)
335
 
377
 
336
     if (err_break)
378
     if (err_break)
337
       SERIAL_ECHOLNPGM("G34 aborted.");
379
       SERIAL_ECHOLNPGM("G34 aborted.");

+ 1
- 1
Marlin/src/gcode/gcode.cpp View File

327
         case 33: G33(); break;                                    // G33: Delta Auto-Calibration
327
         case 33: G33(); break;                                    // G33: Delta Auto-Calibration
328
       #endif
328
       #endif
329
 
329
 
330
-      #if ENABLED(Z_STEPPER_AUTO_ALIGN)
330
+      #if EITHER(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
331
         case 34: G34(); break;                                    // G34: Z Stepper automatic alignment using probe
331
         case 34: G34(); break;                                    // G34: Z Stepper automatic alignment using probe
332
       #endif
332
       #endif
333
 
333
 

+ 3
- 2
Marlin/src/gcode/gcode.h View File

465
 
465
 
466
   TERN_(DELTA_AUTO_CALIBRATION, static void G33());
466
   TERN_(DELTA_AUTO_CALIBRATION, static void G33());
467
 
467
 
468
-  #if ENABLED(Z_STEPPER_AUTO_ALIGN)
468
+  #if EITHER(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
469
     static void G34();
469
     static void G34();
470
-    static void M422();
471
   #endif
470
   #endif
472
 
471
 
472
+  TERN_(Z_STEPPER_AUTO_ALIGN, static void M422());
473
+
473
   TERN_(ASSISTED_TRAMMING, static void G35());
474
   TERN_(ASSISTED_TRAMMING, static void G35());
474
 
475
 
475
   TERN_(G38_PROBE_TARGET, static void G38(const int8_t subcode));
476
   TERN_(G38_PROBE_TARGET, static void G38(const int8_t subcode));

+ 16
- 1
Marlin/src/inc/SanityCheck.h View File

422
 #elif defined(CHAMBER_HEATER_PIN)
422
 #elif defined(CHAMBER_HEATER_PIN)
423
   #error "CHAMBER_HEATER_PIN is now HEATER_CHAMBER_PIN. Please update your configuration and/or pins."
423
   #error "CHAMBER_HEATER_PIN is now HEATER_CHAMBER_PIN. Please update your configuration and/or pins."
424
 #elif defined(TMC_Z_CALIBRATION)
424
 #elif defined(TMC_Z_CALIBRATION)
425
-  #error "TMC_Z_CALIBRATION has been deprecated in favor of Z_STEPPER_AUTO_ALIGN. Please update your configuration."
425
+  #error "TMC_Z_CALIBRATION has been deprecated in favor of MECHANICAL_GANTRY_CALIBRATION. Please update your configuration."
426
 #elif defined(Z_MIN_PROBE_ENDSTOP)
426
 #elif defined(Z_MIN_PROBE_ENDSTOP)
427
   #error "Z_MIN_PROBE_ENDSTOP is no longer required. Please remove it from Configuration.h."
427
   #error "Z_MIN_PROBE_ENDSTOP is no longer required. Please remove it from Configuration.h."
428
 #elif defined(DUAL_NOZZLE_DUPLICATION_MODE)
428
 #elif defined(DUAL_NOZZLE_DUPLICATION_MODE)
2788
   #endif
2788
   #endif
2789
 #endif
2789
 #endif
2790
 
2790
 
2791
+#if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
2792
+  #if NONE(HAS_MOTOR_CURRENT_DAC, HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC, HAS_TRINAMIC_CONFIG, HAS_MOTOR_CURRENT_PWM)
2793
+    #error "It is highly recommended to have adjustable current drivers to prevent damage. Disable this line to continue anyway."
2794
+  #elif !defined(GANTRY_CALIBRATION_CURRENT)
2795
+    #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_CURRENT to be set."
2796
+  #elif !defined(GANTRY_CALIBRATION_EXTRA_HEIGHT)
2797
+    #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_EXTRA_HEIGHT to be set."
2798
+  #elif !defined(GANTRY_CALIBRATION_FEEDRATE)
2799
+    #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_FEEDRATE to be set."
2800
+  #endif
2801
+  #if defined(GANTRY_CALIBRATION_SAFE_POSITION) && !defined(GANTRY_CALIBRATION_XY_PARK_FEEDRATE)
2802
+    #error "GANTRY_CALIBRATION_SAFE_POSITION Requires GANTRY_CALIBRATION_XY_PARK_FEEDRATE to be set."
2803
+  #endif
2804
+#endif
2805
+
2791
 #if ENABLED(PRINTCOUNTER) && DISABLED(EEPROM_SETTINGS)
2806
 #if ENABLED(PRINTCOUNTER) && DISABLED(EEPROM_SETTINGS)
2792
   #error "PRINTCOUNTER requires EEPROM_SETTINGS. Please update your Configuration."
2807
   #error "PRINTCOUNTER requires EEPROM_SETTINGS. Please update your Configuration."
2793
 #endif
2808
 #endif

+ 3
- 0
Marlin/src/lcd/language/language_en.h View File

67
   PROGMEM Language_Str MSG_AUTO_HOME_Z                     = _UxGT("Home Z");
67
   PROGMEM Language_Str MSG_AUTO_HOME_Z                     = _UxGT("Home Z");
68
   PROGMEM Language_Str MSG_AUTO_Z_ALIGN                    = _UxGT("Auto Z-Align");
68
   PROGMEM Language_Str MSG_AUTO_Z_ALIGN                    = _UxGT("Auto Z-Align");
69
   PROGMEM Language_Str MSG_ASSISTED_TRAMMING               = _UxGT("Assisted Tramming");
69
   PROGMEM Language_Str MSG_ASSISTED_TRAMMING               = _UxGT("Assisted Tramming");
70
+  PROGMEM Language_Str MSG_ITERATION                       = _UxGT("G34 Iteration: %i");
71
+  PROGMEM Language_Str MSG_DECREASING_ACCURACY             = _UxGT("Accuracy Decreasing!");
72
+  PROGMEM Language_Str MSG_ACCURACY_ACHIEVED               = _UxGT("Accuracy Achieved");
70
   PROGMEM Language_Str MSG_LEVEL_BED_HOMING                = _UxGT("Homing XYZ");
73
   PROGMEM Language_Str MSG_LEVEL_BED_HOMING                = _UxGT("Homing XYZ");
71
   PROGMEM Language_Str MSG_LEVEL_BED_WAITING               = _UxGT("Click to Begin");
74
   PROGMEM Language_Str MSG_LEVEL_BED_WAITING               = _UxGT("Click to Begin");
72
   PROGMEM Language_Str MSG_LEVEL_BED_NEXT_POINT            = _UxGT("Next Point");
75
   PROGMEM Language_Str MSG_LEVEL_BED_NEXT_POINT            = _UxGT("Next Point");

+ 1
- 1
Marlin/src/lcd/menu/menu_motion.cpp View File

358
   //
358
   //
359
   // Auto Z-Align
359
   // Auto Z-Align
360
   //
360
   //
361
-  #if ENABLED(Z_STEPPER_AUTO_ALIGN)
361
+  #if EITHER(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
362
     GCODES_ITEM(MSG_AUTO_Z_ALIGN, PSTR("G34"));
362
     GCODES_ITEM(MSG_AUTO_Z_ALIGN, PSTR("G34"));
363
   #endif
363
   #endif
364
 
364
 

+ 1
- 1
buildroot/tests/LPC1769-tests View File

61
 opt_set X_DRIVER_TYPE TMC2130
61
 opt_set X_DRIVER_TYPE TMC2130
62
 opt_set Y_DRIVER_TYPE TMC2130
62
 opt_set Y_DRIVER_TYPE TMC2130
63
 opt_set Z_DRIVER_TYPE TMC2130
63
 opt_set Z_DRIVER_TYPE TMC2130
64
-opt_enable AUTO_BED_LEVELING_BILINEAR EEPROM_SETTINGS EEPROM_CHITCHAT \
64
+opt_enable AUTO_BED_LEVELING_BILINEAR EEPROM_SETTINGS EEPROM_CHITCHAT MECHANICAL_GANTRY_CALIBRATION \
65
            TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z HYBRID_THRESHOLD \
65
            TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z HYBRID_THRESHOLD \
66
            SENSORLESS_PROBING Z_SAFE_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY TMC_DEBUG \
66
            SENSORLESS_PROBING Z_SAFE_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY TMC_DEBUG \
67
            EXPERIMENTAL_I2CBUS
67
            EXPERIMENTAL_I2CBUS

+ 2
- 0
platformio.ini View File

110
   -<src/gcode/bedlevel/G42.cpp>
110
   -<src/gcode/bedlevel/G42.cpp>
111
   -<src/gcode/bedlevel/M420.cpp>
111
   -<src/gcode/bedlevel/M420.cpp>
112
   -<src/gcode/calibrate/G33.cpp>
112
   -<src/gcode/calibrate/G33.cpp>
113
+  -<src/gcode/calibrate/G34.cpp>
113
   -<src/gcode/calibrate/G34_M422.cpp>
114
   -<src/gcode/calibrate/G34_M422.cpp>
114
   -<src/gcode/calibrate/G76_M192_M871.cpp>
115
   -<src/gcode/calibrate/G76_M192_M871.cpp>
115
   -<src/gcode/calibrate/G425.cpp>
116
   -<src/gcode/calibrate/G425.cpp>
309
 EXT_SOLENOID|MANUAL_SOLENOID_CONTROL = src_filter=+<src/feature/solenoid.cpp> +<src/gcode/control/M380_M381.cpp>
310
 EXT_SOLENOID|MANUAL_SOLENOID_CONTROL = src_filter=+<src/feature/solenoid.cpp> +<src/gcode/control/M380_M381.cpp>
310
 HAS_CUTTER              = src_filter=+<src/feature/spindle_laser.cpp> +<src/gcode/control/M3-M5.cpp>
311
 HAS_CUTTER              = src_filter=+<src/feature/spindle_laser.cpp> +<src/gcode/control/M3-M5.cpp>
311
 EXPERIMENTAL_I2CBUS     = src_filter=+<src/feature/twibus.cpp> +<src/gcode/feature/i2c>
312
 EXPERIMENTAL_I2CBUS     = src_filter=+<src/feature/twibus.cpp> +<src/gcode/feature/i2c>
313
+MECHANICAL_GANTRY_CAL.+ = src_filter=+<src/gcode/calibrate/G34.cpp>
312
 Z_STEPPER_AUTO_ALIGN    = src_filter=+<src/feature/z_stepper_align.cpp> +<src/gcode/calibrate/G34_M422.cpp>
314
 Z_STEPPER_AUTO_ALIGN    = src_filter=+<src/feature/z_stepper_align.cpp> +<src/gcode/calibrate/G34_M422.cpp>
313
 G26_MESH_VALIDATION     = src_filter=+<src/gcode/bedlevel/G26.cpp>
315
 G26_MESH_VALIDATION     = src_filter=+<src/gcode/bedlevel/G26.cpp>
314
 ASSISTED_TRAMMING       = src_filter=+<src/gcode/bedlevel/G35.cpp>
316
 ASSISTED_TRAMMING       = src_filter=+<src/gcode/bedlevel/G35.cpp>

Loading…
Cancel
Save