|
@@ -644,8 +644,8 @@ static void lcd_prepare_menu() {
|
644
|
644
|
}
|
645
|
645
|
|
646
|
646
|
#ifdef DELTA_CALIBRATION_MENU
|
647
|
|
-static void lcd_delta_calibrate_menu()
|
648
|
|
-{
|
|
647
|
+
|
|
648
|
+ static void lcd_delta_calibrate_menu() {
|
649
|
649
|
START_MENU();
|
650
|
650
|
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
651
|
651
|
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
|
@@ -654,9 +654,19 @@ static void lcd_delta_calibrate_menu()
|
654
|
654
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0"));
|
655
|
655
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0"));
|
656
|
656
|
END_MENU();
|
657
|
|
-}
|
|
657
|
+ }
|
|
658
|
+
|
658
|
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
|
670
|
float move_menu_scale;
|
661
|
671
|
static void lcd_move_menu_axis();
|
662
|
672
|
|
|
@@ -667,12 +677,7 @@ static void _lcd_move(const char *name, int axis, int min, int max) {
|
667
|
677
|
if (min_software_endstops && current_position[axis] < min) current_position[axis] = min;
|
668
|
678
|
if (max_software_endstops && current_position[axis] > max) current_position[axis] = max;
|
669
|
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
|
681
|
lcdDrawUpdate = 1;
|
677
|
682
|
}
|
678
|
683
|
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
|
|
@@ -681,17 +686,11 @@ static void _lcd_move(const char *name, int axis, int min, int max) {
|
681
|
686
|
static void lcd_move_x() { _lcd_move(PSTR("X"), X_AXIS, X_MIN_POS, X_MAX_POS); }
|
682
|
687
|
static void lcd_move_y() { _lcd_move(PSTR("Y"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); }
|
683
|
688
|
static void lcd_move_z() { _lcd_move(PSTR("Z"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); }
|
684
|
|
-
|
685
|
689
|
static void lcd_move_e() {
|
686
|
690
|
if (encoderPosition != 0) {
|
687
|
691
|
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
|
688
|
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
|
694
|
lcdDrawUpdate = 1;
|
696
|
695
|
}
|
697
|
696
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
|
|
@@ -1796,76 +1795,78 @@ char *ftostr52(const float &x) {
|
1796
|
1795
|
}
|
1797
|
1796
|
|
1798
|
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
|
1817
|
if (iy&1) { // Zig zag
|
1835
|
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
|
1870
|
#endif // MANUAL_BED_LEVELING
|
1870
|
1871
|
|
1871
|
|
-#endif //ULTRA_LCD
|
|
1872
|
+#endif // ULTRA_LCD
|