Преглед изворни кода

Merge pull request #6764 from thinkyhead/bf_cleanups_tuesday

Prevent home_all_axes picking up XYZ parameters from command
Scott Lahteine пре 7 година
родитељ
комит
455a24f6ff

+ 1
- 1
Marlin/Conditionals_post.h Прегледај датотеку

@@ -834,7 +834,7 @@
834 834
       #define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS
835 835
     #endif
836 836
   #endif
837
-    
837
+
838 838
   // Shorthand
839 839
   #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
840 840
 

+ 16
- 14
Marlin/Marlin_main.cpp Прегледај датотеку

@@ -3713,7 +3713,7 @@ inline void gcode_G4() {
3713 3713
  *  Z   Home to the Z endstop
3714 3714
  *
3715 3715
  */
3716
-inline void gcode_G28() {
3716
+inline void gcode_G28(const bool always_home_all) {
3717 3717
 
3718 3718
   #if ENABLED(DEBUG_LEVELING_FEATURE)
3719 3719
     if (DEBUGGING(LEVELING)) {
@@ -3760,14 +3760,16 @@ inline void gcode_G28() {
3760 3760
 
3761 3761
   #else // NOT DELTA
3762 3762
 
3763
-    const bool homeX = code_seen('X'), homeY = code_seen('Y'), homeZ = code_seen('Z'),
3764
-               home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
3763
+    const bool homeX = always_home_all || code_seen('X'),
3764
+               homeY = always_home_all || code_seen('Y'),
3765
+               homeZ = always_home_all || code_seen('Z'),
3766
+               home_all = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
3765 3767
 
3766 3768
     set_destination_to_current();
3767 3769
 
3768 3770
     #if Z_HOME_DIR > 0  // If homing away from BED do Z first
3769 3771
 
3770
-      if (home_all_axis || homeZ) {
3772
+      if (home_all || homeZ) {
3771 3773
         HOMEAXIS(Z);
3772 3774
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3773 3775
           if (DEBUGGING(LEVELING)) DEBUG_POS("> HOMEAXIS(Z)", current_position);
@@ -3776,7 +3778,7 @@ inline void gcode_G28() {
3776 3778
 
3777 3779
     #else
3778 3780
 
3779
-      if (home_all_axis || homeX || homeY) {
3781
+      if (home_all || homeX || homeY) {
3780 3782
         // Raise Z before homing any other axes and z is not already high enough (never lower z)
3781 3783
         destination[Z_AXIS] = LOGICAL_Z_POSITION(Z_HOMING_HEIGHT);
3782 3784
         if (destination[Z_AXIS] > current_position[Z_AXIS]) {
@@ -3794,14 +3796,14 @@ inline void gcode_G28() {
3794 3796
 
3795 3797
     #if ENABLED(QUICK_HOME)
3796 3798
 
3797
-      if (home_all_axis || (homeX && homeY)) quick_home_xy();
3799
+      if (home_all || (homeX && homeY)) quick_home_xy();
3798 3800
 
3799 3801
     #endif
3800 3802
 
3801 3803
     #if ENABLED(HOME_Y_BEFORE_X)
3802 3804
 
3803 3805
       // Home Y
3804
-      if (home_all_axis || homeY) {
3806
+      if (home_all || homeY) {
3805 3807
         HOMEAXIS(Y);
3806 3808
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3807 3809
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
@@ -3811,7 +3813,7 @@ inline void gcode_G28() {
3811 3813
     #endif
3812 3814
 
3813 3815
     // Home X
3814
-    if (home_all_axis || homeX) {
3816
+    if (home_all || homeX) {
3815 3817
 
3816 3818
       #if ENABLED(DUAL_X_CARRIAGE)
3817 3819
 
@@ -3844,7 +3846,7 @@ inline void gcode_G28() {
3844 3846
 
3845 3847
     #if DISABLED(HOME_Y_BEFORE_X)
3846 3848
       // Home Y
3847
-      if (home_all_axis || homeY) {
3849
+      if (home_all || homeY) {
3848 3850
         HOMEAXIS(Y);
3849 3851
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3850 3852
           if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
@@ -3854,16 +3856,16 @@ inline void gcode_G28() {
3854 3856
 
3855 3857
     // Home Z last if homing towards the bed
3856 3858
     #if Z_HOME_DIR < 0
3857
-      if (home_all_axis || homeZ) {
3859
+      if (home_all || homeZ) {
3858 3860
         #if ENABLED(Z_SAFE_HOMING)
3859 3861
           home_z_safely();
3860 3862
         #else
3861 3863
           HOMEAXIS(Z);
3862 3864
         #endif
3863 3865
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3864
-          if (DEBUGGING(LEVELING)) DEBUG_POS("> (home_all_axis || homeZ) > final", current_position);
3866
+          if (DEBUGGING(LEVELING)) DEBUG_POS("> (home_all || homeZ) > final", current_position);
3865 3867
         #endif
3866
-      } // home_all_axis || homeZ
3868
+      } // home_all || homeZ
3867 3869
     #endif // Z_HOME_DIR < 0
3868 3870
 
3869 3871
     SYNC_PLAN_POSITION_KINEMATIC();
@@ -3895,7 +3897,7 @@ inline void gcode_G28() {
3895 3897
   #endif
3896 3898
 } // G28
3897 3899
 
3898
-void home_all_axes() { gcode_G28(); }
3900
+void home_all_axes() { gcode_G28(true); }
3899 3901
 
3900 3902
 #if HAS_PROBING_PROCEDURE
3901 3903
 
@@ -9858,7 +9860,7 @@ void process_next_command() {
9858 9860
       #endif // NOZZLE_PARK_FEATURE
9859 9861
 
9860 9862
       case 28: // G28: Home all axes, one at a time
9861
-        gcode_G28();
9863
+        gcode_G28(false);
9862 9864
         break;
9863 9865
 
9864 9866
       #if HAS_LEVELING

+ 2
- 2
Marlin/example_configurations/delta/generic/Configuration.h Прегледај датотеку

@@ -922,10 +922,10 @@
922 922
   // at which point movement will be level to the machine's XY plane.
923 923
   // The height can be set with M420 Z<height>
924 924
   //#define ENABLE_LEVELING_FADE_HEIGHT
925
-  
925
+
926 926
   // Set the boundaries for probing (where the probe can reach).
927 927
   #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
928
-         
928
+
929 929
 #endif
930 930
 
931 931
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

+ 2
- 2
Marlin/example_configurations/delta/kossel_mini/Configuration.h Прегледај датотеку

@@ -920,10 +920,10 @@
920 920
   // at which point movement will be level to the machine's XY plane.
921 921
   // The height can be set with M420 Z<height>
922 922
   //#define ENABLE_LEVELING_FADE_HEIGHT
923
-  
923
+
924 924
   // Set the boundaries for probing (where the probe can reach).
925 925
   #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
926
-         
926
+
927 927
 #endif
928 928
 
929 929
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

+ 2
- 2
Marlin/example_configurations/delta/kossel_pro/Configuration.h Прегледај датотеку

@@ -926,10 +926,10 @@
926 926
   // at which point movement will be level to the machine's XY plane.
927 927
   // The height can be set with M420 Z<height>
928 928
   //#define ENABLE_LEVELING_FADE_HEIGHT
929
-  
929
+
930 930
   // Set the boundaries for probing (where the probe can reach).
931 931
   #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
932
-         
932
+
933 933
 #endif
934 934
 
935 935
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

+ 2
- 2
Marlin/example_configurations/delta/kossel_xl/Configuration.h Прегледај датотеку

@@ -989,10 +989,10 @@
989 989
   // at which point movement will be level to the machine's XY plane.
990 990
   // The height can be set with M420 Z<height>
991 991
   //#define ENABLE_LEVELING_FADE_HEIGHT
992
-  
992
+
993 993
   // Set the boundaries for probing (where the probe can reach).
994 994
   #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
995
-         
995
+
996 996
 #endif
997 997
 
998 998
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

+ 8
- 18
Marlin/ubl_G29.cpp Прегледај датотеку

@@ -322,17 +322,15 @@
322 322
 
323 323
     // Check for commands that require the printer to be homed.
324 324
     if (axis_unhomed_error()) {
325
-      if (code_seen('J')) 
325
+      if (code_seen('J'))
326 326
         home_all_axes();
327
-      else
328
-        if (code_seen('P')) {
329
-          int p_val;
330
-	  if (code_has_value()) {
331
-            p_val = code_value_int();
332
-	    if ( p_val==1 || p_val==2 || p_val==4 )
333
-              home_all_axes();
334
-	  }
327
+      else if (code_seen('P')) {
328
+        if (code_has_value()) {
329
+          const int p_val = code_value_int();
330
+          if (p_val == 1 || p_val == 2 || p_val == 4)
331
+            home_all_axes();
335 332
         }
333
+      }
336 334
     }
337 335
 
338 336
     if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
@@ -1341,15 +1339,7 @@
1341 1339
           // Also for round beds, there are grid points outside the bed that nozzle can't reach.
1342 1340
           // Prune them from the list and ignore them till the next Phase (manual nozzle probing).
1343 1341
 
1344
-//        if ((probe_as_reference && position_is_reachable_by_probe_raw_xy(mx, my)) || position_is_reachable_raw_xy(mx, my))
1345
-//          continue;
1346
-//
1347
-//        THE ABOVE CODE IS NOT A REPLACEMENT FOR THE CODE BELOW!!!!!!!
1348
-//
1349
-          bool reachable = probe_as_reference ?
1350
-                             position_is_reachable_by_probe_raw_xy( mx, my ) :
1351
-                             position_is_reachable_raw_xy( mx, my );
1352
-          if ( ! reachable )
1342
+          if ( ! (probe_as_reference ? position_is_reachable_by_probe_raw_xy(mx, my) : position_is_reachable_raw_xy(mx, my)) )
1353 1343
             continue;
1354 1344
 
1355 1345
           // Reachable. Check if it's the closest location to the nozzle.

+ 2
- 2
Marlin/ubl_motion.cpp Прегледај датотеку

@@ -632,7 +632,7 @@
632 632
                     z_cxyd = z_cxy1 - z_cxy0;                 // z height difference along cx from y0 to y1
633 633
 
634 634
               float z_cxym = z_cxyd * (1.0 / (MESH_Y_DIST));  // z slope per y along cx from y0 to y1
635
-        
635
+
636 636
         //    float z_cxcy = z_cxy0 + z_cxym * cy;            // interpolated mesh z height along cx at cy (do inside the segment loop)
637 637
 
638 638
         // As subsequent segments step through this cell, the z_cxy0 intercept will change
@@ -649,7 +649,7 @@
649 649
           #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
650 650
             z_cxcy *= fade_scaling_factor;          // apply fade factor to interpolated mesh height
651 651
           #endif
652
-        
652
+
653 653
           z_cxcy += ubl.state.z_offset;             // add fixed mesh offset from G29 Z
654 654
 
655 655
           if (--segments == 0) {                    // if this is last segment, use ltarget for exact

Loading…
Откажи
Сачувај