Browse Source

Merge pull request #1879 from thinkyhead/cold_extrude

Fix moves for DELTA for MANUAL_BED_LEVELING
Scott Lahteine 10 years ago
parent
commit
67c0e8323e
2 changed files with 82 additions and 81 deletions
  1. 1
    1
      Marlin/Marlin_main.cpp
  2. 81
    80
      Marlin/ultralcd.cpp

+ 1
- 1
Marlin/Marlin_main.cpp View File

2929
     // use that as a starting point for each probe.
2929
     // use that as a starting point for each probe.
2930
     //
2930
     //
2931
     if (verbose_level > 2)
2931
     if (verbose_level > 2)
2932
-      SERIAL_PROTOCOL("Positioning the probe...\n");
2932
+      SERIAL_PROTOCOLPGM("Positioning the probe...\n");
2933
 
2933
 
2934
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2934
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2935
         ext_position,
2935
         ext_position,

+ 81
- 80
Marlin/ultralcd.cpp View File

644
 }
644
 }
645
 
645
 
646
 #ifdef DELTA_CALIBRATION_MENU
646
 #ifdef DELTA_CALIBRATION_MENU
647
-static void lcd_delta_calibrate_menu()
648
-{
647
+
648
+  static void lcd_delta_calibrate_menu() {
649
     START_MENU();
649
     START_MENU();
650
     MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
650
     MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
651
     MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
651
     MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
654
     MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0"));
654
     MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0"));
655
     MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0"));
655
     MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0"));
656
     END_MENU();
656
     END_MENU();
657
-}
657
+  }
658
+
658
 #endif // DELTA_CALIBRATION_MENU
659
 #endif // DELTA_CALIBRATION_MENU
659
 
660
 
661
+inline void line_to_current() {
662
+  #ifdef DELTA
663
+    calculate_delta(current_position);
664
+    plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
665
+  #else
666
+    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);
667
+  #endif
668
+}
669
+
660
 float move_menu_scale;
670
 float move_menu_scale;
661
 static void lcd_move_menu_axis();
671
 static void lcd_move_menu_axis();
662
 
672
 
667
     if (min_software_endstops && current_position[axis] < min) current_position[axis] = min;
677
     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;
678
     if (max_software_endstops && current_position[axis] > max) current_position[axis] = max;
669
     encoderPosition = 0;
679
     encoderPosition = 0;
670
-    #ifdef DELTA
671
-      calculate_delta(current_position);
672
-      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
673
-    #else
674
-      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);
675
-    #endif
680
+    line_to_current();
676
     lcdDrawUpdate = 1;
681
     lcdDrawUpdate = 1;
677
   }
682
   }
678
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
683
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
681
 static void lcd_move_x() { _lcd_move(PSTR("X"), X_AXIS, X_MIN_POS, X_MAX_POS); }
686
 static void lcd_move_x() { _lcd_move(PSTR("X"), X_AXIS, X_MIN_POS, X_MAX_POS); }
682
 static void lcd_move_y() { _lcd_move(PSTR("Y"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); }
687
 static void lcd_move_y() { _lcd_move(PSTR("Y"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); }
683
 static void lcd_move_z() { _lcd_move(PSTR("Z"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); }
688
 static void lcd_move_z() { _lcd_move(PSTR("Z"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); }
684
-
685
 static void lcd_move_e() {
689
 static void lcd_move_e() {
686
   if (encoderPosition != 0) {
690
   if (encoderPosition != 0) {
687
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
691
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
688
     encoderPosition = 0;
692
     encoderPosition = 0;
689
-    #ifdef DELTA
690
-      calculate_delta(current_position);
691
-      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
692
-    #else
693
-      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
694
-    #endif
693
+    line_to_current();
695
     lcdDrawUpdate = 1;
694
     lcdDrawUpdate = 1;
696
   }
695
   }
697
   if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
696
   if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
1796
 }
1795
 }
1797
 
1796
 
1798
 #ifdef MANUAL_BED_LEVELING
1797
 #ifdef MANUAL_BED_LEVELING
1799
-static int _lcd_level_bed_position;
1800
-static void _lcd_level_bed()
1801
-{
1802
-  if (encoderPosition != 0) {
1803
-    refresh_cmd_timeout();
1804
-    current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP;
1805
-    if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1806
-    if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1807
-    encoderPosition = 0;
1808
-    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder);
1809
-    lcdDrawUpdate = 1;
1810
-  }
1811
-  if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS]));
1812
-  static bool debounce_click = false;
1813
-  if (LCD_CLICKED) {
1814
-    if (!debounce_click) {
1815
-      debounce_click = true;
1816
-      int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1817
-      int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1818
-      if (iy&1) { // Zig zag
1819
-        ix = (MESH_NUM_X_POINTS - 1) - ix;
1820
-      }
1821
-      mbl.set_z(ix, iy, current_position[Z_AXIS]);
1822
-      _lcd_level_bed_position++;
1823
-      if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
1824
-        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1825
-        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);
1826
-        mbl.active = 1;
1827
-        enquecommands_P(PSTR("G28"));
1828
-        lcd_return_to_status();
1829
-      } else {
1830
-        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1831
-        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);
1832
-        ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1833
-        iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1798
+
1799
+  static int _lcd_level_bed_position;
1800
+  static void _lcd_level_bed() {
1801
+    if (encoderPosition != 0) {
1802
+      refresh_cmd_timeout();
1803
+      current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP;
1804
+      if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1805
+      if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1806
+      encoderPosition = 0;
1807
+      line_to_current();
1808
+      lcdDrawUpdate = 1;
1809
+    }
1810
+    if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS]));
1811
+    static bool debounce_click = false;
1812
+    if (LCD_CLICKED) {
1813
+      if (!debounce_click) {
1814
+        debounce_click = true;
1815
+        int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1816
+        int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1834
         if (iy&1) { // Zig zag
1817
         if (iy&1) { // Zig zag
1835
           ix = (MESH_NUM_X_POINTS - 1) - ix;
1818
           ix = (MESH_NUM_X_POINTS - 1) - ix;
1836
         }
1819
         }
1837
-        current_position[X_AXIS] = mbl.get_x(ix);
1838
-        current_position[Y_AXIS] = mbl.get_y(iy);
1839
-        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);
1840
-        lcdDrawUpdate = 1;
1820
+        mbl.set_z(ix, iy, current_position[Z_AXIS]);
1821
+        _lcd_level_bed_position++;
1822
+        if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
1823
+          current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1824
+          line_to_current();
1825
+          mbl.active = 1;
1826
+          enquecommands_P(PSTR("G28"));
1827
+          lcd_return_to_status();
1828
+        } else {
1829
+          current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1830
+          line_to_current();
1831
+          ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1832
+          iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1833
+          if (iy&1) { // Zig zag
1834
+            ix = (MESH_NUM_X_POINTS - 1) - ix;
1835
+          }
1836
+          current_position[X_AXIS] = mbl.get_x(ix);
1837
+          current_position[Y_AXIS] = mbl.get_y(iy);
1838
+          line_to_current();
1839
+          lcdDrawUpdate = 1;
1840
+        }
1841
       }
1841
       }
1842
+    } else {
1843
+      debounce_click = false;
1842
     }
1844
     }
1843
-  } else {
1844
-    debounce_click = false;
1845
   }
1845
   }
1846
-}
1847
-static void _lcd_level_bed_homing()
1848
-{
1849
-  if (axis_known_position[X_AXIS] &&
1850
-      axis_known_position[Y_AXIS] &&
1851
-      axis_known_position[Z_AXIS]) {
1852
-    current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1853
-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1854
-    current_position[X_AXIS] = MESH_MIN_X;
1855
-    current_position[Y_AXIS] = MESH_MIN_Y;
1856
-    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);
1857
-    _lcd_level_bed_position = 0;
1858
-    lcd_goto_menu(_lcd_level_bed);
1846
+
1847
+  static void _lcd_level_bed_homing() {
1848
+    if (axis_known_position[X_AXIS] &&
1849
+        axis_known_position[Y_AXIS] &&
1850
+        axis_known_position[Z_AXIS]) {
1851
+      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]);
1853
+      current_position[X_AXIS] = MESH_MIN_X;
1854
+      current_position[Y_AXIS] = MESH_MIN_Y;
1855
+      line_to_current();
1856
+      _lcd_level_bed_position = 0;
1857
+      lcd_goto_menu(_lcd_level_bed);
1858
+    }
1859
   }
1859
   }
1860
-}
1861
-static void lcd_level_bed() {
1862
-  axis_known_position[X_AXIS] = false;
1863
-  axis_known_position[Y_AXIS] = false;
1864
-  axis_known_position[Z_AXIS] = false;
1865
-  mbl.reset();
1866
-  enquecommands_P(PSTR("G28"));
1867
-  lcd_goto_menu(_lcd_level_bed_homing);
1868
-}
1860
+
1861
+  static void lcd_level_bed() {
1862
+    axis_known_position[X_AXIS] = false;
1863
+    axis_known_position[Y_AXIS] = false;
1864
+    axis_known_position[Z_AXIS] = false;
1865
+    mbl.reset();
1866
+    enquecommands_P(PSTR("G28"));
1867
+    lcd_goto_menu(_lcd_level_bed_homing);
1868
+  }
1869
+
1869
 #endif  // MANUAL_BED_LEVELING
1870
 #endif  // MANUAL_BED_LEVELING
1870
 
1871
 
1871
-#endif //ULTRA_LCD
1872
+#endif // ULTRA_LCD

Loading…
Cancel
Save