Browse Source

UBL: Minor improvement to G29 P2

- allow H code value to override probing height
- minor cleanups
Brian 8 years ago
parent
commit
5a5dba6fc8
1 changed files with 23 additions and 22 deletions
  1. 23
    22
      Marlin/ubl_G29.cpp

+ 23
- 22
Marlin/ubl_G29.cpp View File

@@ -448,7 +448,7 @@
448 448
             y_pos = current_position[Y_AXIS];
449 449
           }
450 450
 
451
-          float height = code_seen('H') && code_has_value() ? code_value_float() : Z_CLEARANCE_BETWEEN_PROBES;
451
+          float height = Z_CLEARANCE_BETWEEN_PROBES;
452 452
 
453 453
           if (code_seen('B')) {
454 454
             card_thickness = code_has_value() ? code_value_float() : measure_business_card_thickness(height);
@@ -458,9 +458,11 @@
458 458
               return;
459 459
             }
460 460
           }
461
+
462
+          if (code_seen('H') && code_has_value()) height = code_value_float();
463
+
461 464
           manually_probe_remaining_mesh(x_pos, y_pos, height, card_thickness, code_seen('O') || code_seen('M'));
462 465
           SERIAL_PROTOCOLLNPGM("G29 P2 finished.");
463
-
464 466
         } break;
465 467
 
466 468
         case 3: {
@@ -887,9 +889,9 @@
887 889
     do_blocking_move_to_z(in_height);
888 890
     do_blocking_move_to_xy(0.5 * (UBL_MESH_MAX_X - (UBL_MESH_MIN_X)), 0.5 * (UBL_MESH_MAX_Y - (UBL_MESH_MIN_Y)));
889 891
       //, min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]) / 2.0);
890
-
891 892
     stepper.synchronize();
892
-    SERIAL_PROTOCOLPGM("Place shim under nozzle.");
893
+
894
+    SERIAL_PROTOCOLPGM("Place shim under nozzle");
893 895
     LCD_MESSAGEPGM("Place shim & measure");
894 896
     lcd_goto_screen(lcd_status_screen);
895 897
     say_and_take_a_measurement();
@@ -898,35 +900,39 @@
898 900
     do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
899 901
     stepper.synchronize();
900 902
 
901
-    SERIAL_PROTOCOLPGM("Remove shim.");
902
-    LCD_MESSAGEPGM("Remove & measure");
903
- 
903
+    SERIAL_PROTOCOLPGM("Remove shim");
904
+    LCD_MESSAGEPGM("Remove & measure bed");
904 905
     say_and_take_a_measurement();
905 906
 
906 907
     const float z2 = use_encoder_wheel_to_measure_point();
908
+
907 909
     do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES);
908 910
 
911
+    const float thickness = abs(z1 - z2);
912
+
909 913
     if (g29_verbose_level > 1) {
910
-      SERIAL_PROTOCOLPGM("Business Card is: ");
911
-      SERIAL_PROTOCOL_F(abs(z1 - z2), 6);
914
+      SERIAL_PROTOCOLPGM("Business Card is ");
915
+      SERIAL_PROTOCOL_F(thickness, 4);
912 916
       SERIAL_PROTOCOLLNPGM("mm thick.");
913 917
     }
918
+
914 919
     in_height = current_position[Z_AXIS]; // do manual probing at lower height
920
+
915 921
     ubl.has_control_of_lcd_panel = false;
916 922
 
917 923
     ubl.restore_ubl_active_state_and_leave();
918
-    return abs(z1 - z2);
924
+
925
+    return thickness;
919 926
   }
920 927
 
921 928
   void manually_probe_remaining_mesh(const float &lx, const float &ly, float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) {
922 929
 
923 930
     ubl.has_control_of_lcd_panel = true;
924 931
     ubl.save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
925
-    do_blocking_move_to_z(z_clearance);
932
+    do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
926 933
     do_blocking_move_to_xy(lx, ly);
927 934
 
928 935
     lcd_goto_screen(lcd_status_screen);
929
-    float last_x = -9999.99, last_y = -9999.99;
930 936
     mesh_index_pair location;
931 937
     do {
932 938
       location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_NOZZLE_AS_REFERENCE, NULL, false);
@@ -945,25 +951,20 @@
945 951
       }
946 952
 
947 953
       const float xProbe = LOGICAL_X_POSITION(rawx),
948
-                  yProbe = LOGICAL_Y_POSITION(rawy),
949
-                  dx = xProbe - last_x,
950
-                  dy = yProbe - last_y;
954
+                  yProbe = LOGICAL_Y_POSITION(rawy);
955
+
956
+      do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
951 957
 
952
-      if (HYPOT(dx, dy) < BIG_RAISE_NOT_NEEDED)
953
-        do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
954
-      else
955
-        do_blocking_move_to_z(z_clearance);
956 958
       LCD_MESSAGEPGM("Moving to next");
957 959
 
958 960
       do_blocking_move_to_xy(xProbe, yProbe);
959
-
960
-      last_x = xProbe;
961
-      last_y = yProbe;
961
+      do_blocking_move_to_z(z_clearance);
962 962
 
963 963
       KEEPALIVE_STATE(PAUSED_FOR_USER);
964 964
       ubl.has_control_of_lcd_panel = true;
965 965
 
966 966
       if (do_ubl_mesh_map) ubl.display_map(map_type);  // show user where we're probing
967
+
967 968
       if (code_seen('B')) {LCD_MESSAGEPGM("Place shim & measure");}
968 969
       else {LCD_MESSAGEPGM("Measure");}
969 970
 

Loading…
Cancel
Save