Browse Source

Merge pull request #1959 from thinkyhead/lcd_move_rate

Include axis parameter to ultralcd's line_to_current
Scott Lahteine 9 years ago
parent
commit
075386e7fe
2 changed files with 27 additions and 33 deletions
  1. 6
    6
      Marlin/Marlin_main.cpp
  2. 21
    27
      Marlin/ultralcd.cpp

+ 6
- 6
Marlin/Marlin_main.cpp View File

3801
    * M666: Set delta endstop adjustment
3801
    * M666: Set delta endstop adjustment
3802
    */
3802
    */
3803
   inline void gcode_M666() {
3803
   inline void gcode_M666() {
3804
-    for (int8_t i = 0; i < 3; i++) {
3804
+    for (int8_t i = X_AXIS; i <= Z_AXIS; i++) {
3805
       if (code_seen(axis_codes[i])) {
3805
       if (code_seen(axis_codes[i])) {
3806
         endstop_adj[i] = code_value();
3806
         endstop_adj[i] = code_value();
3807
       }
3807
       }
3808
     }
3808
     }
3809
   }
3809
   }
3810
-#elif defined(Z_DUAL_ENDSTOPS)
3810
+#elif defined(Z_DUAL_ENDSTOPS) // !DELTA && defined(Z_DUAL_ENDSTOPS)
3811
   /**
3811
   /**
3812
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
3812
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
3813
    */
3813
    */
3814
   inline void gcode_M666() {
3814
   inline void gcode_M666() {
3815
-   if (code_seen('Z')) z_endstop_adj = code_value();
3816
-   SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj );
3817
-   SERIAL_EOL;
3815
+    if (code_seen('Z')) z_endstop_adj = code_value();
3816
+    SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
3817
+    SERIAL_EOL;
3818
   }
3818
   }
3819
   
3819
   
3820
-#endif // DELTA
3820
+#endif // !DELTA && defined(Z_DUAL_ENDSTOPS)
3821
 
3821
 
3822
 #ifdef FWRETRACT
3822
 #ifdef FWRETRACT
3823
 
3823
 

+ 21
- 27
Marlin/ultralcd.cpp View File

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

Loading…
Cancel
Save