Browse Source

Home before level corners, if needed (#11976)

…and add a consistent homing screen for all LCD pre-homing.
InsanityAutomation 6 years ago
parent
commit
6d862b2916
1 changed files with 25 additions and 13 deletions
  1. 25
    13
      Marlin/src/lcd/ultralcd.cpp

+ 25
- 13
Marlin/src/lcd/ultralcd.cpp View File

@@ -1950,6 +1950,12 @@ void lcd_quick_feedback(const bool clear_buttons) {
1950 1950
     static void lcd_load_settings()    { lcd_completion_feedback(settings.load()); }
1951 1951
   #endif
1952 1952
 
1953
+  inline void _lcd_draw_homing() {
1954
+    constexpr uint8_t line = (LCD_HEIGHT - 1) / 2;
1955
+    if (lcdDrawUpdate) lcd_implementation_drawmenu_static(line, PSTR(MSG_LEVEL_BED_HOMING));
1956
+    lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
1957
+  }
1958
+
1953 1959
   #if ENABLED(LEVEL_BED_CORNERS)
1954 1960
 
1955 1961
     /**
@@ -2001,11 +2007,22 @@ void lcd_quick_feedback(const bool clear_buttons) {
2001 2007
       END_MENU();
2002 2008
     }
2003 2009
 
2010
+    void _lcd_level_bed_corners_homing() {
2011
+      _lcd_draw_homing();
2012
+      if (all_axes_homed()) {
2013
+        bed_corner = 0;
2014
+        lcd_goto_screen(_lcd_corner_submenu);
2015
+        _lcd_goto_next_corner();
2016
+      }
2017
+    }
2018
+
2004 2019
     void _lcd_level_bed_corners() {
2005 2020
       defer_return_to_status = true;
2006
-      lcd_goto_screen(_lcd_corner_submenu);
2007
-      bed_corner = 0;
2008
-      _lcd_goto_next_corner();
2021
+      if (!all_axes_known()) {
2022
+        axis_homed = 0;
2023
+        enqueue_and_echo_commands_P(PSTR("G28"));
2024
+      }
2025
+      lcd_goto_screen(_lcd_level_bed_corners_homing);
2009 2026
     }
2010 2027
 
2011 2028
   #endif // LEVEL_BED_CORNERS
@@ -2152,8 +2169,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
2152 2169
      * Step 3: Display "Homing XYZ" - Wait for homing to finish
2153 2170
      */
2154 2171
     void _lcd_level_bed_homing() {
2155
-      if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
2156
-      lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
2172
+      _lcd_draw_homing();
2157 2173
       if (all_axes_homed()) lcd_goto_screen(_lcd_level_bed_homing_done);
2158 2174
     }
2159 2175
 
@@ -2494,8 +2510,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
2494 2510
 
2495 2511
     void _lcd_ubl_map_homing() {
2496 2512
       defer_return_to_status = true;
2497
-      if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT < 3 ? 0 : (LCD_HEIGHT > 4 ? 2 : 1), PSTR(MSG_LEVEL_BED_HOMING));
2498
-      lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
2513
+      _lcd_draw_homing();
2499 2514
       if (all_axes_homed()) {
2500 2515
         ubl.lcd_map_control = true; // Return to the map screen
2501 2516
         lcd_goto_screen(_lcd_ubl_output_map_lcd);
@@ -2758,7 +2773,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
2758 2773
 
2759 2774
       #if ENABLED(LEVEL_BED_CORNERS)
2760 2775
         // Move to the next corner for leveling
2761
-        if (all_axes_homed()) MENU_ITEM(submenu, MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
2776
+        MENU_ITEM(submenu, MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
2762 2777
       #endif
2763 2778
 
2764 2779
       #if ENABLED(EEPROM_SETTINGS)
@@ -2839,7 +2854,6 @@ void lcd_quick_feedback(const bool clear_buttons) {
2839 2854
     #endif
2840 2855
 
2841 2856
     #if ENABLED(LEVEL_BED_CORNERS) && DISABLED(LCD_BED_LEVELING)
2842
-      if (all_axes_homed())
2843 2857
         MENU_ITEM(function, MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
2844 2858
     #endif
2845 2859
 
@@ -2886,10 +2900,8 @@ void lcd_quick_feedback(const bool clear_buttons) {
2886 2900
   #if ENABLED(DELTA_CALIBRATION_MENU)
2887 2901
 
2888 2902
     void _lcd_calibrate_homing() {
2889
-      if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING));
2890
-      lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
2891
-      if (all_axes_homed())
2892
-        lcd_goto_previous_menu();
2903
+      _lcd_draw_homing();
2904
+      if (all_axes_homed()) lcd_goto_previous_menu();
2893 2905
     }
2894 2906
 
2895 2907
     void _lcd_delta_calibrate_home() {

Loading…
Cancel
Save