Browse Source

Merge pull request #4320 from jbrazio/followup/4307

Moves do_blocking_move_to_xy() out of the HAS_BED_PROBE define
João Brázio 8 years ago
parent
commit
d7c51bc4b9
1 changed files with 56 additions and 54 deletions
  1. 56
    54
      Marlin/Marlin_main.cpp

+ 56
- 54
Marlin/Marlin_main.cpp View File

@@ -1623,34 +1623,6 @@ inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[
1623 1623
 inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
1624 1624
 inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
1625 1625
 
1626
-//
1627
-// Prepare to do endstop or probe moves
1628
-// with custom feedrates.
1629
-//
1630
-//  - Save current feedrates
1631
-//  - Reset the rate multiplier
1632
-//  - Reset the command timeout
1633
-//  - Enable the endstops (for endstop moves)
1634
-//
1635
-static void setup_for_endstop_or_probe_move() {
1636
-  #if ENABLED(DEBUG_LEVELING_FEATURE)
1637
-    if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
1638
-  #endif
1639
-  saved_feedrate = feedrate;
1640
-  saved_feedrate_multiplier = feedrate_multiplier;
1641
-  feedrate_multiplier = 100;
1642
-  refresh_cmd_timeout();
1643
-}
1644
-
1645
-static void clean_up_after_endstop_or_probe_move() {
1646
-  #if ENABLED(DEBUG_LEVELING_FEATURE)
1647
-    if (DEBUGGING(LEVELING)) DEBUG_POS("clean_up_after_endstop_or_probe_move", current_position);
1648
-  #endif
1649
-  feedrate = saved_feedrate;
1650
-  feedrate_multiplier = saved_feedrate_multiplier;
1651
-  refresh_cmd_timeout();
1652
-}
1653
-
1654 1626
 #if ENABLED(DELTA)
1655 1627
   /**
1656 1628
    * Calculate delta, start a line, and set current_position to destination
@@ -1734,6 +1706,38 @@ inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
1734 1706
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
1735 1707
 }
1736 1708
 
1709
+inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
1710
+  do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
1711
+}
1712
+
1713
+//
1714
+// Prepare to do endstop or probe moves
1715
+// with custom feedrates.
1716
+//
1717
+//  - Save current feedrates
1718
+//  - Reset the rate multiplier
1719
+//  - Reset the command timeout
1720
+//  - Enable the endstops (for endstop moves)
1721
+//
1722
+static void setup_for_endstop_or_probe_move() {
1723
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
1724
+    if (DEBUGGING(LEVELING)) DEBUG_POS("setup_for_endstop_or_probe_move", current_position);
1725
+  #endif
1726
+  saved_feedrate = feedrate;
1727
+  saved_feedrate_multiplier = feedrate_multiplier;
1728
+  feedrate_multiplier = 100;
1729
+  refresh_cmd_timeout();
1730
+}
1731
+
1732
+static void clean_up_after_endstop_or_probe_move() {
1733
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
1734
+    if (DEBUGGING(LEVELING)) DEBUG_POS("clean_up_after_endstop_or_probe_move", current_position);
1735
+  #endif
1736
+  feedrate = saved_feedrate;
1737
+  feedrate_multiplier = saved_feedrate_multiplier;
1738
+  refresh_cmd_timeout();
1739
+}
1740
+
1737 1741
 #if HAS_BED_PROBE
1738 1742
   /**
1739 1743
    * Raise Z to a minimum height to make room for a probe to move
@@ -1756,33 +1760,31 @@ inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
1756 1760
 
1757 1761
 #endif //HAS_BED_PROBE
1758 1762
 
1759
-#if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE || HOTENDS > 1
1760
-  static bool axis_unhomed_error(const bool x, const bool y, const bool z) {
1761
-    const bool xx = x && !axis_homed[X_AXIS],
1762
-               yy = y && !axis_homed[Y_AXIS],
1763
-               zz = z && !axis_homed[Z_AXIS];
1764
-    if (xx || yy || zz) {
1765
-      SERIAL_ECHO_START;
1766
-      SERIAL_ECHOPGM(MSG_HOME " ");
1767
-      if (xx) SERIAL_ECHOPGM(MSG_X);
1768
-      if (yy) SERIAL_ECHOPGM(MSG_Y);
1769
-      if (zz) SERIAL_ECHOPGM(MSG_Z);
1770
-      SERIAL_ECHOLNPGM(" " MSG_FIRST);
1771
-
1772
-      #if ENABLED(ULTRA_LCD)
1773
-        char message[3 * (LCD_WIDTH) + 1] = ""; // worst case is kana.utf with up to 3*LCD_WIDTH+1
1774
-        strcat_P(message, PSTR(MSG_HOME " "));
1775
-        if (xx) strcat_P(message, PSTR(MSG_X));
1776
-        if (yy) strcat_P(message, PSTR(MSG_Y));
1777
-        if (zz) strcat_P(message, PSTR(MSG_Z));
1778
-        strcat_P(message, PSTR(" " MSG_FIRST));
1779
-        lcd_setstatus(message);
1780
-      #endif
1781
-      return true;
1782
-    }
1783
-    return false;
1763
+static bool axis_unhomed_error(const bool x, const bool y, const bool z) {
1764
+  const bool xx = x && !axis_homed[X_AXIS],
1765
+             yy = y && !axis_homed[Y_AXIS],
1766
+             zz = z && !axis_homed[Z_AXIS];
1767
+  if (xx || yy || zz) {
1768
+    SERIAL_ECHO_START;
1769
+    SERIAL_ECHOPGM(MSG_HOME " ");
1770
+    if (xx) SERIAL_ECHOPGM(MSG_X);
1771
+    if (yy) SERIAL_ECHOPGM(MSG_Y);
1772
+    if (zz) SERIAL_ECHOPGM(MSG_Z);
1773
+    SERIAL_ECHOLNPGM(" " MSG_FIRST);
1774
+
1775
+    #if ENABLED(ULTRA_LCD)
1776
+      char message[3 * (LCD_WIDTH) + 1] = ""; // worst case is kana.utf with up to 3*LCD_WIDTH+1
1777
+      strcat_P(message, PSTR(MSG_HOME " "));
1778
+      if (xx) strcat_P(message, PSTR(MSG_X));
1779
+      if (yy) strcat_P(message, PSTR(MSG_Y));
1780
+      if (zz) strcat_P(message, PSTR(MSG_Z));
1781
+      strcat_P(message, PSTR(" " MSG_FIRST));
1782
+      lcd_setstatus(message);
1783
+    #endif
1784
+    return true;
1784 1785
   }
1785
-#endif
1786
+  return false;
1787
+}
1786 1788
 
1787 1789
 #if ENABLED(Z_PROBE_SLED)
1788 1790
 

Loading…
Cancel
Save