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