Browse Source

Merge pull request #1349 from msutas/patch-2

Improvement - G29 Option for Not Retracting Servo
Bo Herrmannsen 10 years ago
parent
commit
5151db5c2f
1 changed files with 45 additions and 13 deletions
  1. 45
    13
      Marlin/Marlin_main.cpp

+ 45
- 13
Marlin/Marlin_main.cpp View File

@@ -1150,18 +1150,20 @@ static void retract_z_probe() {
1150 1150
 }
1151 1151
 
1152 1152
 /// Probe bed height at position (x,y), returns the measured z value
1153
-static float probe_pt(float x, float y, float z_before) {
1153
+static float probe_pt(float x, float y, float z_before, int retract_action=0) {
1154 1154
   // move to right place
1155 1155
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
1156 1156
   do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1157 1157
 
1158 1158
 #ifndef Z_PROBE_SLED
1159
-  engage_z_probe();   // Engage Z Servo endstop if available
1159
+   if ((retract_action==0) || (retract_action==1)) 
1160
+     engage_z_probe();   // Engage Z Servo endstop if available
1160 1161
 #endif // Z_PROBE_SLED
1161 1162
   run_z_probe();
1162 1163
   float measured_z = current_position[Z_AXIS];
1163 1164
 #ifndef Z_PROBE_SLED
1164
-  retract_z_probe();
1165
+  if ((retract_action==0) || (retract_action==3)) 
1166
+     retract_z_probe();
1165 1167
 #endif // Z_PROBE_SLED
1166 1168
 
1167 1169
   SERIAL_PROTOCOLPGM(MSG_BED);
@@ -1750,7 +1752,22 @@ void process_commands()
1750 1752
                   z_before = current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
1751 1753
                 }
1752 1754
 
1753
-                float measured_z = probe_pt(xProbe, yProbe, z_before);
1755
+                float measured_z;
1756
+                //Enhanced G29 - Do not retract servo between probes
1757
+                if (code_seen('E') || code_seen('e') )
1758
+                   {
1759
+                   if ((yProbe==FRONT_PROBE_BED_POSITION) && (xCount==0))
1760
+                       {
1761
+                        measured_z = probe_pt(xProbe, yProbe, z_before,1);
1762
+                       } else if ((yProbe==FRONT_PROBE_BED_POSITION + (yGridSpacing * (AUTO_BED_LEVELING_GRID_POINTS-1))) && (xCount == AUTO_BED_LEVELING_GRID_POINTS-1))
1763
+                         {
1764
+                         measured_z = probe_pt(xProbe, yProbe, z_before,3);
1765
+                         } else {
1766
+                           measured_z = probe_pt(xProbe, yProbe, z_before,2);
1767
+                         }
1768
+                    } else {
1769
+                    measured_z = probe_pt(xProbe, yProbe, z_before);
1770
+                    }
1754 1771
 
1755 1772
                 eqnBVector[probePointCounter] = measured_z;
1756 1773
 
@@ -1781,15 +1798,30 @@ void process_commands()
1781 1798
 #else // AUTO_BED_LEVELING_GRID not defined
1782 1799
 
1783 1800
             // Probe at 3 arbitrary points
1784
-            // probe 1
1785
-            float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
1786
-
1787
-            // probe 2
1788
-            float z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1789
-
1790
-            // probe 3
1791
-            float z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1792
-
1801
+            // Enhanced G29
1802
+            
1803
+            float z_at_pt_1,z_at_pt_2,z_at_pt_3;
1804
+            
1805
+            if (code_seen('E') || code_seen('e') )
1806
+               {
1807
+               // probe 1               
1808
+                z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING,1);
1809
+               // probe 2
1810
+                z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,2);
1811
+               // probe 3
1812
+                z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,3); 
1813
+               }
1814
+               else 
1815
+               {
1816
+	        // probe 1
1817
+	        float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
1818
+
1819
+                // probe 2
1820
+                float z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1821
+
1822
+                // probe 3
1823
+                float z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1824
+               }
1793 1825
             clean_up_after_endstop_move();
1794 1826
 
1795 1827
             set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);

Loading…
Cancel
Save