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