浏览代码

Include axis parameter to ultralcd's line_to_current

Scott Lahteine 10 年前
父节点
当前提交
c3560e0288
共有 1 个文件被更改,包括 20 次插入26 次删除
  1. 20
    26
      Marlin/ultralcd.cpp

+ 20
- 26
Marlin/ultralcd.cpp 查看文件

@@ -648,12 +648,12 @@ static void lcd_prepare_menu() {
648 648
 
649 649
 #endif // DELTA_CALIBRATION_MENU
650 650
 
651
-inline void line_to_current() {
651
+inline void line_to_current(AxisEnum axis) {
652 652
   #ifdef DELTA
653 653
     calculate_delta(current_position);
654
-    plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
654
+    plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
655 655
   #else
656
-    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
656
+    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
657 657
   #endif
658 658
 }
659 659
 
@@ -667,7 +667,7 @@ static void _lcd_move(const char *name, int axis, int min, int max) {
667 667
     if (min_software_endstops && current_position[axis] < min) current_position[axis] = min;
668 668
     if (max_software_endstops && current_position[axis] > max) current_position[axis] = max;
669 669
     encoderPosition = 0;
670
-    line_to_current();
670
+    line_to_current(axis);
671 671
     lcdDrawUpdate = 1;
672 672
   }
673 673
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
@@ -680,7 +680,7 @@ static void lcd_move_e() {
680 680
   if (encoderPosition != 0) {
681 681
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
682 682
     encoderPosition = 0;
683
-    line_to_current();
683
+    line_to_current(E_AXIS);
684 684
     lcdDrawUpdate = 1;
685 685
   }
686 686
   if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
@@ -1803,7 +1803,7 @@ char *ftostr52(const float &x) {
1803 1803
       if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1804 1804
       if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1805 1805
       encoderPosition = 0;
1806
-      line_to_current();
1806
+      line_to_current(Z_AXIS);
1807 1807
       lcdDrawUpdate = 2;
1808 1808
     }
1809 1809
     if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS]));
@@ -1811,48 +1811,44 @@ char *ftostr52(const float &x) {
1811 1811
     if (LCD_CLICKED) {
1812 1812
       if (!debounce_click) {
1813 1813
         debounce_click = true;
1814
-        int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1815
-        int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1816
-        if (iy&1) { // Zig zag
1817
-          ix = (MESH_NUM_X_POINTS - 1) - ix;
1818
-        }
1814
+        int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS,
1815
+            iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1816
+        if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
1819 1817
         mbl.set_z(ix, iy, current_position[Z_AXIS]);
1820 1818
         _lcd_level_bed_position++;
1821 1819
         if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
1822 1820
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1823
-          line_to_current();
1821
+          line_to_current(Z_AXIS);
1824 1822
           mbl.active = 1;
1825 1823
           enqueuecommands_P(PSTR("G28"));
1826 1824
           lcd_return_to_status();
1827
-        } else {
1825
+        }
1826
+        else {
1828 1827
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1829
-          line_to_current();
1828
+          line_to_current(Z_AXIS);
1830 1829
           ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1831 1830
           iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1832
-          if (iy&1) { // Zig zag
1833
-            ix = (MESH_NUM_X_POINTS - 1) - ix;
1834
-          }
1831
+          if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
1835 1832
           current_position[X_AXIS] = mbl.get_x(ix);
1836 1833
           current_position[Y_AXIS] = mbl.get_y(iy);
1837
-          line_to_current();
1834
+          line_to_current(X_AXIS);
1838 1835
           lcdDrawUpdate = 2;
1839 1836
         }
1840 1837
       }
1841
-    } else {
1838
+    }
1839
+    else {
1842 1840
       debounce_click = false;
1843 1841
     }
1844 1842
   }
1845 1843
 
1846 1844
   static void _lcd_level_bed_homing() {
1847 1845
     if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("XYZ"), "Homing");
1848
-    if (axis_known_position[X_AXIS] &&
1849
-        axis_known_position[Y_AXIS] &&
1850
-        axis_known_position[Z_AXIS]) {
1846
+    if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]) {
1851 1847
       current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1852 1848
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1853 1849
       current_position[X_AXIS] = MESH_MIN_X;
1854 1850
       current_position[Y_AXIS] = MESH_MIN_Y;
1855
-      line_to_current();
1851
+      line_to_current(X_AXIS);
1856 1852
       _lcd_level_bed_position = 0;
1857 1853
       lcd_goto_menu(_lcd_level_bed);
1858 1854
     }
@@ -1860,9 +1856,7 @@ char *ftostr52(const float &x) {
1860 1856
   }
1861 1857
 
1862 1858
   static void lcd_level_bed() {
1863
-    axis_known_position[X_AXIS] = false;
1864
-    axis_known_position[Y_AXIS] = false;
1865
-    axis_known_position[Z_AXIS] = false;
1859
+    axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
1866 1860
     mbl.reset();
1867 1861
     enqueuecommands_P(PSTR("G28"));
1868 1862
     lcdDrawUpdate = 2;

正在加载...
取消
保存