Преглед на файлове

Tweak G34, fix a declaration

Scott Lahteine преди 4 години
родител
ревизия
0400783444
променени са 1 файла, в които са добавени 17 реда и са изтрити 14 реда
  1. 17
    14
      Marlin/src/gcode/calibrate/G34_M422.cpp

+ 17
- 14
Marlin/src/gcode/calibrate/G34_M422.cpp Целия файл

@@ -61,13 +61,16 @@ constexpr xy_pos_t sanity_arr_z_align[] = Z_STEPPER_ALIGN_XY;
61 61
   );
62 62
 #endif
63 63
 
64
-static xy_pos_t z_auto_align_pos[Z_STEPPER_COUNT] = Z_STEPPER_ALIGN_XY;
64
+//
65
+// G34 / M422 shared data
66
+//
67
+static xy_pos_t z_stepper_align_pos[] = Z_STEPPER_ALIGN_XY;
65 68
 
66 69
 #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
67
-  static xy_pos_t z_stepper_pos[] = Z_STEPPER_ALIGN_STEPPER_XY;
70
+  static xy_pos_t z_stepper_align_stepper_pos[] = Z_STEPPER_ALIGN_STEPPER_XY;
68 71
 #endif
69 72
 
70
-#define G34_PROBE_COUNT COUNT(z_auto_align_pos)
73
+#define G34_PROBE_COUNT COUNT(z_stepper_align_pos)
71 74
 
72 75
 inline void set_all_z_lock(const bool lock) {
73 76
   stepper.set_z_lock(lock);
@@ -155,11 +158,11 @@ void GcodeSuite::G34() {
155 158
     // iteration this will be re-calculated based on the actual bed position
156 159
     float z_probe = Z_BASIC_CLEARANCE + (G34_MAX_GRADE) * 0.01f * (
157 160
       #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
158
-         SQRT(_MAX(HYPOT2(z_auto_align_pos[0].x - z_auto_align_pos[0].y, z_auto_align_pos[1].x - z_auto_align_pos[1].y),
159
-                   HYPOT2(z_auto_align_pos[1].x - z_auto_align_pos[1].y, z_auto_align_pos[2].x - z_auto_align_pos[2].y),
160
-                   HYPOT2(z_auto_align_pos[2].x - z_auto_align_pos[2].y, z_auto_align_pos[0].x - z_auto_align_pos[0].y)))
161
+         SQRT(_MAX(HYPOT2(z_stepper_align_pos[0].x - z_stepper_align_pos[0].y, z_stepper_align_pos[1].x - z_stepper_align_pos[1].y),
162
+                   HYPOT2(z_stepper_align_pos[1].x - z_stepper_align_pos[1].y, z_stepper_align_pos[2].x - z_stepper_align_pos[2].y),
163
+                   HYPOT2(z_stepper_align_pos[2].x - z_stepper_align_pos[2].y, z_stepper_align_pos[0].x - z_stepper_align_pos[0].y)))
161 164
       #else
162
-         HYPOT(z_auto_align_pos[0].x - z_auto_align_pos[0].y, z_auto_align_pos[1].x - z_auto_align_pos[1].y)
165
+         HYPOT(z_stepper_align_pos[0].x - z_stepper_align_pos[0].y, z_stepper_align_pos[1].x - z_stepper_align_pos[1].y)
163 166
       #endif
164 167
     );
165 168
 
@@ -194,7 +197,7 @@ void GcodeSuite::G34() {
194 197
         if (iteration == 0 || i > 0) do_blocking_move_to_z(z_probe);
195 198
 
196 199
         // Probe a Z height for each stepper.
197
-        const float z_probed_height = probe_at_point(z_auto_align_pos[iprobe], raise_after, 0, true);
200
+        const float z_probed_height = probe_at_point(z_stepper_align_pos[iprobe], raise_after, 0, true);
198 201
         if (isnan(z_probed_height)) {
199 202
           SERIAL_ECHOLNPGM("Probing failed.");
200 203
           err_break = true;
@@ -235,13 +238,13 @@ void GcodeSuite::G34() {
235 238
         incremental_LSF_reset(&lfd);
236 239
         for (uint8_t i = 0; i < G34_PROBE_COUNT; ++i) {
237 240
           SERIAL_ECHOLNPAIR("PROBEPT_", int(i + 1), ": ", z_measured[i]);
238
-          incremental_LSF(&lfd, z_auto_align_pos[i], z_measured[i]);
241
+          incremental_LSF(&lfd, z_stepper_align_pos[i], z_measured[i]);
239 242
         }
240 243
         finish_incremental_LSF(&lfd);
241 244
 
242 245
         z_measured_min = 100000.0f;
243 246
         for (uint8_t i = 0; i < Z_STEPPER_COUNT; ++i) {
244
-          z_measured[i] = -(lfd.A * z_stepper_pos[i].x + lfd.B * z_stepper_pos[i].y);
247
+          z_measured[i] = -(lfd.A * z_stepper_align_stepper_pos[i].x + lfd.B * z_stepper_align_stepper_pos[i].y);
245 248
           z_measured_min = _MIN(z_measured_min, z_measured[i]);
246 249
         }
247 250
 
@@ -362,10 +365,10 @@ void GcodeSuite::G34() {
362 365
 void GcodeSuite::M422() {
363 366
   if (!parser.seen_any()) {
364 367
     for (uint8_t i = 0; i < G34_PROBE_COUNT; ++i)
365
-      SERIAL_ECHOLNPAIR_P(PSTR("M422 S"), i + 1, SP_X_STR, z_auto_align_pos[i].x, SP_Y_STR, z_auto_align_pos[i].y);
368
+      SERIAL_ECHOLNPAIR_P(PSTR("M422 S"), i + 1, SP_X_STR, z_stepper_align_pos[i].x, SP_Y_STR, z_stepper_align_pos[i].y);
366 369
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
367 370
       for (uint8_t i = 0; i < Z_STEPPER_COUNT; ++i)
368
-        SERIAL_ECHOLNPAIR_P(PSTR("M422 W"), i + 1, SP_X_STR, z_stepper_pos[i].x, SP_Y_STR, z_stepper_pos[i].y);
371
+        SERIAL_ECHOLNPAIR_P(PSTR("M422 W"), i + 1, SP_X_STR, z_stepper_align_stepper_pos[i].x, SP_Y_STR, z_stepper_align_stepper_pos[i].y);
369 372
     #endif
370 373
     return;
371 374
   }
@@ -381,9 +384,9 @@ void GcodeSuite::M422() {
381 384
 
382 385
   xy_pos_t *pos_dest = (
383 386
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
384
-      !is_probe_point ? z_stepper_pos :
387
+      !is_probe_point ? z_stepper_align_stepper_pos :
385 388
     #endif
386
-    z_auto_align_pos
389
+    z_stepper_align_pos
387 390
   );
388 391
 
389 392
   if (!is_probe_point

Loading…
Отказ
Запис