Browse Source

Merge pull request #6694 from bgort/g29p2b

UBL:  Minor improvement to G29 P2
bgort 8 years ago
parent
commit
445003dbb8
1 changed files with 23 additions and 22 deletions
  1. 23
    22
      Marlin/ubl_G29.cpp

+ 23
- 22
Marlin/ubl_G29.cpp View File

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

Loading…
Cancel
Save