|
@@ -215,7 +215,6 @@ uint16_t max_display_update_time = 0;
|
215
|
215
|
|
216
|
216
|
#if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
|
217
|
217
|
#include "../feature/bedlevel/mbl/mesh_bed_leveling.h"
|
218
|
|
- extern void mesh_probing_done();
|
219
|
218
|
#endif
|
220
|
219
|
|
221
|
220
|
////////////////////////////////////////////
|
|
@@ -1742,58 +1741,33 @@ void kill_screen(const char* lcd_msg) {
|
1742
|
1741
|
#endif
|
1743
|
1742
|
);
|
1744
|
1743
|
|
|
1744
|
+ bool lcd_wait_for_move;
|
|
1745
|
+
|
|
1746
|
+ //
|
|
1747
|
+ // Bed leveling is done. Wait for G29 to complete.
|
|
1748
|
+ // A flag is used so that this can release control
|
|
1749
|
+ // and allow the command queue to be processed.
|
|
1750
|
+ //
|
|
1751
|
+ // When G29 finishes the last move:
|
|
1752
|
+ // - Raise Z to the "manual probe height"
|
|
1753
|
+ // - Don't return until done.
|
1745
|
1754
|
//
|
1746
|
|
- // Raise Z to the "manual probe height"
|
1747
|
|
- // Don't return until done.
|
1748
|
1755
|
// ** This blocks the command queue! **
|
1749
|
1756
|
//
|
1750
|
|
- void _lcd_after_probing() {
|
1751
|
|
- #if MANUAL_PROBE_HEIGHT > 0
|
1752
|
|
- line_to_z(Z_MIN_POS + MANUAL_PROBE_HEIGHT);
|
1753
|
|
- #endif
|
1754
|
|
- // Display "Done" screen and wait for moves to complete
|
1755
|
|
- #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
|
1756
|
|
- lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
|
1757
|
|
- #endif
|
1758
|
|
- lcd_goto_previous_menu();
|
1759
|
|
- lcd_completion_feedback();
|
1760
|
|
- defer_return_to_status = false;
|
1761
|
|
- //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
|
1762
|
|
- }
|
1763
|
|
-
|
1764
|
|
- #if ENABLED(MESH_BED_LEVELING)
|
1765
|
|
-
|
1766
|
|
- // Utility to go to the next mesh point
|
1767
|
|
- inline void _manual_probe_goto_xy(const float &rx, const float &ry) {
|
1768
|
|
- #if MANUAL_PROBE_HEIGHT > 0
|
1769
|
|
- const float prev_z = current_position[Z_AXIS];
|
|
1757
|
+ void _lcd_level_bed_done() {
|
|
1758
|
+ if (!lcd_wait_for_move) {
|
|
1759
|
+ #if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING)
|
|
1760
|
+ // Display "Done" screen and wait for moves to complete
|
1770
|
1761
|
line_to_z(Z_MIN_POS + MANUAL_PROBE_HEIGHT);
|
|
1762
|
+ lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
|
1771
|
1763
|
#endif
|
1772
|
|
- current_position[X_AXIS] = rx;
|
1773
|
|
- current_position[Y_AXIS] = ry;
|
1774
|
|
- planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
|
1775
|
|
- #if MANUAL_PROBE_HEIGHT > 0
|
1776
|
|
- line_to_z(prev_z);
|
1777
|
|
- #endif
|
1778
|
|
- lcd_synchronize();
|
1779
|
|
- }
|
1780
|
|
-
|
1781
|
|
- #elif ENABLED(PROBE_MANUALLY)
|
1782
|
|
-
|
1783
|
|
- bool lcd_wait_for_move;
|
1784
|
|
-
|
1785
|
|
- //
|
1786
|
|
- // Bed leveling is done. Wait for G29 to complete.
|
1787
|
|
- // A flag is used so that this can release control
|
1788
|
|
- // and allow the command queue to be processed.
|
1789
|
|
- //
|
1790
|
|
- void _lcd_level_bed_done() {
|
1791
|
|
- if (!lcd_wait_for_move) _lcd_after_probing();
|
1792
|
|
- if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
|
1793
|
|
- lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
1764
|
+ lcd_goto_previous_menu();
|
|
1765
|
+ lcd_completion_feedback();
|
|
1766
|
+ defer_return_to_status = false;
|
1794
|
1767
|
}
|
1795
|
|
-
|
1796
|
|
- #endif
|
|
1768
|
+ if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_DONE));
|
|
1769
|
+ lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
1770
|
+ }
|
1797
|
1771
|
|
1798
|
1772
|
void _lcd_level_goto_next_point();
|
1799
|
1773
|
|
|
@@ -1806,46 +1780,24 @@ void kill_screen(const char* lcd_msg) {
|
1806
|
1780
|
if (lcd_clicked) {
|
1807
|
1781
|
|
1808
|
1782
|
//
|
1809
|
|
- // Save the current Z position
|
|
1783
|
+ // Save the current Z position and move
|
1810
|
1784
|
//
|
1811
|
1785
|
|
1812
|
|
- #if ENABLED(MESH_BED_LEVELING)
|
1813
|
|
-
|
1814
|
|
- //
|
1815
|
|
- // MBL records the position but doesn't move to the next one
|
1816
|
|
- //
|
1817
|
|
-
|
1818
|
|
- mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]);
|
1819
|
|
-
|
1820
|
|
- #endif
|
1821
|
|
-
|
1822
|
1786
|
// If done...
|
1823
|
1787
|
if (++manual_probe_index >= total_probe_points) {
|
1824
|
|
-
|
|
1788
|
+ //
|
|
1789
|
+ // The last G29 records the point and enables bed leveling
|
|
1790
|
+ //
|
|
1791
|
+ lcd_wait_for_move = true;
|
|
1792
|
+ lcd_goto_screen(_lcd_level_bed_done);
|
1825
|
1793
|
#if ENABLED(PROBE_MANUALLY)
|
1826
|
|
-
|
1827
|
|
- //
|
1828
|
|
- // The last G29 will record and enable but not move.
|
1829
|
|
- //
|
1830
|
|
- lcd_wait_for_move = true;
|
1831
|
1794
|
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
1832
|
|
- lcd_goto_screen(_lcd_level_bed_done);
|
1833
|
|
-
|
1834
|
1795
|
#elif ENABLED(MESH_BED_LEVELING)
|
1835
|
|
-
|
1836
|
|
- _lcd_after_probing();
|
1837
|
|
-
|
1838
|
|
- mbl.has_mesh = true;
|
1839
|
|
- mesh_probing_done();
|
1840
|
|
-
|
|
1796
|
+ enqueue_and_echo_commands_P(PSTR("G29 S2"));
|
1841
|
1797
|
#endif
|
1842
|
|
-
|
1843
|
1798
|
}
|
1844
|
|
- else {
|
1845
|
|
- // MESH_BED_LEVELING: Z already stored, just move
|
1846
|
|
- // PROBE_MANUALLY: Send G29 to record Z, then move
|
|
1799
|
+ else
|
1847
|
1800
|
_lcd_level_goto_next_point();
|
1848
|
|
- }
|
1849
|
1801
|
|
1850
|
1802
|
return;
|
1851
|
1803
|
}
|
|
@@ -1873,7 +1825,6 @@ void kill_screen(const char* lcd_msg) {
|
1873
|
1825
|
/**
|
1874
|
1826
|
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish
|
1875
|
1827
|
*/
|
1876
|
|
-
|
1877
|
1828
|
void _lcd_level_bed_moving() {
|
1878
|
1829
|
if (lcdDrawUpdate) {
|
1879
|
1830
|
char msg[10];
|
|
@@ -1881,36 +1832,22 @@ void kill_screen(const char* lcd_msg) {
|
1881
|
1832
|
lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
|
1882
|
1833
|
}
|
1883
|
1834
|
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
1884
|
|
- #if ENABLED(PROBE_MANUALLY)
|
1885
|
|
- if (!lcd_wait_for_move) lcd_goto_screen(_lcd_level_bed_get_z);
|
1886
|
|
- #endif
|
|
1835
|
+ if (!lcd_wait_for_move) lcd_goto_screen(_lcd_level_bed_get_z);
|
1887
|
1836
|
}
|
1888
|
1837
|
|
1889
|
1838
|
/**
|
1890
|
1839
|
* Step 5: Initiate a move to the next point
|
1891
|
1840
|
*/
|
1892
|
1841
|
void _lcd_level_goto_next_point() {
|
1893
|
|
-
|
1894
|
1842
|
// Set the menu to display ahead of blocking call
|
1895
|
1843
|
lcd_goto_screen(_lcd_level_bed_moving);
|
1896
|
1844
|
|
1897
|
|
- #if ENABLED(MESH_BED_LEVELING)
|
1898
|
|
-
|
1899
|
|
- int8_t px, py;
|
1900
|
|
- mbl.zigzag(manual_probe_index, px, py);
|
1901
|
|
-
|
1902
|
|
- // Controls the loop until the move is done
|
1903
|
|
- _manual_probe_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[py]);
|
1904
|
|
-
|
1905
|
|
- // After the blocking function returns, change menus
|
1906
|
|
- lcd_goto_screen(_lcd_level_bed_get_z);
|
1907
|
|
-
|
1908
|
|
- #elif ENABLED(PROBE_MANUALLY)
|
1909
|
|
-
|
1910
|
|
- // G29 Records Z, moves, and signals when it pauses
|
1911
|
|
- lcd_wait_for_move = true;
|
|
1845
|
+ // G29 Records Z, moves, and signals when it pauses
|
|
1846
|
+ lcd_wait_for_move = true;
|
|
1847
|
+ #if ENABLED(PROBE_MANUALLY)
|
1912
|
1848
|
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
1913
|
|
-
|
|
1849
|
+ #elif ENABLED(MESH_BED_LEVELING)
|
|
1850
|
+ enqueue_and_echo_commands_P(manual_probe_index ? PSTR("G29 S2") : PSTR("G29 S1"));
|
1914
|
1851
|
#endif
|
1915
|
1852
|
}
|
1916
|
1853
|
|
|
@@ -1976,11 +1913,15 @@ void kill_screen(const char* lcd_msg) {
|
1976
|
1913
|
START_MENU();
|
1977
|
1914
|
MENU_BACK(MSG_PREPARE);
|
1978
|
1915
|
|
1979
|
|
- if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
1980
|
|
- MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
1981
|
|
- else if (leveling_is_valid()) {
|
1982
|
|
- MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
|
1983
|
|
- }
|
|
1916
|
+ #if DISABLED(MESH_BED_LEVELING)
|
|
1917
|
+ if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
|
1918
|
+ MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
|
1919
|
+ else
|
|
1920
|
+ #endif
|
|
1921
|
+ if (leveling_is_valid()) {
|
|
1922
|
+ new_level_state = planner.leveling_active;
|
|
1923
|
+ MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
|
|
1924
|
+ }
|
1984
|
1925
|
|
1985
|
1926
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
1986
|
1927
|
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
|
|
@@ -2016,9 +1957,6 @@ void kill_screen(const char* lcd_msg) {
|
2016
|
1957
|
|
2017
|
1958
|
void _lcd_goto_bed_leveling() {
|
2018
|
1959
|
lcd_goto_screen(lcd_bed_leveling);
|
2019
|
|
- #if ENABLED(LCD_BED_LEVELING)
|
2020
|
|
- new_level_state = planner.leveling_active;
|
2021
|
|
- #endif
|
2022
|
1960
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
2023
|
1961
|
new_z_fade_height = planner.z_fade_height;
|
2024
|
1962
|
#endif
|