Browse Source

Add PROBE_MANUALLY support to G33

LVD-AC 7 years ago
parent
commit
3efe4aeef8
4 changed files with 81 additions and 50 deletions
  1. 53
    34
      Marlin/Marlin_main.cpp
  2. 4
    2
      Marlin/SanityCheck.h
  3. 20
    14
      Marlin/ultralcd.cpp
  4. 4
    0
      Marlin/ultralcd.h

+ 53
- 34
Marlin/Marlin_main.cpp View File

5127
 
5127
 
5128
   #endif // Z_PROBE_SLED
5128
   #endif // Z_PROBE_SLED
5129
 
5129
 
5130
+#endif // HAS_BED_PROBE
5131
+
5132
+#if PROBE_SELECTED
5133
+
5130
   #if ENABLED(DELTA_AUTO_CALIBRATION)
5134
   #if ENABLED(DELTA_AUTO_CALIBRATION)
5131
     /**
5135
     /**
5132
      * G33 - Delta '1-4-7-point' Auto-Calibration
5136
      * G33 - Delta '1-4-7-point' Auto-Calibration
5184
         return;
5188
         return;
5185
       }
5189
       }
5186
 
5190
 
5187
-      const int8_t force_iterations = parser.intval('F', 1);
5188
-      if (!WITHIN(force_iterations, 1, 30)) {
5189
-        SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (1-30).");
5191
+      const int8_t force_iterations = parser.intval('F', 0);
5192
+      if (!WITHIN(force_iterations, 0, 30)) {
5193
+        SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0-30).");
5190
         return;
5194
         return;
5191
       }
5195
       }
5192
 
5196
 
5221
             alpha_old = delta_tower_angle_trim[A_AXIS],
5225
             alpha_old = delta_tower_angle_trim[A_AXIS],
5222
             beta_old = delta_tower_angle_trim[B_AXIS];
5226
             beta_old = delta_tower_angle_trim[B_AXIS];
5223
 
5227
 
5224
-       if (!_1p_calibration) {  // test if the outer radius is reachable
5228
+      if (!_1p_calibration) {  // test if the outer radius is reachable
5225
         const float circles = (_7p_quadruple_circle ? 1.5 :
5229
         const float circles = (_7p_quadruple_circle ? 1.5 :
5226
                                _7p_triple_circle    ? 1.0 :
5230
                                _7p_triple_circle    ? 1.0 :
5227
                                _7p_double_circle    ? 0.5 : 0),
5231
                                _7p_double_circle    ? 0.5 : 0),
5273
         SERIAL_EOL();
5277
         SERIAL_EOL();
5274
       }
5278
       }
5275
 
5279
 
5276
-      home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
5280
+      #if DISABLED(PROBE_MANUALLY)
5281
+        home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
5282
+      #endif
5277
       
5283
       
5278
       do {
5284
       do {
5279
 
5285
 
5286
         // Probe the points
5292
         // Probe the points
5287
 
5293
 
5288
         if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
5294
         if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
5289
-          z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
5295
+          #if ENABLED(PROBE_MANUALLY)
5296
+            z_at_pt[0] += lcd_probe_pt(0, 0);
5297
+          #else
5298
+            z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
5299
+          #endif
5290
         }
5300
         }
5291
         if (_7p_calibration) { // probe extra center points
5301
         if (_7p_calibration) { // probe extra center points
5292
           for (int8_t axis = _7p_multi_circle ? 11 : 9; axis > 0; axis -= _7p_multi_circle ? 2 : 4) {
5302
           for (int8_t axis = _7p_multi_circle ? 11 : 9; axis > 0; axis -= _7p_multi_circle ? 2 : 4) {
5293
             const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1;
5303
             const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1;
5294
-            z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
5304
+            #if ENABLED(PROBE_MANUALLY)
5305
+              z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r);
5306
+            #else
5307
+              z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
5308
+            #endif
5295
           }
5309
           }
5296
           z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
5310
           z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
5297
         }
5311
         }
5307
             for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
5321
             for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
5308
               const float a = RADIANS(180 + 30 * axis),
5322
               const float a = RADIANS(180 + 30 * axis),
5309
                           r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
5323
                           r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
5310
-              z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
5324
+              #if ENABLED(PROBE_MANUALLY)
5325
+                z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r);
5326
+              #else
5327
+                z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
5328
+              #endif
5311
             }
5329
             }
5312
             zig_zag = !zig_zag;
5330
             zig_zag = !zig_zag;
5313
             z_at_pt[axis] /= (2 * offset_circles + 1);
5331
             z_at_pt[axis] /= (2 * offset_circles + 1);
5359
           #define Z0444(I) ZP(a_factor * 4.0 / 9.0, I)
5377
           #define Z0444(I) ZP(a_factor * 4.0 / 9.0, I)
5360
           #define Z0888(I) ZP(a_factor * 8.0 / 9.0, I)
5378
           #define Z0888(I) ZP(a_factor * 8.0 / 9.0, I)
5361
 
5379
 
5380
+          #if ENABLED(PROBE_MANUALLY)
5381
+            test_precision = 0.00; // forced end
5382
+          #endif
5383
+          
5362
           switch (probe_points) {
5384
           switch (probe_points) {
5363
             case 1:
5385
             case 1:
5364
-              test_precision = 0.00;
5386
+              test_precision = 0.00; // forced end
5365
               LOOP_XYZ(i) e_delta[i] = Z1000(0);
5387
               LOOP_XYZ(i) e_delta[i] = Z1000(0);
5366
               break;
5388
               break;
5367
 
5389
 
5437
             SERIAL_EOL();
5459
             SERIAL_EOL();
5438
           }
5460
           }
5439
         }
5461
         }
5440
-        if (test_precision != 0.0) {                                 // !forced end
5462
+        if (verbose_level != 0) {                                    // !dry run
5441
           if ((zero_std_dev >= test_precision || zero_std_dev <= calibration_precision) && iterations > force_iterations) {  // end iterations
5463
           if ((zero_std_dev >= test_precision || zero_std_dev <= calibration_precision) && iterations > force_iterations) {  // end iterations
5442
             SERIAL_PROTOCOLPGM("Calibration OK");
5464
             SERIAL_PROTOCOLPGM("Calibration OK");
5443
             SERIAL_PROTOCOL_SP(36);
5465
             SERIAL_PROTOCOL_SP(36);
5444
-            if (zero_std_dev >= test_precision)
5445
-              SERIAL_PROTOCOLPGM("rolling back.");
5446
-            else {
5447
-              SERIAL_PROTOCOLPGM("std dev:");
5448
-              SERIAL_PROTOCOL_F(zero_std_dev, 3);
5449
-            }
5466
+            #if DISABLED(PROBE_MANUALLY)
5467
+              if (zero_std_dev >= test_precision && !_1p_calibration)
5468
+                SERIAL_PROTOCOLPGM("rolling back.");
5469
+              else
5470
+            #endif
5471
+              {
5472
+                SERIAL_PROTOCOLPGM("std dev:");
5473
+                SERIAL_PROTOCOL_F(zero_std_dev, 3);
5474
+              }
5450
             SERIAL_EOL();
5475
             SERIAL_EOL();
5451
             LCD_MESSAGEPGM("Calibration OK"); // TODO: Make translatable string
5476
             LCD_MESSAGEPGM("Calibration OK"); // TODO: Make translatable string
5452
           }
5477
           }
5480
             serialprintPGM(save_message);
5505
             serialprintPGM(save_message);
5481
             SERIAL_EOL();
5506
             SERIAL_EOL();
5482
         }
5507
         }
5483
-        else {                                                       // forced end
5484
-          if (verbose_level == 0) {
5485
-            SERIAL_PROTOCOLPGM("End DRY-RUN");
5486
-            SERIAL_PROTOCOL_SP(39);
5487
-            SERIAL_PROTOCOLPGM("std dev:");
5488
-            SERIAL_PROTOCOL_F(zero_std_dev, 3);
5489
-            SERIAL_EOL();
5490
-          }
5491
-          else {
5492
-            SERIAL_PROTOCOLLNPGM("Calibration OK");
5493
-            LCD_MESSAGEPGM("Calibration OK"); // TODO: Make translatable string
5494
-            SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
5495
-            SERIAL_EOL();
5496
-            serialprintPGM(save_message);
5497
-            SERIAL_EOL();
5498
-          }
5508
+        else {                                                       // dry run
5509
+          SERIAL_PROTOCOLPGM("End DRY-RUN");
5510
+          SERIAL_PROTOCOL_SP(39);
5511
+          SERIAL_PROTOCOLPGM("std dev:");
5512
+          SERIAL_PROTOCOL_F(zero_std_dev, 3);
5513
+          SERIAL_EOL();
5499
         }
5514
         }
5500
 
5515
 
5501
         endstops.enable(true);
5516
         endstops.enable(true);
5517
 
5532
 
5518
   #endif // DELTA_AUTO_CALIBRATION
5533
   #endif // DELTA_AUTO_CALIBRATION
5519
 
5534
 
5520
-#endif // HAS_BED_PROBE
5535
+#endif // PROBE_SELECTED
5521
 
5536
 
5522
 #if ENABLED(G38_PROBE_TARGET)
5537
 #if ENABLED(G38_PROBE_TARGET)
5523
 
5538
 
10493
 
10508
 
10494
         #endif // Z_PROBE_SLED
10509
         #endif // Z_PROBE_SLED
10495
 
10510
 
10511
+      #endif // HAS_BED_PROBE
10512
+
10513
+      #if PROBE_SELECTED
10514
+
10496
         #if ENABLED(DELTA_AUTO_CALIBRATION)
10515
         #if ENABLED(DELTA_AUTO_CALIBRATION)
10497
 
10516
 
10498
           case 33: // G33: Delta Auto-Calibration
10517
           case 33: // G33: Delta Auto-Calibration
10501
 
10520
 
10502
         #endif // DELTA_AUTO_CALIBRATION
10521
         #endif // DELTA_AUTO_CALIBRATION
10503
 
10522
 
10504
-      #endif // HAS_BED_PROBE
10523
+      #endif // PROBE_SELECTED
10505
 
10524
 
10506
       #if ENABLED(G38_PROBE_TARGET)
10525
       #if ENABLED(G38_PROBE_TARGET)
10507
         case 38: // G38.2 & G38.3
10526
         case 38: // G38.2 & G38.3

+ 4
- 2
Marlin/SanityCheck.h View File

480
     #error "You probably want to use Max Endstops for DELTA!"
480
     #error "You probably want to use Max Endstops for DELTA!"
481
   #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_DELTA
481
   #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_DELTA
482
     #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL."
482
     #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL."
483
-  #elif ENABLED(DELTA_AUTO_CALIBRATION) && !HAS_BED_PROBE
484
-    #error "DELTA_AUTO_CALIBRATION requires a probe: FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
483
+  #elif ENABLED(DELTA_AUTO_CALIBRATION) && !PROBE_SELECTED
484
+    #error "DELTA_AUTO_CALIBRATION requires a probe: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, Z Servo."
485
+  #elif ENABLED(DELTA_AUTO_CALIBRATION) && ENABLED(PROBE_MANUALLY) && DISABLED(ULTIPANEL)
486
+    #error "DELTA_AUTO_CALIBRATION requires an LCD controller with PROBE_MANUALLY."
485
   #elif ABL_GRID
487
   #elif ABL_GRID
486
     #if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0
488
     #if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0
487
       #error "DELTA requires GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y to be odd numbers."
489
       #error "DELTA requires GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y to be odd numbers."

+ 20
- 14
Marlin/ultralcd.cpp View File

2486
       lcd_goto_screen(_lcd_calibrate_homing);
2486
       lcd_goto_screen(_lcd_calibrate_homing);
2487
     }
2487
     }
2488
 
2488
 
2489
-    // Move directly to the tower position with uninterpolated moves
2490
-    // If we used interpolated moves it would cause this to become re-entrant
2491
-    void _goto_tower_pos(const float &a) {
2489
+    void _man_probe_pt(const float &lx, const float &ly) {
2492
       #if HAS_LEVELING
2490
       #if HAS_LEVELING
2493
         reset_bed_level(); // After calibration bed-level data is no longer valid
2491
         reset_bed_level(); // After calibration bed-level data is no longer valid
2494
       #endif
2492
       #endif
2495
 
2493
 
2496
-      line_to_z(max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
2497
-
2498
-      current_position[X_AXIS] = a < 0 ? LOGICAL_X_POSITION(X_HOME_POS) : cos(RADIANS(a)) * delta_calibration_radius;
2499
-      current_position[Y_AXIS] = a < 0 ? LOGICAL_Y_POSITION(Y_HOME_POS) : sin(RADIANS(a)) * delta_calibration_radius;
2494
+      float z_dest = LOGICAL_Z_POSITION((Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
2495
+      line_to_z(z_dest);
2496
+      current_position[X_AXIS] = LOGICAL_X_POSITION(lx);
2497
+      current_position[Y_AXIS] = LOGICAL_Y_POSITION(ly);
2500
       line_to_current_z();
2498
       line_to_current_z();
2501
-
2502
-      line_to_z(4.0);
2499
+      z_dest = LOGICAL_Z_POSITION(Z_CLEARANCE_BETWEEN_PROBES);
2500
+      line_to_z(z_dest);
2503
 
2501
 
2504
       lcd_synchronize();
2502
       lcd_synchronize();
2505
-
2506
       move_menu_scale = 0.1;
2503
       move_menu_scale = 0.1;
2507
       lcd_goto_screen(lcd_move_z);
2504
       lcd_goto_screen(lcd_move_z);
2508
     }
2505
     }
2509
 
2506
 
2510
-    void _goto_tower_x() { _goto_tower_pos(210); }
2511
-    void _goto_tower_y() { _goto_tower_pos(330); }
2512
-    void _goto_tower_z() { _goto_tower_pos(90); }
2513
-    void _goto_center()  { _goto_tower_pos(-1); }
2507
+    float lcd_probe_pt(const float &lx, const float &ly) {
2508
+      _man_probe_pt(lx, ly);
2509
+      KEEPALIVE_STATE(PAUSED_FOR_USER);
2510
+      wait_for_user = true;
2511
+      while (wait_for_user) idle();
2512
+      KEEPALIVE_STATE(IN_HANDLER);
2513
+      return current_position[Z_AXIS];
2514
+    }
2515
+
2516
+    void _goto_tower_x() { _man_probe_pt(cos(RADIANS(210)) * delta_calibration_radius, sin(RADIANS(210)) * delta_calibration_radius); }
2517
+    void _goto_tower_y() { _man_probe_pt(cos(RADIANS(330)) * delta_calibration_radius, sin(RADIANS(330)) * delta_calibration_radius); }
2518
+    void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); }
2519
+    void _goto_center()  { _man_probe_pt(0,0); }
2514
 
2520
 
2515
     void lcd_delta_calibrate_menu() {
2521
     void lcd_delta_calibrate_menu() {
2516
       START_MENU();
2522
       START_MENU();

+ 4
- 0
Marlin/ultralcd.h View File

197
   float lcd_z_offset_edit();
197
   float lcd_z_offset_edit();
198
 #endif
198
 #endif
199
 
199
 
200
+#if ENABLED(DELTA_CALIBRATION_MENU)
201
+  float lcd_probe_pt(const float &lx, const float &ly);
202
+#endif
203
+
200
 #endif // ULTRALCD_H
204
 #endif // ULTRALCD_H

Loading…
Cancel
Save