Ver código fonte

Various code style tweaks

Scott Lahteine 8 anos atrás
pai
commit
a27b08e6af
4 arquivos alterados com 76 adições e 63 exclusões
  1. 8
    8
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 57
    43
      Marlin/Marlin_main.cpp
  3. 3
    2
      Marlin/ubl.h
  4. 8
    10
      Marlin/ubl_motion.cpp

+ 8
- 8
Marlin/G26_Mesh_Validation_Tool.cpp Ver arquivo

@@ -252,8 +252,8 @@
252 252
     // Move nozzle to the specified height for the first layer
253 253
     set_destination_to_current();
254 254
     destination[Z_AXIS] = g26_layer_height;
255
-    move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0.0);
256
-    move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], g26_ooze_amount);
255
+    move_to(destination, 0.0);
256
+    move_to(destination, g26_ooze_amount);
257 257
 
258 258
     has_control_of_lcd_panel = true;
259 259
     //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
@@ -368,14 +368,14 @@
368 368
     destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
369 369
 
370 370
     //debug_current_and_destination(PSTR("ready to do Z-Raise."));
371
-    move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Raise the nozzle
371
+    move_to(destination, 0); // Raise the nozzle
372 372
     //debug_current_and_destination(PSTR("done doing Z-Raise."));
373 373
 
374 374
     destination[X_AXIS] = g26_x_pos;                                               // Move back to the starting position
375 375
     destination[Y_AXIS] = g26_y_pos;
376 376
     //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;                        // Keep the nozzle where it is
377 377
 
378
-    move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Move back to the starting position
378
+    move_to(destination, 0); // Move back to the starting position
379 379
     //debug_current_and_destination(PSTR("done doing X/Y move."));
380 380
 
381 381
     has_control_of_lcd_panel = false;     // Give back control of the LCD Panel!
@@ -554,16 +554,16 @@
554 554
 
555 555
   }
556 556
 
557
-  void unified_bed_leveling::retract_filament(float where[XYZE]) {
557
+  void unified_bed_leveling::retract_filament(const float where[XYZE]) {
558 558
     if (!g26_retracted) { // Only retract if we are not already retracted!
559 559
       g26_retracted = true;
560
-      move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], -1.0 * g26_retraction_multiplier);
560
+      move_to(where, -1.0 * g26_retraction_multiplier);
561 561
     }
562 562
   }
563 563
 
564
-  void unified_bed_leveling::recover_filament(float where[XYZE]) {
564
+  void unified_bed_leveling::recover_filament(const float where[XYZE]) {
565 565
     if (g26_retracted) { // Only un-retract if we are retracted.
566
-      move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], 1.2 * g26_retraction_multiplier);
566
+      move_to(where, 1.2 * g26_retraction_multiplier);
567 567
       g26_retracted = false;
568 568
     }
569 569
   }

+ 57
- 43
Marlin/Marlin_main.cpp Ver arquivo

@@ -1561,16 +1561,16 @@ inline void set_destination_to_current() { COPY(destination, current_position);
1561 1561
  *  Plan a move to (X, Y, Z) and set the current_position
1562 1562
  *  The final current_position may not be the one that was requested
1563 1563
  */
1564
-void do_blocking_move_to(const float &x, const float &y, const float &z, const float &fr_mm_s /*=0.0*/) {
1564
+void do_blocking_move_to(const float &lx, const float &ly, const float &lz, const float &fr_mm_s/*=0.0*/) {
1565 1565
   const float old_feedrate_mm_s = feedrate_mm_s;
1566 1566
 
1567 1567
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1568
-    if (DEBUGGING(LEVELING)) print_xyz(PSTR(">>> do_blocking_move_to"), NULL, x, y, z);
1568
+    if (DEBUGGING(LEVELING)) print_xyz(PSTR(">>> do_blocking_move_to"), NULL, lx, ly, lz);
1569 1569
   #endif
1570 1570
 
1571 1571
   #if ENABLED(DELTA)
1572 1572
 
1573
-    if (!position_is_reachable_xy(x, y)) return;
1573
+    if (!position_is_reachable_xy(lx, ly)) return;
1574 1574
 
1575 1575
     feedrate_mm_s = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
1576 1576
 
@@ -1582,10 +1582,10 @@ void do_blocking_move_to(const float &x, const float &y, const float &z, const f
1582 1582
 
1583 1583
     // when in the danger zone
1584 1584
     if (current_position[Z_AXIS] > delta_clip_start_height) {
1585
-      if (z > delta_clip_start_height) {   // staying in the danger zone
1586
-        destination[X_AXIS] = x;           // move directly (uninterpolated)
1587
-        destination[Y_AXIS] = y;
1588
-        destination[Z_AXIS] = z;
1585
+      if (lz > delta_clip_start_height) {   // staying in the danger zone
1586
+        destination[X_AXIS] = lx;           // move directly (uninterpolated)
1587
+        destination[Y_AXIS] = ly;
1588
+        destination[Z_AXIS] = lz;
1589 1589
         prepare_uninterpolated_move_to_destination(); // set_current_to_destination
1590 1590
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1591 1591
           if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position);
@@ -1601,23 +1601,23 @@ void do_blocking_move_to(const float &x, const float &y, const float &z, const f
1601 1601
       }
1602 1602
     }
1603 1603
 
1604
-    if (z > current_position[Z_AXIS]) {    // raising?
1605
-      destination[Z_AXIS] = z;
1604
+    if (lz > current_position[Z_AXIS]) {    // raising?
1605
+      destination[Z_AXIS] = lz;
1606 1606
       prepare_uninterpolated_move_to_destination();   // set_current_to_destination
1607 1607
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1608 1608
         if (DEBUGGING(LEVELING)) DEBUG_POS("z raise move", current_position);
1609 1609
       #endif
1610 1610
     }
1611 1611
 
1612
-    destination[X_AXIS] = x;
1613
-    destination[Y_AXIS] = y;
1612
+    destination[X_AXIS] = lx;
1613
+    destination[Y_AXIS] = ly;
1614 1614
     prepare_move_to_destination();         // set_current_to_destination
1615 1615
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1616 1616
       if (DEBUGGING(LEVELING)) DEBUG_POS("xy move", current_position);
1617 1617
     #endif
1618 1618
 
1619
-    if (z < current_position[Z_AXIS]) {    // lowering?
1620
-      destination[Z_AXIS] = z;
1619
+    if (lz < current_position[Z_AXIS]) {    // lowering?
1620
+      destination[Z_AXIS] = lz;
1621 1621
       prepare_uninterpolated_move_to_destination();   // set_current_to_destination
1622 1622
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1623 1623
         if (DEBUGGING(LEVELING)) DEBUG_POS("z lower move", current_position);
@@ -1626,44 +1626,44 @@ void do_blocking_move_to(const float &x, const float &y, const float &z, const f
1626 1626
 
1627 1627
   #elif IS_SCARA
1628 1628
 
1629
-    if (!position_is_reachable_xy(x, y)) return;
1629
+    if (!position_is_reachable_xy(lx, ly)) return;
1630 1630
 
1631 1631
     set_destination_to_current();
1632 1632
 
1633 1633
     // If Z needs to raise, do it before moving XY
1634
-    if (destination[Z_AXIS] < z) {
1635
-      destination[Z_AXIS] = z;
1634
+    if (destination[Z_AXIS] < lz) {
1635
+      destination[Z_AXIS] = lz;
1636 1636
       prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS));
1637 1637
     }
1638 1638
 
1639
-    destination[X_AXIS] = x;
1640
-    destination[Y_AXIS] = y;
1639
+    destination[X_AXIS] = lx;
1640
+    destination[Y_AXIS] = ly;
1641 1641
     prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S);
1642 1642
 
1643 1643
     // If Z needs to lower, do it after moving XY
1644
-    if (destination[Z_AXIS] > z) {
1645
-      destination[Z_AXIS] = z;
1644
+    if (destination[Z_AXIS] > lz) {
1645
+      destination[Z_AXIS] = lz;
1646 1646
       prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS));
1647 1647
     }
1648 1648
 
1649 1649
   #else
1650 1650
 
1651 1651
     // If Z needs to raise, do it before moving XY
1652
-    if (current_position[Z_AXIS] < z) {
1652
+    if (current_position[Z_AXIS] < lz) {
1653 1653
       feedrate_mm_s = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS);
1654
-      current_position[Z_AXIS] = z;
1654
+      current_position[Z_AXIS] = lz;
1655 1655
       line_to_current_position();
1656 1656
     }
1657 1657
 
1658 1658
     feedrate_mm_s = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
1659
-    current_position[X_AXIS] = x;
1660
-    current_position[Y_AXIS] = y;
1659
+    current_position[X_AXIS] = lx;
1660
+    current_position[Y_AXIS] = ly;
1661 1661
     line_to_current_position();
1662 1662
 
1663 1663
     // If Z needs to lower, do it after moving XY
1664
-    if (current_position[Z_AXIS] > z) {
1664
+    if (current_position[Z_AXIS] > lz) {
1665 1665
       feedrate_mm_s = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS);
1666
-      current_position[Z_AXIS] = z;
1666
+      current_position[Z_AXIS] = lz;
1667 1667
       line_to_current_position();
1668 1668
     }
1669 1669
 
@@ -1677,14 +1677,14 @@ void do_blocking_move_to(const float &x, const float &y, const float &z, const f
1677 1677
     if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< do_blocking_move_to");
1678 1678
   #endif
1679 1679
 }
1680
-void do_blocking_move_to_x(const float &x, const float &fr_mm_s/*=0.0*/) {
1681
-  do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s);
1680
+void do_blocking_move_to_x(const float &lx, const float &fr_mm_s/*=0.0*/) {
1681
+  do_blocking_move_to(lx, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s);
1682 1682
 }
1683
-void do_blocking_move_to_z(const float &z, const float &fr_mm_s/*=0.0*/) {
1684
-  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, fr_mm_s);
1683
+void do_blocking_move_to_z(const float &lz, const float &fr_mm_s/*=0.0*/) {
1684
+  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], lz, fr_mm_s);
1685 1685
 }
1686
-void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s/*=0.0*/) {
1687
-  do_blocking_move_to(x, y, current_position[Z_AXIS], fr_mm_s);
1686
+void do_blocking_move_to_xy(const float &lx, const float &ly, const float &fr_mm_s/*=0.0*/) {
1687
+  do_blocking_move_to(lx, ly, current_position[Z_AXIS], fr_mm_s);
1688 1688
 }
1689 1689
 
1690 1690
 //
@@ -1719,7 +1719,7 @@ static void clean_up_after_endstop_or_probe_move() {
1719 1719
   /**
1720 1720
    * Raise Z to a minimum height to make room for a probe to move
1721 1721
    */
1722
-  inline void do_probe_raise(float z_raise) {
1722
+  inline void do_probe_raise(const float z_raise) {
1723 1723
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1724 1724
       if (DEBUGGING(LEVELING)) {
1725 1725
         SERIAL_ECHOPAIR("do_probe_raise(", z_raise);
@@ -1801,6 +1801,10 @@ static void clean_up_after_endstop_or_probe_move() {
1801 1801
 
1802 1802
 #elif ENABLED(Z_PROBE_ALLEN_KEY)
1803 1803
 
1804
+  FORCE_INLINE void do_blocking_move_to(const float logical[XYZ], const float &fr_mm_s) {
1805
+    do_blocking_move_to(logical[X_AXIS], logical[Y_AXIS], logical[Z_AXIS], fr_mm_s);
1806
+  }
1807
+
1804 1808
   void run_deploy_moves_script() {
1805 1809
     #if defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_X) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_Y) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_Z)
1806 1810
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_1_X
@@ -1815,7 +1819,8 @@ static void clean_up_after_endstop_or_probe_move() {
1815 1819
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE
1816 1820
         #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE 0.0
1817 1821
       #endif
1818
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_DEPLOY_1_X, Z_PROBE_ALLEN_KEY_DEPLOY_1_Y, Z_PROBE_ALLEN_KEY_DEPLOY_1_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE));
1822
+      const float deploy_1[] = { Z_PROBE_ALLEN_KEY_DEPLOY_1_X, Z_PROBE_ALLEN_KEY_DEPLOY_1_Y, Z_PROBE_ALLEN_KEY_DEPLOY_1_Z };
1823
+      do_blocking_move_to(deploy_1, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE));
1819 1824
     #endif
1820 1825
     #if defined(Z_PROBE_ALLEN_KEY_DEPLOY_2_X) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_2_Y) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_2_Z)
1821 1826
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_2_X
@@ -1830,7 +1835,8 @@ static void clean_up_after_endstop_or_probe_move() {
1830 1835
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE
1831 1836
         #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE 0.0
1832 1837
       #endif
1833
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_DEPLOY_2_X, Z_PROBE_ALLEN_KEY_DEPLOY_2_Y, Z_PROBE_ALLEN_KEY_DEPLOY_2_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE));
1838
+      const float deploy_2[] = { Z_PROBE_ALLEN_KEY_DEPLOY_2_X, Z_PROBE_ALLEN_KEY_DEPLOY_2_Y, Z_PROBE_ALLEN_KEY_DEPLOY_2_Z };
1839
+      do_blocking_move_to(deploy_2, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE));
1834 1840
     #endif
1835 1841
     #if defined(Z_PROBE_ALLEN_KEY_DEPLOY_3_X) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_3_Y) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_3_Z)
1836 1842
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_3_X
@@ -1845,7 +1851,8 @@ static void clean_up_after_endstop_or_probe_move() {
1845 1851
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE
1846 1852
         #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE 0.0
1847 1853
       #endif
1848
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_DEPLOY_3_X, Z_PROBE_ALLEN_KEY_DEPLOY_3_Y, Z_PROBE_ALLEN_KEY_DEPLOY_3_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE));
1854
+      const float deploy_3[] = { Z_PROBE_ALLEN_KEY_DEPLOY_3_X, Z_PROBE_ALLEN_KEY_DEPLOY_3_Y, Z_PROBE_ALLEN_KEY_DEPLOY_3_Z };
1855
+      do_blocking_move_to(deploy_3, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE));
1849 1856
     #endif
1850 1857
     #if defined(Z_PROBE_ALLEN_KEY_DEPLOY_4_X) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_4_Y) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_4_Z)
1851 1858
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_4_X
@@ -1860,7 +1867,8 @@ static void clean_up_after_endstop_or_probe_move() {
1860 1867
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE
1861 1868
         #define Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE 0.0
1862 1869
       #endif
1863
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_DEPLOY_4_X, Z_PROBE_ALLEN_KEY_DEPLOY_4_Y, Z_PROBE_ALLEN_KEY_DEPLOY_4_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE));
1870
+      const float deploy_4[] = { Z_PROBE_ALLEN_KEY_DEPLOY_4_X, Z_PROBE_ALLEN_KEY_DEPLOY_4_Y, Z_PROBE_ALLEN_KEY_DEPLOY_4_Z };
1871
+      do_blocking_move_to(deploy_4, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE));
1864 1872
     #endif
1865 1873
     #if defined(Z_PROBE_ALLEN_KEY_DEPLOY_5_X) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_5_Y) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_5_Z)
1866 1874
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_5_X
@@ -1875,7 +1883,8 @@ static void clean_up_after_endstop_or_probe_move() {
1875 1883
       #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE
1876 1884
         #define Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE 0.0
1877 1885
       #endif
1878
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_DEPLOY_5_X, Z_PROBE_ALLEN_KEY_DEPLOY_5_Y, Z_PROBE_ALLEN_KEY_DEPLOY_5_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE));
1886
+      const float deploy_5[] = { Z_PROBE_ALLEN_KEY_DEPLOY_5_X, Z_PROBE_ALLEN_KEY_DEPLOY_5_Y, Z_PROBE_ALLEN_KEY_DEPLOY_5_Z };
1887
+      do_blocking_move_to(deploy_5, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_DEPLOY_5_FEEDRATE));
1879 1888
     #endif
1880 1889
   }
1881 1890
 
@@ -1893,7 +1902,8 @@ static void clean_up_after_endstop_or_probe_move() {
1893 1902
       #ifndef Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE
1894 1903
         #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE 0.0
1895 1904
       #endif
1896
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_STOW_1_X, Z_PROBE_ALLEN_KEY_STOW_1_Y, Z_PROBE_ALLEN_KEY_STOW_1_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE));
1905
+      const float stow_1[] = { Z_PROBE_ALLEN_KEY_STOW_1_X, Z_PROBE_ALLEN_KEY_STOW_1_Y, Z_PROBE_ALLEN_KEY_STOW_1_Z };
1906
+      do_blocking_move_to(stow_1, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE));
1897 1907
     #endif
1898 1908
     #if defined(Z_PROBE_ALLEN_KEY_STOW_2_X) || defined(Z_PROBE_ALLEN_KEY_STOW_2_Y) || defined(Z_PROBE_ALLEN_KEY_STOW_2_Z)
1899 1909
       #ifndef Z_PROBE_ALLEN_KEY_STOW_2_X
@@ -1908,7 +1918,8 @@ static void clean_up_after_endstop_or_probe_move() {
1908 1918
       #ifndef Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE
1909 1919
         #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE 0.0
1910 1920
       #endif
1911
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_STOW_2_X, Z_PROBE_ALLEN_KEY_STOW_2_Y, Z_PROBE_ALLEN_KEY_STOW_2_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE));
1921
+      const float stow_2[] = { Z_PROBE_ALLEN_KEY_STOW_2_X, Z_PROBE_ALLEN_KEY_STOW_2_Y, Z_PROBE_ALLEN_KEY_STOW_2_Z };
1922
+      do_blocking_move_to(stow_2, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE));
1912 1923
     #endif
1913 1924
     #if defined(Z_PROBE_ALLEN_KEY_STOW_3_X) || defined(Z_PROBE_ALLEN_KEY_STOW_3_Y) || defined(Z_PROBE_ALLEN_KEY_STOW_3_Z)
1914 1925
       #ifndef Z_PROBE_ALLEN_KEY_STOW_3_X
@@ -1923,7 +1934,8 @@ static void clean_up_after_endstop_or_probe_move() {
1923 1934
       #ifndef Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE
1924 1935
         #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE 0.0
1925 1936
       #endif
1926
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_STOW_3_X, Z_PROBE_ALLEN_KEY_STOW_3_Y, Z_PROBE_ALLEN_KEY_STOW_3_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE));
1937
+      const float stow_3[] = { Z_PROBE_ALLEN_KEY_STOW_3_X, Z_PROBE_ALLEN_KEY_STOW_3_Y, Z_PROBE_ALLEN_KEY_STOW_3_Z };
1938
+      do_blocking_move_to(stow_3, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE));
1927 1939
     #endif
1928 1940
     #if defined(Z_PROBE_ALLEN_KEY_STOW_4_X) || defined(Z_PROBE_ALLEN_KEY_STOW_4_Y) || defined(Z_PROBE_ALLEN_KEY_STOW_4_Z)
1929 1941
       #ifndef Z_PROBE_ALLEN_KEY_STOW_4_X
@@ -1938,7 +1950,8 @@ static void clean_up_after_endstop_or_probe_move() {
1938 1950
       #ifndef Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE
1939 1951
         #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE 0.0
1940 1952
       #endif
1941
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_STOW_4_X, Z_PROBE_ALLEN_KEY_STOW_4_Y, Z_PROBE_ALLEN_KEY_STOW_4_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE));
1953
+      const float stow_4[] = { Z_PROBE_ALLEN_KEY_STOW_4_X, Z_PROBE_ALLEN_KEY_STOW_4_Y, Z_PROBE_ALLEN_KEY_STOW_4_Z };
1954
+      do_blocking_move_to(stow_4, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE));
1942 1955
     #endif
1943 1956
     #if defined(Z_PROBE_ALLEN_KEY_STOW_5_X) || defined(Z_PROBE_ALLEN_KEY_STOW_5_Y) || defined(Z_PROBE_ALLEN_KEY_STOW_5_Z)
1944 1957
       #ifndef Z_PROBE_ALLEN_KEY_STOW_5_X
@@ -1953,7 +1966,8 @@ static void clean_up_after_endstop_or_probe_move() {
1953 1966
       #ifndef Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE
1954 1967
         #define Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE 0.0
1955 1968
       #endif
1956
-      do_blocking_move_to(Z_PROBE_ALLEN_KEY_STOW_5_X, Z_PROBE_ALLEN_KEY_STOW_5_Y, Z_PROBE_ALLEN_KEY_STOW_5_Z, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE));
1969
+      const float stow_5[] = { Z_PROBE_ALLEN_KEY_STOW_5_X, Z_PROBE_ALLEN_KEY_STOW_5_Y, Z_PROBE_ALLEN_KEY_STOW_5_Z };
1970
+      do_blocking_move_to(stow_5, MMM_TO_MMS(Z_PROBE_ALLEN_KEY_STOW_5_FEEDRATE));
1957 1971
     #endif
1958 1972
   }
1959 1973
 

+ 3
- 2
Marlin/ubl.h Ver arquivo

@@ -138,10 +138,11 @@
138 138
         static bool look_for_lines_to_connect();
139 139
         static bool turn_on_heaters();
140 140
         static bool prime_nozzle();
141
-        static void retract_filament(float where[XYZE]);
142
-        static void recover_filament(float where[XYZE]);
141
+        static void retract_filament(const float where[XYZE]);
142
+        static void recover_filament(const float where[XYZE]);
143 143
         static void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&);
144 144
         static void move_to(const float&, const float&, const float&, const float&);
145
+        inline static void move_to(const float where[XYZE], const float &de) { move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], de); }
145 146
       #endif
146 147
 
147 148
     public:

+ 8
- 10
Marlin/ubl_motion.cpp Ver arquivo

@@ -67,19 +67,17 @@
67 67
 
68 68
     const float de = destination[E_AXIS] - current_position[E_AXIS];
69 69
 
70
-    if (de == 0.0) return;
70
+    if (de == 0.0) return; // Printing moves only
71 71
 
72
-    const float dx = current_position[X_AXIS] - destination[X_AXIS],
73
-                dy = current_position[Y_AXIS] - destination[Y_AXIS],
72
+    const float dx = destination[X_AXIS] - current_position[X_AXIS],
73
+                dy = destination[Y_AXIS] - current_position[Y_AXIS],
74 74
                 xy_dist = HYPOT(dx, dy);
75 75
 
76
-    if (xy_dist == 0.0)
77
-      return;
78
-    else {
79
-      SERIAL_ECHOPGM("   fpmm=");
80
-      const float fpmm = de / xy_dist;
81
-      SERIAL_ECHO_F(fpmm, 6);
82
-    }
76
+    if (xy_dist == 0.0) return;
77
+
78
+    SERIAL_ECHOPGM("   fpmm=");
79
+    const float fpmm = de / xy_dist;
80
+    SERIAL_ECHO_F(fpmm, 6);
83 81
 
84 82
     SERIAL_ECHOPGM("    current=( ");
85 83
     SERIAL_ECHO_F(current_position[X_AXIS], 6);

Carregando…
Cancelar
Salvar