Bläddra i källkod

Fix homing and leveling

- Include the current Z when raising the axis after and between probing
- Add `sync_plan_position_delta` for parity with `sync_plan_position`
- Clean up and clarify `M48`, `dock_sled`, and others
Scott Lahteine 9 år sedan
förälder
incheckning
18bb6be80e
3 ändrade filer med 146 tillägg och 150 borttagningar
  1. 5
    1
      Marlin/Conditionals.h
  2. 2
    0
      Marlin/Marlin.h
  3. 139
    149
      Marlin/Marlin_main.cpp

+ 5
- 1
Marlin/Conditionals.h Visa fil

@@ -4,6 +4,10 @@
4 4
  */
5 5
 #ifndef CONDITIONALS_H
6 6
 
7
+#ifndef M_PI
8
+  #define M_PI 3.1415926536
9
+#endif
10
+
7 11
 #ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
8 12
 
9 13
   #define CONFIGURATION_LCD
@@ -252,7 +256,7 @@
252 256
    * Advance calculated values
253 257
    */
254 258
   #ifdef ADVANCE
255
-    #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
259
+    #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * M_PI)
256 260
     #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA)
257 261
   #endif
258 262
 

+ 2
- 0
Marlin/Marlin.h Visa fil

@@ -29,6 +29,8 @@
29 29
 
30 30
 #define BIT(b) (1<<(b))
31 31
 #define TEST(n,b) (((n)&BIT(b))!=0)
32
+#define RADIANS(d) ((d)*M_PI/180.0)
33
+#define DEGREES(r) ((d)*180.0/M_PI)
32 34
 
33 35
 // Arduino < 1.0.0 does not define this, so we need to do it ourselves
34 36
 #ifndef analogInputToDigitalPin

+ 139
- 149
Marlin/Marlin_main.cpp Visa fil

@@ -1034,6 +1034,12 @@ inline void line_to_destination() {
1034 1034
 inline void sync_plan_position() {
1035 1035
   plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1036 1036
 }
1037
+#ifdef DELTA
1038
+  inline void sync_plan_position_delta() {
1039
+    calculate_delta(current_position);
1040
+    plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1041
+  }
1042
+#endif
1037 1043
 
1038 1044
 #ifdef ENABLE_AUTO_BED_LEVELING
1039 1045
 
@@ -1109,8 +1115,7 @@ inline void sync_plan_position() {
1109 1115
       long stop_steps = st_get_position(Z_AXIS);
1110 1116
       float mm = start_z - float(start_steps - stop_steps) / axis_steps_per_unit[Z_AXIS];
1111 1117
       current_position[Z_AXIS] = mm;
1112
-      calculate_delta(current_position);
1113
-      plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1118
+      sync_plan_position_delta();
1114 1119
       
1115 1120
     #else // !DELTA
1116 1121
 
@@ -1262,7 +1267,7 @@ inline void sync_plan_position() {
1262 1267
       if (servo_endstops[Z_AXIS] >= 0) {
1263 1268
 
1264 1269
         #if Z_RAISE_AFTER_PROBING > 0
1265
-          do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
1270
+          do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING);
1266 1271
           st_synchronize();
1267 1272
         #endif
1268 1273
 
@@ -1345,7 +1350,7 @@ inline void sync_plan_position() {
1345 1350
 
1346 1351
     #if Z_RAISE_BETWEEN_PROBINGS > 0
1347 1352
       if (retract_action == ProbeStay) {
1348
-        do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BETWEEN_PROBINGS);
1353
+        do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1349 1354
         st_synchronize();
1350 1355
       }
1351 1356
     #endif
@@ -1550,62 +1555,57 @@ void refresh_cmd_timeout(void)
1550 1555
 }
1551 1556
 
1552 1557
 #ifdef FWRETRACT
1558
+
1553 1559
   void retract(bool retracting, bool swapretract = false) {
1554
-    if(retracting && !retracted[active_extruder]) {
1555
-      destination[X_AXIS]=current_position[X_AXIS];
1556
-      destination[Y_AXIS]=current_position[Y_AXIS];
1557
-      destination[Z_AXIS]=current_position[Z_AXIS];
1558
-      destination[E_AXIS]=current_position[E_AXIS];
1559
-      if (swapretract) {
1560
-        current_position[E_AXIS]+=retract_length_swap/volumetric_multiplier[active_extruder];
1561
-      } else {
1562
-        current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1563
-      }
1564
-      plan_set_e_position(current_position[E_AXIS]);
1565
-      float oldFeedrate = feedrate;
1560
+
1561
+    if (retracting == retracted[active_extruder]) return;
1562
+
1563
+    float oldFeedrate = feedrate;
1564
+
1565
+    for (int i = 0; i < NUM_AXIS; i++) destination[i] = current_position[i];
1566
+
1567
+    if (retracting) {
1568
+
1566 1569
       feedrate = retract_feedrate * 60;
1567
-      retracted[active_extruder]=true;
1570
+      current_position[E_AXIS] += (swapretract ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
1571
+      plan_set_e_position(current_position[E_AXIS]);
1568 1572
       prepare_move();
1569
-      if(retract_zlift > 0.01) {
1570
-         current_position[Z_AXIS]-=retract_zlift;
1571
-#ifdef DELTA
1572
-         calculate_delta(current_position); // change cartesian kinematic to  delta kinematic;
1573
-         plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1574
-#else
1575
-         sync_plan_position();
1576
-#endif
1577
-         prepare_move();
1578
-      }
1579
-      feedrate = oldFeedrate;
1580
-    } else if(!retracting && retracted[active_extruder]) {
1581
-      destination[X_AXIS]=current_position[X_AXIS];
1582
-      destination[Y_AXIS]=current_position[Y_AXIS];
1583
-      destination[Z_AXIS]=current_position[Z_AXIS];
1584
-      destination[E_AXIS]=current_position[E_AXIS];
1585
-      if(retract_zlift > 0.01) {
1586
-         current_position[Z_AXIS]+=retract_zlift;
1587
-#ifdef DELTA
1588
-         calculate_delta(current_position); // change cartesian kinematic  to  delta kinematic;
1589
-         plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1590
-#else
1591
-         sync_plan_position();
1592
-#endif
1593
-         //prepare_move();
1573
+
1574
+      if (retract_zlift > 0.01) {
1575
+        current_position[Z_AXIS] -= retract_zlift;
1576
+        #ifdef DELTA
1577
+          sync_plan_position_delta();
1578
+        #else
1579
+          sync_plan_position();
1580
+        #endif
1581
+        prepare_move();
1594 1582
       }
1595
-      if (swapretract) {
1596
-        current_position[E_AXIS]-=(retract_length_swap+retract_recover_length_swap)/volumetric_multiplier[active_extruder]; 
1597
-      } else {
1598
-        current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1583
+    }
1584
+    else {
1585
+
1586
+      if (retract_zlift > 0.01) {
1587
+        current_position[Z_AXIS] + =retract_zlift;
1588
+        #ifdef DELTA
1589
+          sync_plan_position_delta();
1590
+        #else
1591
+          sync_plan_position();
1592
+        #endif
1593
+        //prepare_move();
1599 1594
       }
1600
-      plan_set_e_position(current_position[E_AXIS]);
1601
-      float oldFeedrate = feedrate;
1595
+
1602 1596
       feedrate = retract_recover_feedrate * 60;
1603
-      retracted[active_extruder] = false;
1597
+      float move_e = swapretract ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
1598
+      current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
1599
+      plan_set_e_position(current_position[E_AXIS]);
1604 1600
       prepare_move();
1605
-      feedrate = oldFeedrate;
1606 1601
     }
1607
-  } //retract
1608
-#endif //FWRETRACT
1602
+
1603
+    feedrate = oldFeedrate;
1604
+    retracted[active_extruder] = retract;
1605
+
1606
+  } // retract()
1607
+
1608
+#endif // FWRETRACT
1609 1609
 
1610 1610
 #ifdef Z_PROBE_SLED
1611 1611
 
@@ -1613,40 +1613,32 @@ void refresh_cmd_timeout(void)
1613 1613
     #define SLED_DOCKING_OFFSET 0
1614 1614
   #endif
1615 1615
 
1616
-//
1617
-// Method to dock/undock a sled designed by Charles Bell.
1618
-//
1619
-// dock[in]     If true, move to MAX_X and engage the electromagnet
1620
-// offset[in]   The additional distance to move to adjust docking location
1621
-//
1622
-static void dock_sled(bool dock, int offset=0) {
1623
- int z_loc;
1624
- 
1625
- if (!((axis_known_position[X_AXIS]) && (axis_known_position[Y_AXIS]))) {
1626
-   LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
1627
-   SERIAL_ECHO_START;
1628
-   SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
1629
-   return;
1630
- }
1631
-
1632
- if (dock) {
1633
-   do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset,
1634
-                       current_position[Y_AXIS],
1635
-                       current_position[Z_AXIS]);
1636
-   // turn off magnet
1637
-   digitalWrite(SERVO0_PIN, LOW);
1638
- } else {
1639
-   if (current_position[Z_AXIS] < (Z_RAISE_BEFORE_PROBING + 5))
1640
-     z_loc = Z_RAISE_BEFORE_PROBING;
1641
-   else
1642
-     z_loc = current_position[Z_AXIS];
1643
-   do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset,
1644
-                       Y_PROBE_OFFSET_FROM_EXTRUDER, z_loc);
1645
-   // turn on magnet
1646
-   digitalWrite(SERVO0_PIN, HIGH);
1647
- }
1648
-}
1649
-#endif
1616
+  //
1617
+  // Method to dock/undock a sled designed by Charles Bell.
1618
+  //
1619
+  // dock[in]     If true, move to MAX_X and engage the electromagnet
1620
+  // offset[in]   The additional distance to move to adjust docking location
1621
+  //
1622
+  static void dock_sled(bool dock, int offset=0) {
1623
+    if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
1624
+      LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
1625
+      SERIAL_ECHO_START;
1626
+      SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
1627
+      return;
1628
+    }
1629
+
1630
+    if (dock) {
1631
+      do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], current_position[Z_AXIS]);
1632
+      digitalWrite(SERVO0_PIN, LOW); // turn off magnet
1633
+    } else {
1634
+      float z_loc = current_position[Z_AXIS];
1635
+      if (z_loc < Z_RAISE_BEFORE_PROBING + 5) z_loc = Z_RAISE_BEFORE_PROBING;
1636
+      do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, Y_PROBE_OFFSET_FROM_EXTRUDER, z_loc);
1637
+      digitalWrite(SERVO0_PIN, HIGH); // turn on magnet
1638
+    }
1639
+  }
1640
+
1641
+#endif // Z_PROBE_SLED
1650 1642
 
1651 1643
 /**
1652 1644
  *
@@ -1798,8 +1790,7 @@ inline void gcode_G28() {
1798 1790
     HOMEAXIS(Y);
1799 1791
     HOMEAXIS(Z);
1800 1792
 
1801
-    calculate_delta(current_position);
1802
-    plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1793
+    sync_plan_position_delta();
1803 1794
 
1804 1795
   #else // NOT DELTA
1805 1796
 
@@ -1826,7 +1817,9 @@ inline void gcode_G28() {
1826 1817
     #endif
1827 1818
 
1828 1819
     #ifdef QUICK_HOME
1829
-      if (home_all_axis || (homeX && homeY)) {  //first diagonal move
1820
+
1821
+      if (home_all_axis || (homeX && homeY)) {  // First diagonal move
1822
+
1830 1823
         current_position[X_AXIS] = current_position[Y_AXIS] = 0;
1831 1824
 
1832 1825
         #ifdef DUAL_X_CARRIAGE
@@ -1837,21 +1830,20 @@ inline void gcode_G28() {
1837 1830
         #endif
1838 1831
 
1839 1832
         sync_plan_position();
1840
-        destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;
1841
-        destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
1842
-        feedrate = homing_feedrate[X_AXIS];
1843
-        if (homing_feedrate[Y_AXIS] < feedrate) feedrate = homing_feedrate[Y_AXIS];
1844
-        if (max_length(X_AXIS) > max_length(Y_AXIS)) {
1845
-          feedrate *= sqrt(pow(max_length(Y_AXIS) / max_length(X_AXIS), 2) + 1);
1846
-        } else {
1847
-          feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1);
1848
-        }
1833
+
1834
+        float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
1835
+              mlratio = mlx>mly ? mly/mlx : mlx/mly;
1836
+
1837
+        destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
1838
+        destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
1839
+        feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
1849 1840
         line_to_destination();
1850 1841
         st_synchronize();
1851 1842
 
1852 1843
         axis_is_at_home(X_AXIS);
1853 1844
         axis_is_at_home(Y_AXIS);
1854 1845
         sync_plan_position();
1846
+
1855 1847
         destination[X_AXIS] = current_position[X_AXIS];
1856 1848
         destination[Y_AXIS] = current_position[Y_AXIS];
1857 1849
         line_to_destination();
@@ -1865,7 +1857,7 @@ inline void gcode_G28() {
1865 1857
           current_position[Z_AXIS] = destination[Z_AXIS];
1866 1858
         #endif
1867 1859
       }
1868
-    #endif //QUICK_HOME
1860
+    #endif // QUICK_HOME
1869 1861
 
1870 1862
     // Home X
1871 1863
     if (home_all_axis || homeX) {
@@ -1947,7 +1939,7 @@ inline void gcode_G28() {
1947 1939
                 && cpy >= Y_MIN_POS - Y_PROBE_OFFSET_FROM_EXTRUDER
1948 1940
                 && cpy <= Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER) {
1949 1941
               current_position[Z_AXIS] = 0;
1950
-              plan_set_position(cpx, cpy, current_position[Z_AXIS], current_position[E_AXIS]);
1942
+              plan_set_position(cpx, cpy, 0, current_position[E_AXIS]);
1951 1943
               destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS);    // Set destination away from bed
1952 1944
               feedrate = max_feedrate[Z_AXIS];
1953 1945
               line_to_destination();
@@ -1986,8 +1978,7 @@ inline void gcode_G28() {
1986 1978
   #endif // else DELTA
1987 1979
 
1988 1980
   #ifdef SCARA
1989
-    calculate_delta(current_position);
1990
-    plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1981
+    sync_plan_position_delta();
1991 1982
   #endif
1992 1983
 
1993 1984
   #ifdef ENDSTOPS_ONLY_FOR_HOMING
@@ -2826,9 +2817,7 @@ inline void gcode_M42() {
2826 2817
   inline void gcode_M48() {
2827 2818
 
2828 2819
     double sum = 0.0, mean = 0.0, sigma = 0.0, sample_set[50];
2829
-    int verbose_level = 1, n = 0, j, n_samples = 10, n_legs = 0, engage_probe_for_each_reading = 0;
2830
-    double X_current, Y_current, Z_current;
2831
-    double X_probe_location, Y_probe_location, Z_start_location, ext_position;
2820
+    int verbose_level = 1, j, n_samples = 10, n_legs = 0, engage_probe_for_each_reading = 0;
2832 2821
     
2833 2822
     if (code_seen('V') || code_seen('v')) {
2834 2823
       verbose_level = code_value();
@@ -2849,11 +2838,12 @@ inline void gcode_M42() {
2849 2838
       }
2850 2839
     }
2851 2840
 
2852
-    X_current = X_probe_location = st_get_position_mm(X_AXIS);
2853
-    Y_current = Y_probe_location = st_get_position_mm(Y_AXIS);
2854
-    Z_current = st_get_position_mm(Z_AXIS);
2855
-    Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
2856
-    ext_position = st_get_position_mm(E_AXIS);
2841
+    double X_probe_location, Y_probe_location,
2842
+           X_current = X_probe_location = st_get_position_mm(X_AXIS),
2843
+           Y_current = Y_probe_location = st_get_position_mm(Y_AXIS),
2844
+           Z_current = st_get_position_mm(Z_AXIS),
2845
+           Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING,
2846
+           ext_position = st_get_position_mm(E_AXIS);
2857 2847
 
2858 2848
     if (code_seen('E') || code_seen('e'))
2859 2849
       engage_probe_for_each_reading++;
@@ -2936,33 +2926,29 @@ inline void gcode_M42() {
2936 2926
 
2937 2927
     if (engage_probe_for_each_reading) retract_z_probe();
2938 2928
 
2939
-    for (n=0; n < n_samples; n++) {
2929
+    for (uint16_t n=0; n < n_samples; n++) {
2940 2930
 
2941
-      do_blocking_move_to( X_probe_location, Y_probe_location, Z_start_location); // Make sure we are at the probe location
2931
+      do_blocking_move_to(X_probe_location, Y_probe_location, Z_start_location); // Make sure we are at the probe location
2942 2932
 
2943 2933
       if (n_legs) {
2944
-        double radius=0.0, theta=0.0;
2945
-        int l;
2946
-        int rotational_direction = (unsigned long) millis() & 0x0001;     // clockwise or counter clockwise
2947
-        radius = (unsigned long)millis() % (long)(X_MAX_LENGTH / 4);      // limit how far out to go
2948
-        theta = (float)((unsigned long)millis() % 360L) / (360. / (2 * 3.1415926)); // turn into radians
2934
+        unsigned long ms = millis();
2935
+        double radius = ms % (X_MAX_LENGTH / 4),       // limit how far out to go
2936
+               theta = RADIANS(ms % 360L);
2937
+        float dir = (ms & 0x0001) ? 1 : -1;            // clockwise or counter clockwise
2949 2938
 
2950 2939
         //SERIAL_ECHOPAIR("starting radius: ",radius);
2951 2940
         //SERIAL_ECHOPAIR("   theta: ",theta);
2952
-        //SERIAL_ECHOPAIR("   direction: ",rotational_direction);
2941
+        //SERIAL_ECHOPAIR("   direction: ",dir);
2953 2942
         //SERIAL_EOL;
2954 2943
 
2955
-        float dir = rotational_direction ? 1 : -1;
2956
-        for (l = 0; l < n_legs - 1; l++) {
2957
-          theta += dir * (float)((unsigned long)millis() % 20L) / (360.0/(2*3.1415926)); // turn into radians
2958
-
2959
-          radius += (float)(((long)((unsigned long) millis() % 10L)) - 5L);
2944
+        for (int l = 0; l < n_legs - 1; l++) {
2945
+          ms = millis();
2946
+          theta += RADIANS(dir * (ms % 20L));
2947
+          radius += (ms % 10L) - 5L;
2960 2948
           if (radius < 0.0) radius = -radius;
2961 2949
 
2962 2950
           X_current = X_probe_location + cos(theta) * radius;
2963 2951
           Y_current = Y_probe_location + sin(theta) * radius;
2964
-
2965
-          // Make sure our X & Y are sane
2966 2952
           X_current = constrain(X_current, X_MIN_POS, X_MAX_POS);
2967 2953
           Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS);
2968 2954
 
@@ -2972,10 +2958,13 @@ inline void gcode_M42() {
2972 2958
             SERIAL_EOL;
2973 2959
           }
2974 2960
 
2975
-          do_blocking_move_to( X_current, Y_current, Z_current );
2976
-        }
2977
-        do_blocking_move_to( X_probe_location, Y_probe_location, Z_start_location); // Go back to the probe location
2978
-      }
2961
+          do_blocking_move_to(X_current, Y_current, Z_current);
2962
+
2963
+        } // n_legs loop
2964
+
2965
+        do_blocking_move_to(X_probe_location, Y_probe_location, Z_start_location); // Go back to the probe location
2966
+
2967
+      } // n_legs
2979 2968
 
2980 2969
       if (engage_probe_for_each_reading)  {
2981 2970
         engage_z_probe(); 
@@ -2991,46 +2980,49 @@ inline void gcode_M42() {
2991 2980
       // Get the current mean for the data points we have so far
2992 2981
       //
2993 2982
       sum = 0.0;
2994
-      for (j=0; j<=n; j++) sum += sample_set[j];
2995
-      mean = sum / (double (n+1));
2983
+      for (int j = 0; j <= n; j++) sum += sample_set[j];
2984
+      mean = sum / (n + 1);
2996 2985
 
2997 2986
       //
2998 2987
       // Now, use that mean to calculate the standard deviation for the
2999 2988
       // data points we have so far
3000 2989
       //
3001 2990
       sum = 0.0;
3002
-      for (j=0; j<=n; j++) sum += (sample_set[j]-mean) * (sample_set[j]-mean);
3003
-      sigma = sqrt( sum / (double (n+1)) );
2991
+      for (int j = 0; j <= n; j++) {
2992
+        float ss = sample_set[j] - mean;
2993
+        sum += ss * ss;
2994
+      }
2995
+      sigma = sqrt(sum / (n + 1));
3004 2996
 
3005 2997
       if (verbose_level > 1) {
3006 2998
         SERIAL_PROTOCOL(n+1);
3007
-        SERIAL_PROTOCOL(" of ");
2999
+        SERIAL_PROTOCOLPGM(" of ");
3008 3000
         SERIAL_PROTOCOL(n_samples);
3009 3001
         SERIAL_PROTOCOLPGM("   z: ");
3010 3002
         SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
3011
-      }
3012
-
3013
-      if (verbose_level > 2) {
3014
-        SERIAL_PROTOCOL(" mean: ");
3015
-        SERIAL_PROTOCOL_F(mean,6);
3016
-        SERIAL_PROTOCOL("   sigma: ");
3017
-        SERIAL_PROTOCOL_F(sigma,6);
3003
+        if (verbose_level > 2) {
3004
+          SERIAL_PROTOCOLPGM(" mean: ");
3005
+          SERIAL_PROTOCOL_F(mean,6);
3006
+          SERIAL_PROTOCOLPGM("   sigma: ");
3007
+          SERIAL_PROTOCOL_F(sigma,6);
3008
+        }
3018 3009
       }
3019 3010
 
3020 3011
       if (verbose_level > 0) SERIAL_EOL;
3021 3012
 
3022
-      plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location,
3023
-          current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
3013
+      plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
3024 3014
       st_synchronize();
3025 3015
 
3026 3016
       if (engage_probe_for_each_reading) {
3027
-        retract_z_probe();  
3017
+        retract_z_probe();
3028 3018
         delay(1000);
3029 3019
       }
3030 3020
     }
3031 3021
 
3032
-    retract_z_probe();
3033
-    delay(1000);
3022
+    if (!engage_probe_for_each_reading) {
3023
+      retract_z_probe();
3024
+      delay(1000);
3025
+    }
3034 3026
 
3035 3027
     clean_up_after_endstop_move();
3036 3028
 
@@ -4674,9 +4666,7 @@ inline void gcode_T() {
4674 4666
           active_extruder = tmp_extruder;
4675 4667
         #endif // !DUAL_X_CARRIAGE
4676 4668
         #ifdef DELTA
4677
-          calculate_delta(current_position); // change cartesian kinematic  to  delta kinematic;
4678
-          //sent position to plan_set_position();
4679
-          plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],current_position[E_AXIS]);
4669
+          sync_plan_position_delta();
4680 4670
         #else
4681 4671
           sync_plan_position();
4682 4672
         #endif

Laddar…
Avbryt
Spara