Przeglądaj źródła

Tweak G34, fix a declaration

Scott Lahteine 4 lat temu
rodzic
commit
0400783444
1 zmienionych plików z 17 dodań i 14 usunięć
  1. 17
    14
      Marlin/src/gcode/calibrate/G34_M422.cpp

+ 17
- 14
Marlin/src/gcode/calibrate/G34_M422.cpp Wyświetl plik

61
   );
61
   );
62
 #endif
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
 #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
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
 #endif
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
 inline void set_all_z_lock(const bool lock) {
75
 inline void set_all_z_lock(const bool lock) {
73
   stepper.set_z_lock(lock);
76
   stepper.set_z_lock(lock);
155
     // iteration this will be re-calculated based on the actual bed position
158
     // iteration this will be re-calculated based on the actual bed position
156
     float z_probe = Z_BASIC_CLEARANCE + (G34_MAX_GRADE) * 0.01f * (
159
     float z_probe = Z_BASIC_CLEARANCE + (G34_MAX_GRADE) * 0.01f * (
157
       #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
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
       #else
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
       #endif
166
       #endif
164
     );
167
     );
165
 
168
 
194
         if (iteration == 0 || i > 0) do_blocking_move_to_z(z_probe);
197
         if (iteration == 0 || i > 0) do_blocking_move_to_z(z_probe);
195
 
198
 
196
         // Probe a Z height for each stepper.
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
         if (isnan(z_probed_height)) {
201
         if (isnan(z_probed_height)) {
199
           SERIAL_ECHOLNPGM("Probing failed.");
202
           SERIAL_ECHOLNPGM("Probing failed.");
200
           err_break = true;
203
           err_break = true;
235
         incremental_LSF_reset(&lfd);
238
         incremental_LSF_reset(&lfd);
236
         for (uint8_t i = 0; i < G34_PROBE_COUNT; ++i) {
239
         for (uint8_t i = 0; i < G34_PROBE_COUNT; ++i) {
237
           SERIAL_ECHOLNPAIR("PROBEPT_", int(i + 1), ": ", z_measured[i]);
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
         finish_incremental_LSF(&lfd);
243
         finish_incremental_LSF(&lfd);
241
 
244
 
242
         z_measured_min = 100000.0f;
245
         z_measured_min = 100000.0f;
243
         for (uint8_t i = 0; i < Z_STEPPER_COUNT; ++i) {
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
           z_measured_min = _MIN(z_measured_min, z_measured[i]);
248
           z_measured_min = _MIN(z_measured_min, z_measured[i]);
246
         }
249
         }
247
 
250
 
362
 void GcodeSuite::M422() {
365
 void GcodeSuite::M422() {
363
   if (!parser.seen_any()) {
366
   if (!parser.seen_any()) {
364
     for (uint8_t i = 0; i < G34_PROBE_COUNT; ++i)
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
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
369
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
367
       for (uint8_t i = 0; i < Z_STEPPER_COUNT; ++i)
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
     #endif
372
     #endif
370
     return;
373
     return;
371
   }
374
   }
381
 
384
 
382
   xy_pos_t *pos_dest = (
385
   xy_pos_t *pos_dest = (
383
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
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
     #endif
388
     #endif
386
-    z_auto_align_pos
389
+    z_stepper_align_pos
387
   );
390
   );
388
 
391
 
389
   if (!is_probe_point
392
   if (!is_probe_point

Ładowanie…
Anuluj
Zapisz