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

Loading…
Cancel
Save