Bläddra i källkod

Merge pull request #4134 from thinkyhead/rc_followup_4021

Additional cleanup to probing/leveling
Scott Lahteine 9 år sedan
förälder
incheckning
de0e6d5f13

+ 5
- 7
Marlin/Configuration.h Visa fil

1173
 //
1173
 //
1174
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1174
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1175
 
1175
 
1176
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1177
+// 300ms is a good value but you can try less delay.
1178
+// If the servo can't reach the requested position, increase it.
1179
+#define SERVO_DELAY 300
1180
+
1176
 // Servo deactivation
1181
 // Servo deactivation
1177
 //
1182
 //
1178
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1183
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1179
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1184
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1180
 
1185
 
1181
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1182
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1183
-  // 300ms is a good value but you can try less delay.
1184
-  // If the servo can't reach the requested position, increase it.
1185
-  #define SERVO_DEACTIVATION_DELAY 300
1186
-#endif
1187
-
1188
 /**********************************************************************\
1186
 /**********************************************************************\
1189
  * Support for a filament diameter sensor
1187
  * Support for a filament diameter sensor
1190
  * Also allows adjustment of diameter at print time (vs  at slicing)
1188
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 128
- 235
Marlin/Marlin_main.cpp Visa fil

1592
 //  - Reset the command timeout
1592
 //  - Reset the command timeout
1593
 //  - Enable the endstops (for endstop moves)
1593
 //  - Enable the endstops (for endstop moves)
1594
 //
1594
 //
1595
-// clean_up_after_endstop_move() restores
1596
-// feedrates, sets endstops back to global state.
1597
-//
1598
 static void setup_for_endstop_or_probe_move() {
1595
 static void setup_for_endstop_or_probe_move() {
1599
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1596
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1600
     if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
1597
     if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
1619
 }
1616
 }
1620
 
1617
 
1621
 #if HAS_BED_PROBE
1618
 #if HAS_BED_PROBE
1622
-
1623
-  static void clean_up_after_endstop_move() {
1624
-    clean_up_after_endstop_or_probe_move();
1625
-    endstops.not_homing();
1626
-  }
1627
-
1628
   #if ENABLED(DELTA)
1619
   #if ENABLED(DELTA)
1629
     /**
1620
     /**
1630
      * Calculate delta, start a line, and set current_position to destination
1621
      * Calculate delta, start a line, and set current_position to destination
1666
 
1657
 
1667
     #else
1658
     #else
1668
 
1659
 
1669
-      feedrate = homing_feedrate[Z_AXIS];
1670
-
1671
-      current_position[Z_AXIS] = z;
1672
-      line_to_current_position();
1673
-      stepper.synchronize();
1660
+      // If Z needs to raise, do it before moving XY
1661
+      if (current_position[Z_AXIS] < z) {
1662
+        feedrate = homing_feedrate[Z_AXIS];
1663
+        current_position[Z_AXIS] = z;
1664
+        line_to_current_position();
1665
+      }
1674
 
1666
 
1675
       feedrate = XY_PROBE_FEEDRATE;
1667
       feedrate = XY_PROBE_FEEDRATE;
1676
-
1677
       current_position[X_AXIS] = x;
1668
       current_position[X_AXIS] = x;
1678
       current_position[Y_AXIS] = y;
1669
       current_position[Y_AXIS] = y;
1679
       line_to_current_position();
1670
       line_to_current_position();
1680
 
1671
 
1672
+      // If Z needs to lower, do it after moving XY
1673
+      if (current_position[Z_AXIS] > z) {
1674
+        feedrate = homing_feedrate[Z_AXIS];
1675
+        current_position[Z_AXIS] = z;
1676
+        line_to_current_position();
1677
+      }
1678
+
1681
     #endif
1679
     #endif
1682
 
1680
 
1683
     stepper.synchronize();
1681
     stepper.synchronize();
1722
     }
1720
     }
1723
   }
1721
   }
1724
 
1722
 
1725
-  inline void raise_z_after_probing() {
1726
-    #if Z_RAISE_AFTER_PROBING > 0
1727
-      do_probe_raise(Z_RAISE_AFTER_PROBING);
1728
-    #endif
1729
-  }
1730
 #endif //HAS_BED_PROBE
1723
 #endif //HAS_BED_PROBE
1731
 
1724
 
1732
 #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
1725
 #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
1774
     float oldXpos = current_position[X_AXIS]; // save x position
1767
     float oldXpos = current_position[X_AXIS]; // save x position
1775
     float old_feedrate = feedrate;
1768
     float old_feedrate = feedrate;
1776
     if (dock) {
1769
     if (dock) {
1777
-      raise_z_after_probing(); // raise Z
1770
+      #if Z_RAISE_AFTER_PROBING > 0
1771
+        do_probe_raise(Z_RAISE_AFTER_PROBING);
1772
+      #endif
1778
       // Dock sled a bit closer to ensure proper capturing
1773
       // Dock sled a bit closer to ensure proper capturing
1779
       feedrate = XY_PROBE_FEEDRATE;
1774
       feedrate = XY_PROBE_FEEDRATE;
1780
       do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1);
1775
       do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1);
1804
 
1799
 
1805
     if (endstops.z_probe_enabled) return;
1800
     if (endstops.z_probe_enabled) return;
1806
 
1801
 
1802
+    // Make room for probe
1803
+    #if Z_RAISE_BEFORE_PROBING > 0
1804
+      do_probe_raise(Z_RAISE_BEFORE_PROBING);
1805
+    #endif
1806
+
1807
     #if ENABLED(Z_PROBE_SLED)
1807
     #if ENABLED(Z_PROBE_SLED)
1808
 
1808
 
1809
       dock_sled(false);
1809
       dock_sled(false);
1810
 
1810
 
1811
     #elif HAS_Z_SERVO_ENDSTOP
1811
     #elif HAS_Z_SERVO_ENDSTOP
1812
 
1812
 
1813
-      // Make room for Z Servo
1814
-      do_probe_raise(Z_RAISE_BEFORE_PROBING);
1815
-
1816
       // Engage Z Servo endstop if enabled
1813
       // Engage Z Servo endstop if enabled
1817
       DEPLOY_Z_SERVO();
1814
       DEPLOY_Z_SERVO();
1818
 
1815
 
1906
 
1903
 
1907
     if (!endstops.z_probe_enabled) return;
1904
     if (!endstops.z_probe_enabled) return;
1908
 
1905
 
1906
+    // Make more room for the servo
1907
+    #if Z_RAISE_AFTER_PROBING > 0
1908
+      do_probe_raise(Z_RAISE_AFTER_PROBING);
1909
+    #endif
1910
+
1909
     #if ENABLED(Z_PROBE_SLED)
1911
     #if ENABLED(Z_PROBE_SLED)
1910
 
1912
 
1911
       dock_sled(true);
1913
       dock_sled(true);
1912
 
1914
 
1913
     #elif HAS_Z_SERVO_ENDSTOP
1915
     #elif HAS_Z_SERVO_ENDSTOP
1914
 
1916
 
1915
-      // Make room for the servo
1916
-      do_probe_raise(Z_RAISE_AFTER_PROBING);
1917
-
1918
       // Change the Z servo angle
1917
       // Change the Z servo angle
1919
       STOW_Z_SERVO();
1918
       STOW_Z_SERVO();
1920
 
1919
 
2080
     return current_position[Z_AXIS];
2079
     return current_position[Z_AXIS];
2081
   }
2080
   }
2082
 
2081
 
2083
-#endif // HAS_BED_PROBE
2084
-
2085
-#if HAS_PROBING_PROCEDURE
2086
-
2087
   inline void do_blocking_move_to_xy(float x, float y) {
2082
   inline void do_blocking_move_to_xy(float x, float y) {
2088
     do_blocking_move_to(x, y, current_position[Z_AXIS]);
2083
     do_blocking_move_to(x, y, current_position[Z_AXIS]);
2089
   }
2084
   }
2090
 
2085
 
2091
-  enum ProbeAction {
2092
-    ProbeStay          = 0,
2093
-    ProbeDeploy        = _BV(0),
2094
-    ProbeStow          = _BV(1),
2095
-    ProbeDeployAndStow = (ProbeDeploy | ProbeStow)
2096
-  };
2097
-
2098
-  // Probe bed height at position (x,y), returns the measured z value
2099
-  static float probe_pt(float x, float y, float z_raise, ProbeAction probe_action = ProbeDeployAndStow, int verbose_level = 1) {
2086
+  //
2087
+  // - Move to the given XY
2088
+  // - Deploy the probe, if not already deployed
2089
+  // - Probe the bed, get the Z position
2090
+  // - Depending on the 'stow' flag
2091
+  //   - Stow the probe, or
2092
+  //   - Raise to the BETWEEN height
2093
+  // - Return the probed Z position
2094
+  //
2095
+  static float probe_pt(float x, float y, bool stow = true, int verbose_level = 1) {
2100
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2096
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2101
       if (DEBUGGING(LEVELING)) {
2097
       if (DEBUGGING(LEVELING)) {
2102
         SERIAL_ECHOLNPGM("probe_pt >>>");
2098
         SERIAL_ECHOLNPGM("probe_pt >>>");
2103
-        SERIAL_ECHOPAIR("> ProbeAction:", probe_action);
2099
+        SERIAL_ECHOPAIR("> stow:", stow);
2104
         SERIAL_EOL;
2100
         SERIAL_EOL;
2105
         DEBUG_POS("", current_position);
2101
         DEBUG_POS("", current_position);
2106
       }
2102
       }
2111
     // Raise by z_raise, then move the Z probe to the given XY
2107
     // Raise by z_raise, then move the Z probe to the given XY
2112
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2108
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2113
       if (DEBUGGING(LEVELING)) {
2109
       if (DEBUGGING(LEVELING)) {
2114
-        SERIAL_ECHOPAIR("Z Raise by z_raise ", z_raise);
2115
-        SERIAL_EOL;
2116
-      }
2117
-    #endif
2118
-    do_probe_raise(z_raise); // this also updates current_position
2119
-
2120
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
2121
-      if (DEBUGGING(LEVELING)) {
2122
-        SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - (X_PROBE_OFFSET_FROM_EXTRUDER));
2110
+        SERIAL_ECHOPAIR("> do_blocking_move_to ", x - (X_PROBE_OFFSET_FROM_EXTRUDER));
2123
         SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
2111
         SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
2112
+        SERIAL_ECHOPAIR(", ", max(current_position[Z_AXIS], Z_RAISE_BETWEEN_PROBINGS));
2124
         SERIAL_EOL;
2113
         SERIAL_EOL;
2125
       }
2114
       }
2126
     #endif
2115
     #endif
2127
 
2116
 
2128
-    // this also updates current_position
2129
     feedrate = XY_PROBE_FEEDRATE;
2117
     feedrate = XY_PROBE_FEEDRATE;
2130
     do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
2118
     do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
2131
 
2119
 
2132
-    if (probe_action & ProbeDeploy) {
2133
-      #if ENABLED(DEBUG_LEVELING_FEATURE)
2134
-        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> ProbeDeploy");
2135
-      #endif
2136
-      deploy_z_probe();
2137
-    }
2120
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
2121
+      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> deploy_z_probe");
2122
+    #endif
2123
+    deploy_z_probe();
2138
 
2124
 
2139
     float measured_z = run_z_probe();
2125
     float measured_z = run_z_probe();
2140
 
2126
 
2141
-    if (probe_action & ProbeStow) {
2127
+    if (stow) {
2142
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2128
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2143
-        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> ProbeStow (stow_z_probe will do Z Raise)");
2129
+        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> stow_z_probe");
2144
       #endif
2130
       #endif
2145
       stow_z_probe();
2131
       stow_z_probe();
2146
     }
2132
     }
2133
+    #if Z_RAISE_BETWEEN_PROBINGS > 0
2134
+      else {
2135
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
2136
+          if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> do_probe_raise");
2137
+        #endif
2138
+        do_probe_raise(Z_RAISE_BETWEEN_PROBINGS);
2139
+      }
2140
+    #endif
2147
 
2141
 
2148
     if (verbose_level > 2) {
2142
     if (verbose_level > 2) {
2149
       SERIAL_PROTOCOLPGM("Bed X: ");
2143
       SERIAL_PROTOCOLPGM("Bed X: ");
2164
     return measured_z;
2158
     return measured_z;
2165
   }
2159
   }
2166
 
2160
 
2167
-#endif // AUTO_BED_LEVELING_FEATURE || Z_MIN_PROBE_REPEATABILITY_TEST
2161
+#endif // HAS_BED_PROBE
2168
 
2162
 
2169
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
2163
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
2170
 
2164
 
3383
 
3377
 
3384
     bool dryrun = code_seen('D');
3378
     bool dryrun = code_seen('D');
3385
 
3379
 
3386
-    #if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
3387
-      bool deploy_probe_for_each_reading = code_seen('E');
3380
+    #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
3381
+      const bool stow_probe_after_each = false;
3382
+    #else
3383
+      bool stow_probe_after_each = code_seen('E');
3388
     #endif
3384
     #endif
3389
 
3385
 
3390
     #if ENABLED(AUTO_BED_LEVELING_GRID)
3386
     #if ENABLED(AUTO_BED_LEVELING_GRID)
3541
         for (int xCount = xStart; xCount != xStop; xCount += xInc) {
3537
         for (int xCount = xStart; xCount != xStop; xCount += xInc) {
3542
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
3538
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
3543
 
3539
 
3544
-          // raise extruder
3545
-          float measured_z,
3546
-                z_raise = probePointCounter ? Z_RAISE_BETWEEN_PROBINGS : Z_RAISE_BEFORE_PROBING;
3547
-
3548
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
3549
-            if (DEBUGGING(LEVELING)) {
3550
-              SERIAL_ECHOPGM("z_raise = (");
3551
-              if (probePointCounter)
3552
-                SERIAL_ECHOPGM("between) ");
3553
-              else
3554
-                SERIAL_ECHOPGM("before) ");
3555
-              SERIAL_ECHOLN(z_raise);
3556
-            }
3557
-          #endif
3558
-
3559
           #if ENABLED(DELTA)
3540
           #if ENABLED(DELTA)
3560
             // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
3541
             // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
3561
             float distance_from_center = sqrt(xProbe * xProbe + yProbe * yProbe);
3542
             float distance_from_center = sqrt(xProbe * xProbe + yProbe * yProbe);
3562
             if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue;
3543
             if (distance_from_center > DELTA_PROBEABLE_RADIUS) continue;
3563
           #endif //DELTA
3544
           #endif //DELTA
3564
 
3545
 
3565
-          #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
3566
-            const ProbeAction act = ProbeStay;
3567
-          #else
3568
-            ProbeAction act;
3569
-            if (deploy_probe_for_each_reading) // G29 E - Stow between probes
3570
-              act = ProbeDeployAndStow;
3571
-            else if (yCount == 0 && xCount == xStart)
3572
-              act = ProbeDeploy;
3573
-            else if (yCount == auto_bed_leveling_grid_points - 1 && xCount == xStop - xInc)
3574
-              act = ProbeStow;
3575
-            else
3576
-              act = ProbeStay;
3577
-          #endif
3578
-
3579
-          measured_z = probe_pt(xProbe, yProbe, z_raise, act, verbose_level);
3546
+          float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
3580
 
3547
 
3581
           #if DISABLED(DELTA)
3548
           #if DISABLED(DELTA)
3582
             mean += measured_z;
3549
             mean += measured_z;
3597
         } //xProbe
3564
         } //xProbe
3598
       } //yProbe
3565
       } //yProbe
3599
 
3566
 
3567
+    #else // !AUTO_BED_LEVELING_GRID
3568
+
3600
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3569
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3601
-        if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
3570
+        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
3602
       #endif
3571
       #endif
3603
 
3572
 
3573
+      // Probe at 3 arbitrary points
3574
+      float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
3575
+                                  ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
3576
+                                  stow_probe_after_each, verbose_level),
3577
+            z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
3578
+                                  ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
3579
+                                  stow_probe_after_each, verbose_level),
3580
+            z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
3581
+                                  ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
3582
+                                  stow_probe_after_each, verbose_level);
3583
+
3584
+      if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
3585
+
3586
+    #endif // !AUTO_BED_LEVELING_GRID
3587
+
3588
+    // Raise to Z_RAISE_AFTER_PROBING. Stow the probe.
3589
+    stow_z_probe();
3590
+
3591
+    // Restore state after probing
3592
+    clean_up_after_endstop_or_probe_move();
3593
+
3594
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
3595
+      if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
3596
+    #endif
3597
+
3598
+    // Calculate leveling, print reports, correct the position
3599
+    #if ENABLED(AUTO_BED_LEVELING_GRID)
3604
       #if ENABLED(DELTA)
3600
       #if ENABLED(DELTA)
3605
 
3601
 
3606
         if (!dryrun) extrapolate_unprobed_bed_level();
3602
         if (!dryrun) extrapolate_unprobed_bed_level();
3696
           }
3692
           }
3697
         } //do_topography_map
3693
         } //do_topography_map
3698
       #endif //!DELTA
3694
       #endif //!DELTA
3699
-
3700
-    #else // !AUTO_BED_LEVELING_GRID
3701
-
3702
-      #if ENABLED(DEBUG_LEVELING_FEATURE)
3703
-        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
3704
-      #endif
3705
-
3706
-      #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
3707
-        const ProbeAction p1 = ProbeStay, p2 = ProbeStay, p3 = ProbeStay;
3708
-      #else
3709
-        // Actions for each probe
3710
-        ProbeAction p1, p2, p3;
3711
-        if (deploy_probe_for_each_reading)
3712
-          p1 = p2 = p3 = ProbeDeployAndStow;
3713
-        else
3714
-          p1 = ProbeDeploy, p2 = ProbeStay, p3 = ProbeStow;
3715
-      #endif
3716
-
3717
-      // Probe at 3 arbitrary points
3718
-      float z_at_pt_1 = probe_pt( ABL_PROBE_PT_1_X + home_offset[X_AXIS],
3719
-                                  ABL_PROBE_PT_1_Y + home_offset[Y_AXIS],
3720
-                                  Z_RAISE_BEFORE_PROBING,
3721
-                                  p1, verbose_level),
3722
-            z_at_pt_2 = probe_pt( ABL_PROBE_PT_2_X + home_offset[X_AXIS],
3723
-                                  ABL_PROBE_PT_2_Y + home_offset[Y_AXIS],
3724
-                                  Z_RAISE_BETWEEN_PROBINGS,
3725
-                                  p2, verbose_level),
3726
-            z_at_pt_3 = probe_pt( ABL_PROBE_PT_3_X + home_offset[X_AXIS],
3727
-                                  ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
3728
-                                  Z_RAISE_BETWEEN_PROBINGS,
3729
-                                  p3, verbose_level);
3730
-
3731
-      if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
3732
-
3733
-    #endif // !AUTO_BED_LEVELING_GRID
3695
+    #endif // AUTO_BED_LEVELING_GRID
3734
 
3696
 
3735
     #if DISABLED(DELTA)
3697
     #if DISABLED(DELTA)
3736
       if (verbose_level > 0)
3698
       if (verbose_level > 0)
3745
         float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
3707
         float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
3746
               y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
3708
               y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
3747
               z_tmp = current_position[Z_AXIS],
3709
               z_tmp = current_position[Z_AXIS],
3748
-              real_z = stepper.get_axis_position_mm(Z_AXIS);  //get the real Z (since planner.adjusted_position is now correcting the plane)
3710
+              stepper_z = stepper.get_axis_position_mm(Z_AXIS);  //get the real Z (since planner.adjusted_position is now correcting the plane)
3749
 
3711
 
3750
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3712
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3751
           if (DEBUGGING(LEVELING)) {
3713
           if (DEBUGGING(LEVELING)) {
3752
-            SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > z_tmp  = ", z_tmp);
3753
-            SERIAL_EOL;
3754
-            SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > real_z = ", real_z);
3714
+            SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > stepper_z = ", stepper_z);
3715
+            SERIAL_ECHOPAIR(" ... z_tmp  = ", z_tmp);
3755
             SERIAL_EOL;
3716
             SERIAL_EOL;
3756
           }
3717
           }
3757
         #endif
3718
         #endif
3759
         // Apply the correction sending the Z probe offset
3720
         // Apply the correction sending the Z probe offset
3760
         apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
3721
         apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
3761
 
3722
 
3762
-        /*
3763
-         * Get the current Z position and send it to the planner.
3764
-         *
3765
-         * >> (z_tmp - real_z) : The rotated current Z minus the uncorrected Z
3766
-         * (most recent planner.set_position_mm/sync_plan_position)
3767
-         *
3768
-         * >> zprobe_zoffset : Z distance from nozzle to Z probe
3769
-         * (set by default, M851, EEPROM, or Menu)
3770
-         *
3771
-         * >> Z_RAISE_AFTER_PROBING : The distance the Z probe will have lifted
3772
-         * after the last probe
3773
-         *
3774
-         * >> Should home_offset[Z_AXIS] be included?
3775
-         *
3776
-         *
3777
-         *   Discussion: home_offset[Z_AXIS] was applied in G28 to set the
3778
-         *   starting Z. If Z is not tweaked in G29 -and- the Z probe in G29 is
3779
-         *   not actually "homing" Z... then perhaps it should not be included
3780
-         *   here. The purpose of home_offset[] is to adjust for inaccurate
3781
-         *   endstops, not for reasonably accurate probes. If it were added
3782
-         *   here, it could be seen as a compensating factor for the Z probe.
3783
-         */
3784
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3723
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3785
           if (DEBUGGING(LEVELING)) {
3724
           if (DEBUGGING(LEVELING)) {
3786
             SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp  = ", z_tmp);
3725
             SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp  = ", z_tmp);
3788
           }
3727
           }
3789
         #endif
3728
         #endif
3790
 
3729
 
3791
-        current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
3792
-          #if HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
3793
-             + Z_RAISE_AFTER_PROBING
3794
-          #endif
3795
-        ;
3796
-        // current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
3730
+        // Adjust the current Z and send it to the planner.
3731
+        current_position[Z_AXIS] += z_tmp - stepper_z;
3797
         SYNC_PLAN_POSITION_KINEMATIC();
3732
         SYNC_PLAN_POSITION_KINEMATIC();
3798
 
3733
 
3799
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3734
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3800
           if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
3735
           if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
3801
         #endif
3736
         #endif
3802
       }
3737
       }
3803
-
3804
     #endif // !DELTA
3738
     #endif // !DELTA
3805
 
3739
 
3806
-    // Final raise of Z axis after probing.
3807
-    raise_z_after_probing();
3808
-
3809
-    // Stow the probe. Servo will raise if needed.
3810
-    stow_z_probe();
3811
-
3812
-    // Restore state after probing
3813
-    clean_up_after_endstop_or_probe_move();
3814
-
3815
     #ifdef Z_PROBE_END_SCRIPT
3740
     #ifdef Z_PROBE_END_SCRIPT
3816
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3741
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3817
         if (DEBUGGING(LEVELING)) {
3742
         if (DEBUGGING(LEVELING)) {
3824
     #endif
3749
     #endif
3825
 
3750
 
3826
     #if ENABLED(DEBUG_LEVELING_FEATURE)
3751
     #if ENABLED(DEBUG_LEVELING_FEATURE)
3827
-      if (DEBUGGING(LEVELING)) {
3828
-        SERIAL_ECHOLNPGM("<<< gcode_G29");
3829
-      }
3752
+      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G29");
3830
     #endif
3753
     #endif
3831
 
3754
 
3832
     bed_leveling_in_progress = false;
3755
     bed_leveling_in_progress = false;
3847
 
3770
 
3848
     setup_for_endstop_or_probe_move();
3771
     setup_for_endstop_or_probe_move();
3849
 
3772
 
3850
-    deploy_z_probe();
3851
-
3852
-    stepper.synchronize();
3853
-
3854
     // TODO: clear the leveling matrix or the planner will be set incorrectly
3773
     // TODO: clear the leveling matrix or the planner will be set incorrectly
3855
-    float measured_z = run_z_probe(); // clears the ABL non-delta matrix only
3774
+    float measured_z = probe_pt(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
3775
+                                current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
3776
+                                true, 1);
3856
 
3777
 
3857
     SERIAL_PROTOCOLPGM("Bed X: ");
3778
     SERIAL_PROTOCOLPGM("Bed X: ");
3858
     SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
3779
     SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
3862
     SERIAL_PROTOCOL(measured_z + 0.0001);
3783
     SERIAL_PROTOCOL(measured_z + 0.0001);
3863
     SERIAL_EOL;
3784
     SERIAL_EOL;
3864
 
3785
 
3865
-    stow_z_probe();
3866
-
3867
     clean_up_after_endstop_or_probe_move();
3786
     clean_up_after_endstop_or_probe_move();
3868
 
3787
 
3869
     report_current_position();
3788
     report_current_position();
3870
   }
3789
   }
3871
 
3790
 
3791
+  #if ENABLED(Z_PROBE_SLED)
3792
+
3793
+    /**
3794
+     * G31: Deploy the Z probe
3795
+     */
3796
+    inline void gcode_G31() { deploy_z_probe(); }
3797
+
3798
+    /**
3799
+     * G32: Stow the Z probe
3800
+     */
3801
+    inline void gcode_G32() { stow_z_probe(); }
3802
+
3803
+  #endif // Z_PROBE_SLED
3804
+
3872
 #endif // HAS_BED_PROBE
3805
 #endif // HAS_BED_PROBE
3873
 
3806
 
3874
 /**
3807
 /**
4210
            Y_current = current_position[Y_AXIS];
4143
            Y_current = current_position[Y_AXIS];
4211
 
4144
 
4212
     #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
4145
     #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
4213
-      const bool deploy_probe_for_each_reading = false;
4146
+      const bool stow_probe_after_each = false;
4214
     #else
4147
     #else
4215
-      bool deploy_probe_for_each_reading = code_seen('E');
4148
+      bool stow_probe_after_each = code_seen('E');
4216
     #endif
4149
     #endif
4217
 
4150
 
4218
     float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
4151
     float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : X_current + X_PROBE_OFFSET_FROM_EXTRUDER;
4265
 
4198
 
4266
     setup_for_endstop_or_probe_move();
4199
     setup_for_endstop_or_probe_move();
4267
 
4200
 
4268
-    do_probe_raise(Z_RAISE_BEFORE_PROBING);
4269
-
4270
-    feedrate = XY_PROBE_FEEDRATE;
4271
-    do_blocking_move_to_xy(X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER), Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER));
4272
-
4273
-    /**
4274
-     * OK, do the initial probe to get us close to the bed.
4275
-     * Then retrace the right amount and use that in subsequent probes
4276
-     */
4277
-
4278
-    // Height before each probe (except the first)
4279
-    float z_between = deploy_probe_for_each_reading ? Z_RAISE_BEFORE_PROBING : Z_RAISE_BETWEEN_PROBINGS;
4280
-
4281
-    // Deploy the probe and probe the first point
4282
-    probe_pt(X_probe_location, Y_probe_location,
4283
-      Z_RAISE_BEFORE_PROBING,
4284
-      deploy_probe_for_each_reading ? ProbeDeployAndStow : ProbeDeploy,
4285
-      verbose_level);
4201
+    // Move to the first point, deploy, and probe
4202
+    probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
4286
 
4203
 
4287
     randomSeed(millis());
4204
     randomSeed(millis());
4288
 
4205
 
4302
         if (verbose_level > 3) {
4219
         if (verbose_level > 3) {
4303
           SERIAL_ECHOPAIR("Starting radius: ", radius);
4220
           SERIAL_ECHOPAIR("Starting radius: ", radius);
4304
           SERIAL_ECHOPAIR("   angle: ", angle);
4221
           SERIAL_ECHOPAIR("   angle: ", angle);
4305
-          delay(100);
4306
-          if (dir > 0)
4307
-            SERIAL_ECHO(" Direction: Counter Clockwise \n");
4308
-          else
4309
-            SERIAL_ECHO(" Direction: Clockwise \n");
4310
-          delay(100);
4222
+          SERIAL_ECHO(" Direction: ");
4223
+          if (dir > 0) SERIAL_ECHO("Counter ");
4224
+          SERIAL_ECHOLN("Clockwise");
4311
         }
4225
         }
4312
 
4226
 
4313
         for (uint8_t l = 0; l < n_legs - 1; l++) {
4227
         for (uint8_t l = 0; l < n_legs - 1; l++) {
4346
                 SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
4260
                 SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
4347
                 SERIAL_ECHOPAIR(", ", Y_current);
4261
                 SERIAL_ECHOPAIR(", ", Y_current);
4348
                 SERIAL_EOL;
4262
                 SERIAL_EOL;
4349
-                delay(50);
4350
               }
4263
               }
4351
             }
4264
             }
4352
           #endif
4265
           #endif
4356
             SERIAL_ECHOPAIR("y: ", Y_current);
4269
             SERIAL_ECHOPAIR("y: ", Y_current);
4357
             SERIAL_ECHOPAIR("  z: ", current_position[Z_AXIS]);
4270
             SERIAL_ECHOPAIR("  z: ", current_position[Z_AXIS]);
4358
             SERIAL_EOL;
4271
             SERIAL_EOL;
4359
-            delay(55);
4360
           }
4272
           }
4361
           do_blocking_move_to_xy(X_current, Y_current);
4273
           do_blocking_move_to_xy(X_current, Y_current);
4362
         } // n_legs loop
4274
         } // n_legs loop
4363
       } // n_legs
4275
       } // n_legs
4364
 
4276
 
4365
-      // The last probe will differ
4366
-      bool last_probe = (n == n_samples - 1);
4367
-
4368
       // Probe a single point
4277
       // Probe a single point
4369
-      sample_set[n] = probe_pt(
4370
-        X_probe_location, Y_probe_location,
4371
-        z_between,
4372
-        deploy_probe_for_each_reading ? ProbeDeployAndStow : last_probe ? ProbeStow : ProbeStay,
4373
-        verbose_level
4374
-      );
4278
+      sample_set[n] = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
4375
 
4279
 
4376
       /**
4280
       /**
4377
        * Get the current mean for the data points we have so far
4281
        * Get the current mean for the data points we have so far
4397
           SERIAL_PROTOCOL((int)n_samples);
4301
           SERIAL_PROTOCOL((int)n_samples);
4398
           SERIAL_PROTOCOLPGM("   z: ");
4302
           SERIAL_PROTOCOLPGM("   z: ");
4399
           SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
4303
           SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
4400
-          delay(50);
4401
           if (verbose_level > 2) {
4304
           if (verbose_level > 2) {
4402
             SERIAL_PROTOCOLPGM(" mean: ");
4305
             SERIAL_PROTOCOLPGM(" mean: ");
4403
             SERIAL_PROTOCOL_F(mean, 6);
4306
             SERIAL_PROTOCOL_F(mean, 6);
4408
         SERIAL_EOL;
4311
         SERIAL_EOL;
4409
       }
4312
       }
4410
 
4313
 
4411
-      // Raise before the next loop for the legs,
4412
-      // or do the final raise after the last probe
4413
-      if (last_probe)
4414
-        do_probe_raise(Z_RAISE_AFTER_PROBING);
4415
-      else if (n_legs) {
4416
-        do_probe_raise(z_between);
4417
-        if (!last_probe) delay(500);
4418
-      }
4419
-
4420
     } // End of probe loop
4314
     } // End of probe loop
4421
 
4315
 
4316
+    stow_z_probe();
4317
+
4422
     if (verbose_level > 0) {
4318
     if (verbose_level > 0) {
4423
       SERIAL_PROTOCOLPGM("Mean: ");
4319
       SERIAL_PROTOCOLPGM("Mean: ");
4424
       SERIAL_PROTOCOL_F(mean, 6);
4320
       SERIAL_PROTOCOL_F(mean, 6);
5967
   /**
5863
   /**
5968
    * M401: Engage Z Servo endstop if available
5864
    * M401: Engage Z Servo endstop if available
5969
    */
5865
    */
5970
-  inline void gcode_M401() {
5971
-    deploy_z_probe();
5972
-  }
5866
+  inline void gcode_M401() { deploy_z_probe(); }
5973
 
5867
 
5974
   /**
5868
   /**
5975
    * M402: Retract Z Servo endstop if enabled
5869
    * M402: Retract Z Servo endstop if enabled
5976
    */
5870
    */
5977
-  inline void gcode_M402() {
5978
-    stow_z_probe();
5979
-  }
5871
+  inline void gcode_M402() { stow_z_probe(); }
5980
 
5872
 
5981
 #endif // HAS_BED_PROBE
5873
 #endif // HAS_BED_PROBE
5982
 
5874
 
6858
         #if ENABLED(Z_PROBE_SLED)
6750
         #if ENABLED(Z_PROBE_SLED)
6859
 
6751
 
6860
             case 31: // G31: dock the sled
6752
             case 31: // G31: dock the sled
6861
-              stow_z_probe();
6753
+              gcode_G31();
6862
               break;
6754
               break;
6755
+
6863
             case 32: // G32: undock the sled
6756
             case 32: // G32: undock the sled
6864
-              deploy_z_probe();
6757
+              gcode_G32();
6865
               break;
6758
               break;
6866
 
6759
 
6867
         #endif // Z_PROBE_SLED
6760
         #endif // Z_PROBE_SLED

+ 4
- 2
Marlin/SanityCheck.h Visa fil

593
   #error "Z_LATE_ENABLE can't be used with COREXZ."
593
   #error "Z_LATE_ENABLE can't be used with COREXZ."
594
 #elif defined(X_HOME_RETRACT_MM)
594
 #elif defined(X_HOME_RETRACT_MM)
595
   #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
595
   #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
596
-#elif defined(PROBE_SERVO_DEACTIVATION_DELAY)
597
-  #error "PROBE_SERVO_DEACTIVATION_DELAY has been replaced with DEACTIVATE_SERVOS_AFTER_MOVE and SERVO_DEACTIVATION_DELAY."
598
 #elif defined(BEEPER)
596
 #elif defined(BEEPER)
599
   #error "BEEPER is now BEEPER_PIN. Please update your pins definitions."
597
   #error "BEEPER is now BEEPER_PIN. Please update your pins definitions."
600
 #elif defined(SDCARDDETECT)
598
 #elif defined(SDCARDDETECT)
635
   #error "X_ENDSTOP_SERVO_NR and Y_ENDSTOP_SERVO_NR are deprecated and should be removed."
633
   #error "X_ENDSTOP_SERVO_NR and Y_ENDSTOP_SERVO_NR are deprecated and should be removed."
636
 #elif defined(XY_TRAVEL_SPEED)
634
 #elif defined(XY_TRAVEL_SPEED)
637
   #error "XY_TRAVEL_SPEED is deprecated. Use XY_PROBE_SPEED instead."
635
   #error "XY_TRAVEL_SPEED is deprecated. Use XY_PROBE_SPEED instead."
636
+#elif defined(PROBE_SERVO_DEACTIVATION_DELAY)
637
+  #error "PROBE_SERVO_DEACTIVATION_DELAY is deprecated. Use DEACTIVATE_SERVOS_AFTER_MOVE instead."
638
+#elif defined(SERVO_DEACTIVATION_DELAY)
639
+  #error "SERVO_DEACTIVATION_DELAY is deprecated. Use SERVO_DELAY instead."
638
 #endif
640
 #endif
639
 
641
 
640
 #endif //SANITYCHECK_H
642
 #endif //SANITYCHECK_H

+ 5
- 7
Marlin/example_configurations/Cartesio/Configuration.h Visa fil

1172
 //
1172
 //
1173
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1173
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1174
 
1174
 
1175
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1176
+// 300ms is a good value but you can try less delay.
1177
+// If the servo can't reach the requested position, increase it.
1178
+#define SERVO_DELAY 300
1179
+
1175
 // Servo deactivation
1180
 // Servo deactivation
1176
 //
1181
 //
1177
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1182
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1178
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1183
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1179
 
1184
 
1180
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1181
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1182
-  // 300ms is a good value but you can try less delay.
1183
-  // If the servo can't reach the requested position, increase it.
1184
-  #define SERVO_DEACTIVATION_DELAY 300
1185
-#endif
1186
-
1187
 /**********************************************************************\
1185
 /**********************************************************************\
1188
  * Support for a filament diameter sensor
1186
  * Support for a filament diameter sensor
1189
  * Also allows adjustment of diameter at print time (vs  at slicing)
1187
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/Felix/Configuration.h Visa fil

1156
 //
1156
 //
1157
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1157
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1158
 
1158
 
1159
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1160
+// 300ms is a good value but you can try less delay.
1161
+// If the servo can't reach the requested position, increase it.
1162
+#define SERVO_DELAY 300
1163
+
1159
 // Servo deactivation
1164
 // Servo deactivation
1160
 //
1165
 //
1161
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1166
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1162
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1167
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1163
 
1168
 
1164
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1165
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1166
-  // 300ms is a good value but you can try less delay.
1167
-  // If the servo can't reach the requested position, increase it.
1168
-  #define SERVO_DEACTIVATION_DELAY 300
1169
-#endif
1170
-
1171
 /**********************************************************************\
1169
 /**********************************************************************\
1172
  * Support for a filament diameter sensor
1170
  * Support for a filament diameter sensor
1173
  * Also allows adjustment of diameter at print time (vs  at slicing)
1171
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/Felix/DUAL/Configuration.h Visa fil

1154
 //
1154
 //
1155
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1155
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1156
 
1156
 
1157
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1158
+// 300ms is a good value but you can try less delay.
1159
+// If the servo can't reach the requested position, increase it.
1160
+#define SERVO_DELAY 300
1161
+
1157
 // Servo deactivation
1162
 // Servo deactivation
1158
 //
1163
 //
1159
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1164
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1160
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1165
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1161
 
1166
 
1162
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1163
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1164
-  // 300ms is a good value but you can try less delay.
1165
-  // If the servo can't reach the requested position, increase it.
1166
-  #define SERVO_DEACTIVATION_DELAY 300
1167
-#endif
1168
-
1169
 /**********************************************************************\
1167
 /**********************************************************************\
1170
  * Support for a filament diameter sensor
1168
  * Support for a filament diameter sensor
1171
  * Also allows adjustment of diameter at print time (vs  at slicing)
1169
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/Hephestos/Configuration.h Visa fil

1165
 //
1165
 //
1166
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1166
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1167
 
1167
 
1168
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1169
+// 300ms is a good value but you can try less delay.
1170
+// If the servo can't reach the requested position, increase it.
1171
+#define SERVO_DELAY 300
1172
+
1168
 // Servo deactivation
1173
 // Servo deactivation
1169
 //
1174
 //
1170
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1175
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1171
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1176
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1172
 
1177
 
1173
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1174
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1175
-  // 300ms is a good value but you can try less delay.
1176
-  // If the servo can't reach the requested position, increase it.
1177
-  #define SERVO_DEACTIVATION_DELAY 300
1178
-#endif
1179
-
1180
 /**********************************************************************\
1178
 /**********************************************************************\
1181
  * Support for a filament diameter sensor
1179
  * Support for a filament diameter sensor
1182
  * Also allows adjustment of diameter at print time (vs  at slicing)
1180
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/Hephestos_2/Configuration.h Visa fil

1167
 //
1167
 //
1168
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1168
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1169
 
1169
 
1170
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1171
+// 300ms is a good value but you can try less delay.
1172
+// If the servo can't reach the requested position, increase it.
1173
+#define SERVO_DELAY 300
1174
+
1170
 // Servo deactivation
1175
 // Servo deactivation
1171
 //
1176
 //
1172
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1177
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1173
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1178
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1174
 
1179
 
1175
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1176
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1177
-  // 300ms is a good value but you can try less delay.
1178
-  // If the servo can't reach the requested position, increase it.
1179
-  #define SERVO_DEACTIVATION_DELAY 300
1180
-#endif
1181
-
1182
 /**********************************************************************\
1180
 /**********************************************************************\
1183
  * Support for a filament diameter sensor
1181
  * Support for a filament diameter sensor
1184
  * Also allows adjustment of diameter at print time (vs  at slicing)
1182
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/K8200/Configuration.h Visa fil

1190
 //
1190
 //
1191
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1191
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1192
 
1192
 
1193
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1194
+// 300ms is a good value but you can try less delay.
1195
+// If the servo can't reach the requested position, increase it.
1196
+#define SERVO_DELAY 300
1197
+
1193
 // Servo deactivation
1198
 // Servo deactivation
1194
 //
1199
 //
1195
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1200
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1196
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1201
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1197
 
1202
 
1198
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1199
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1200
-  // 300ms is a good value but you can try less delay.
1201
-  // If the servo can't reach the requested position, increase it.
1202
-  #define SERVO_DEACTIVATION_DELAY 300
1203
-#endif
1204
-
1205
 /**********************************************************************\
1203
 /**********************************************************************\
1206
  * Support for a filament diameter sensor
1204
  * Support for a filament diameter sensor
1207
  * Also allows adjustment of diameter at print time (vs  at slicing)
1205
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h Visa fil

1173
 //
1173
 //
1174
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1174
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1175
 
1175
 
1176
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1177
+// 300ms is a good value but you can try less delay.
1178
+// If the servo can't reach the requested position, increase it.
1179
+#define SERVO_DELAY 300
1180
+
1176
 // Servo deactivation
1181
 // Servo deactivation
1177
 //
1182
 //
1178
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1183
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1179
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1184
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1180
 
1185
 
1181
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1182
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1183
-  // 300ms is a good value but you can try less delay.
1184
-  // If the servo can't reach the requested position, increase it.
1185
-  #define SERVO_DEACTIVATION_DELAY 300
1186
-#endif
1187
-
1188
 /**********************************************************************\
1186
 /**********************************************************************\
1189
  * Support for a filament diameter sensor
1187
  * Support for a filament diameter sensor
1190
  * Also allows adjustment of diameter at print time (vs  at slicing)
1188
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/RigidBot/Configuration.h Visa fil

1170
 //
1170
 //
1171
 #define NUM_SERVOS 0 // DGlass3D - Servo index starts with 0 for M280 command
1171
 #define NUM_SERVOS 0 // DGlass3D - Servo index starts with 0 for M280 command
1172
 
1172
 
1173
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1174
+// 300ms is a good value but you can try less delay.
1175
+// If the servo can't reach the requested position, increase it.
1176
+#define SERVO_DELAY 300
1177
+
1173
 // Servo deactivation
1178
 // Servo deactivation
1174
 //
1179
 //
1175
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1180
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1176
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1181
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1177
 
1182
 
1178
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1179
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1180
-  // 300ms is a good value but you can try less delay.
1181
-  // If the servo can't reach the requested position, increase it.
1182
-  #define SERVO_DEACTIVATION_DELAY 300
1183
-#endif
1184
-
1185
 /**********************************************************************\
1183
 /**********************************************************************\
1186
  * Support for a filament diameter sensor
1184
  * Support for a filament diameter sensor
1187
  * Also allows adjustment of diameter at print time (vs  at slicing)
1185
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/SCARA/Configuration.h Visa fil

1181
 //
1181
 //
1182
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1182
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1183
 
1183
 
1184
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1185
+// 300ms is a good value but you can try less delay.
1186
+// If the servo can't reach the requested position, increase it.
1187
+#define SERVO_DELAY 300
1188
+
1184
 // Servo deactivation
1189
 // Servo deactivation
1185
 //
1190
 //
1186
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1191
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1187
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1192
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1188
 
1193
 
1189
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1190
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1191
-  // 300ms is a good value but you can try less delay.
1192
-  // If the servo can't reach the requested position, increase it.
1193
-  #define SERVO_DEACTIVATION_DELAY 300
1194
-#endif
1195
-
1196
 /**********************************************************************\
1194
 /**********************************************************************\
1197
  * Support for a filament diameter sensor
1195
  * Support for a filament diameter sensor
1198
  * Also allows adjustment of diameter at print time (vs  at slicing)
1196
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/TAZ4/Configuration.h Visa fil

1194
 //
1194
 //
1195
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1195
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1196
 
1196
 
1197
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1198
+// 300ms is a good value but you can try less delay.
1199
+// If the servo can't reach the requested position, increase it.
1200
+#define SERVO_DELAY 300
1201
+
1197
 // Servo deactivation
1202
 // Servo deactivation
1198
 //
1203
 //
1199
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1204
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1200
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1205
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1201
 
1206
 
1202
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1203
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1204
-  // 300ms is a good value but you can try less delay.
1205
-  // If the servo can't reach the requested position, increase it.
1206
-  #define SERVO_DEACTIVATION_DELAY 300
1207
-#endif
1208
-
1209
 /**********************************************************************\
1207
 /**********************************************************************\
1210
  * Support for a filament diameter sensor
1208
  * Support for a filament diameter sensor
1211
  * Also allows adjustment of diameter at print time (vs  at slicing)
1209
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/WITBOX/Configuration.h Visa fil

1165
 //
1165
 //
1166
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1166
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1167
 
1167
 
1168
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1169
+// 300ms is a good value but you can try less delay.
1170
+// If the servo can't reach the requested position, increase it.
1171
+#define SERVO_DELAY 300
1172
+
1168
 // Servo deactivation
1173
 // Servo deactivation
1169
 //
1174
 //
1170
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1175
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1171
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1176
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1172
 
1177
 
1173
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1174
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1175
-  // 300ms is a good value but you can try less delay.
1176
-  // If the servo can't reach the requested position, increase it.
1177
-  #define SERVO_DEACTIVATION_DELAY 300
1178
-#endif
1179
-
1180
 /**********************************************************************\
1178
 /**********************************************************************\
1181
  * Support for a filament diameter sensor
1179
  * Support for a filament diameter sensor
1182
  * Also allows adjustment of diameter at print time (vs  at slicing)
1180
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/adafruit/ST7565/Configuration.h Visa fil

1173
 //
1173
 //
1174
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1174
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1175
 
1175
 
1176
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1177
+// 300ms is a good value but you can try less delay.
1178
+// If the servo can't reach the requested position, increase it.
1179
+#define SERVO_DELAY 300
1180
+
1176
 // Servo deactivation
1181
 // Servo deactivation
1177
 //
1182
 //
1178
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1183
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1179
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1184
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1180
 
1185
 
1181
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1182
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1183
-  // 300ms is a good value but you can try less delay.
1184
-  // If the servo can't reach the requested position, increase it.
1185
-  #define SERVO_DEACTIVATION_DELAY 300
1186
-#endif
1187
-
1188
 /**********************************************************************\
1186
 /**********************************************************************\
1189
  * Support for a filament diameter sensor
1187
  * Support for a filament diameter sensor
1190
  * Also allows adjustment of diameter at print time (vs  at slicing)
1188
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/delta/biv2.5/Configuration.h Visa fil

1258
 //
1258
 //
1259
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1259
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1260
 
1260
 
1261
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1262
+// 300ms is a good value but you can try less delay.
1263
+// If the servo can't reach the requested position, increase it.
1264
+#define SERVO_DELAY 300
1265
+
1261
 // Servo deactivation
1266
 // Servo deactivation
1262
 //
1267
 //
1263
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1268
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1264
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1269
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1265
 
1270
 
1266
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1267
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1268
-  // 300ms is a good value but you can try less delay.
1269
-  // If the servo can't reach the requested position, increase it.
1270
-  #define SERVO_DEACTIVATION_DELAY 300
1271
-#endif
1272
-
1273
 /**********************************************************************\
1271
 /**********************************************************************\
1274
  * Support for a filament diameter sensor
1272
  * Support for a filament diameter sensor
1275
  * Also allows adjustment of diameter at print time (vs  at slicing)
1273
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/delta/generic/Configuration.h Visa fil

1252
 //
1252
 //
1253
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1253
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1254
 
1254
 
1255
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1256
+// 300ms is a good value but you can try less delay.
1257
+// If the servo can't reach the requested position, increase it.
1258
+#define SERVO_DELAY 300
1259
+
1255
 // Servo deactivation
1260
 // Servo deactivation
1256
 //
1261
 //
1257
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1262
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1258
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1263
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1259
 
1264
 
1260
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1261
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1262
-  // 300ms is a good value but you can try less delay.
1263
-  // If the servo can't reach the requested position, increase it.
1264
-  #define SERVO_DEACTIVATION_DELAY 300
1265
-#endif
1266
-
1267
 /**********************************************************************\
1265
 /**********************************************************************\
1268
  * Support for a filament diameter sensor
1266
  * Support for a filament diameter sensor
1269
  * Also allows adjustment of diameter at print time (vs  at slicing)
1267
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/delta/kossel_mini/Configuration.h Visa fil

1255
 //
1255
 //
1256
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1256
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1257
 
1257
 
1258
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1259
+// 300ms is a good value but you can try less delay.
1260
+// If the servo can't reach the requested position, increase it.
1261
+#define SERVO_DELAY 300
1262
+
1258
 // Servo deactivation
1263
 // Servo deactivation
1259
 //
1264
 //
1260
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1265
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1261
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1266
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1262
 
1267
 
1263
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1264
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1265
-  // 300ms is a good value but you can try less delay.
1266
-  // If the servo can't reach the requested position, increase it.
1267
-  #define SERVO_DEACTIVATION_DELAY 300
1268
-#endif
1269
-
1270
 /**********************************************************************\
1268
 /**********************************************************************\
1271
  * Support for a filament diameter sensor
1269
  * Support for a filament diameter sensor
1272
  * Also allows adjustment of diameter at print time (vs  at slicing)
1270
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/delta/kossel_pro/Configuration.h Visa fil

1255
 //
1255
 //
1256
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1256
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1257
 
1257
 
1258
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1259
+// 300ms is a good value but you can try less delay.
1260
+// If the servo can't reach the requested position, increase it.
1261
+#define SERVO_DELAY 300
1262
+
1258
 // Servo deactivation
1263
 // Servo deactivation
1259
 //
1264
 //
1260
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1265
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1261
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1266
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1262
 
1267
 
1263
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1264
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1265
-  // 300ms is a good value but you can try less delay.
1266
-  // If the servo can't reach the requested position, increase it.
1267
-  #define SERVO_DEACTIVATION_DELAY 300
1268
-#endif
1269
-
1270
 /**********************************************************************\
1268
 /**********************************************************************\
1271
  * Support for a filament diameter sensor
1269
  * Support for a filament diameter sensor
1272
  * Also allows adjustment of diameter at print time (vs  at slicing)
1270
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/delta/kossel_xl/Configuration.h Visa fil

1257
 //
1257
 //
1258
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1258
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1259
 
1259
 
1260
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1261
+// 300ms is a good value but you can try less delay.
1262
+// If the servo can't reach the requested position, increase it.
1263
+#define SERVO_DELAY 300
1264
+
1260
 // Servo deactivation
1265
 // Servo deactivation
1261
 //
1266
 //
1262
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1267
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1263
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1268
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1264
 
1269
 
1265
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1266
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1267
-  // 300ms is a good value but you can try less delay.
1268
-  // If the servo can't reach the requested position, increase it.
1269
-  #define SERVO_DEACTIVATION_DELAY 300
1270
-#endif
1271
-
1272
 /**********************************************************************\
1270
 /**********************************************************************\
1273
  * Support for a filament diameter sensor
1271
  * Support for a filament diameter sensor
1274
  * Also allows adjustment of diameter at print time (vs  at slicing)
1272
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/makibox/Configuration.h Visa fil

1176
 //
1176
 //
1177
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1177
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1178
 
1178
 
1179
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1180
+// 300ms is a good value but you can try less delay.
1181
+// If the servo can't reach the requested position, increase it.
1182
+#define SERVO_DELAY 300
1183
+
1179
 // Servo deactivation
1184
 // Servo deactivation
1180
 //
1185
 //
1181
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1186
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1182
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1187
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1183
 
1188
 
1184
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1185
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1186
-  // 300ms is a good value but you can try less delay.
1187
-  // If the servo can't reach the requested position, increase it.
1188
-  #define SERVO_DEACTIVATION_DELAY 300
1189
-#endif
1190
-
1191
 /**********************************************************************\
1189
 /**********************************************************************\
1192
  * Support for a filament diameter sensor
1190
  * Support for a filament diameter sensor
1193
  * Also allows adjustment of diameter at print time (vs  at slicing)
1191
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 5
- 7
Marlin/example_configurations/tvrrug/Round2/Configuration.h Visa fil

1167
 //
1167
 //
1168
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1168
 //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1169
 
1169
 
1170
+// Delay (in microseconds) before the next move will start, to give the servo time to reach its target angle.
1171
+// 300ms is a good value but you can try less delay.
1172
+// If the servo can't reach the requested position, increase it.
1173
+#define SERVO_DELAY 300
1174
+
1170
 // Servo deactivation
1175
 // Servo deactivation
1171
 //
1176
 //
1172
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1177
 // With this option servos are powered only during movement, then turned off to prevent jitter.
1173
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1178
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
1174
 
1179
 
1175
-#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
1176
-  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
1177
-  // 300ms is a good value but you can try less delay.
1178
-  // If the servo can't reach the requested position, increase it.
1179
-  #define SERVO_DEACTIVATION_DELAY 300
1180
-#endif
1181
-
1182
 /**********************************************************************\
1180
 /**********************************************************************\
1183
  * Support for a filament diameter sensor
1181
  * Support for a filament diameter sensor
1184
  * Also allows adjustment of diameter at print time (vs  at slicing)
1182
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 28
- 42
Marlin/servo.cpp Visa fil

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
25
- Copyright (c) 2009 Michael Margolis.  All right reserved.
26
-
27
- This library is free software; you can redistribute it and/or
28
- modify it under the terms of the GNU Lesser General Public
29
- License as published by the Free Software Foundation; either
30
- version 2.1 of the License, or (at your option) any later version.
31
-
32
- This library is distributed in the hope that it will be useful,
33
- but WITHOUT ANY WARRANTY; without even the implied warranty of
34
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
35
- Lesser General Public License for more details.
36
-
37
- You should have received a copy of the GNU Lesser General Public
38
- License along with this library; if not, write to the Free Software
39
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24
+ * servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
25
+ * Copyright (c) 2009 Michael Margolis.  All right reserved.
40
  */
26
  */
41
 
27
 
42
 /**
28
 /**
43
-
44
- A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
45
- The servos are pulsed in the background using the value most recently written using the write() method
46
-
47
- Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
48
- Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
49
-
50
- The methods are:
51
-
52
- Servo - Class for manipulating servo motors connected to Arduino pins.
53
-
54
- attach(pin )  - Attaches a servo motor to an i/o pin.
55
- attach(pin, min, max  ) - Attaches to a pin setting min and max values in microseconds
56
- default min is 544, max is 2400
57
-
58
- write()     - Sets the servo angle in degrees.  (invalid angle that is valid as pulse in microseconds is treated as microseconds)
59
- writeMicroseconds() - Sets the servo pulse width in microseconds
60
- move(pin, angle) - Sequence of attach(pin), write(angle).
61
-                    With DEACTIVATE_SERVOS_AFTER_MOVE it waits SERVO_DEACTIVATION_DELAY and detaches.
62
- read()      - Gets the last written servo pulse width as an angle between 0 and 180.
63
- readMicroseconds()   - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
64
- attached()  - Returns true if there is a servo attached.
65
- detach()    - Stops an attached servos from pulsing its i/o pin.
66
-
67
-*/
29
+ * A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
30
+ * The servos are pulsed in the background using the value most recently written using the write() method
31
+ *
32
+ * Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
33
+ * Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
34
+ *
35
+ * The methods are:
36
+ *
37
+ * Servo - Class for manipulating servo motors connected to Arduino pins.
38
+ *
39
+ * attach(pin)           - Attach a servo motor to an i/o pin.
40
+ * attach(pin, min, max) - Attach to a pin, setting min and max values in microseconds
41
+ *                         Default min is 544, max is 2400
42
+ *
43
+ * write()               - Set the servo angle in degrees. (Invalid angles —over MIN_PULSE_WIDTH— are treated as µs.)
44
+ * writeMicroseconds()   - Set the servo pulse width in microseconds.
45
+ * move(pin, angle)      - Sequence of attach(pin), write(angle), delay(SERVO_DELAY).
46
+ *                         With DEACTIVATE_SERVOS_AFTER_MOVE it detaches after SERVO_DELAY.
47
+ * read()                - Get the last-written servo pulse width as an angle between 0 and 180.
48
+ * readMicroseconds()    - Get the last-written servo pulse width in microseconds.
49
+ * attached()            - Return true if a servo is attached.
50
+ * detach()              - Stop an attached servo from pulsing its i/o pin.
51
+ *
52
+ */
68
 #include "Configuration.h"
53
 #include "Configuration.h"
69
 
54
 
70
 #if HAS_SERVOS
55
 #if HAS_SERVOS
238
     }
223
     }
239
   #else //!WIRING
224
   #else //!WIRING
240
     // For arduino - in future: call here to a currently undefined function to reset the timer
225
     // For arduino - in future: call here to a currently undefined function to reset the timer
226
+	UNUSED(timer);
241
   #endif
227
   #endif
242
 }
228
 }
243
 
229
 
324
 void Servo::move(int value) {
310
 void Servo::move(int value) {
325
   if (this->attach(0) >= 0) {
311
   if (this->attach(0) >= 0) {
326
     this->write(value);
312
     this->write(value);
313
+    delay(SERVO_DELAY);
327
     #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
314
     #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
328
-      delay(SERVO_DEACTIVATION_DELAY);
329
       this->detach();
315
       this->detach();
330
     #endif
316
     #endif
331
   }
317
   }

+ 2
- 2
Marlin/servo.h Visa fil

63
    attached()  - Returns true if there is a servo attached.
63
    attached()  - Returns true if there is a servo attached.
64
    detach()    - Stops an attached servos from pulsing its i/o pin.
64
    detach()    - Stops an attached servos from pulsing its i/o pin.
65
    move(angle) - Sequence of attach(0), write(angle),
65
    move(angle) - Sequence of attach(0), write(angle),
66
-                   With DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DEACTIVATION_DELAY and detach.
66
+                   With DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY and detach.
67
  */
67
  */
68
 
68
 
69
 #ifndef servo_h
69
 #ifndef servo_h
147
     void writeMicroseconds(int value); // write pulse width in microseconds
147
     void writeMicroseconds(int value); // write pulse width in microseconds
148
     void move(int value);              // attach the servo, then move to value
148
     void move(int value);              // attach the servo, then move to value
149
                                        // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
149
                                        // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
150
-                                       // if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DEACTIVATION_DELAY, then detach
150
+                                       // if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach
151
     int read();                        // returns current pulse width as an angle between 0 and 180 degrees
151
     int read();                        // returns current pulse width as an angle between 0 and 180 degrees
152
     int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
152
     int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
153
     bool attached();                   // return true if this servo is attached, otherwise false
153
     bool attached();                   // return true if this servo is attached, otherwise false

Laddar…
Avbryt
Spara