Browse Source

Add Z Fade Height edit to UBL and Tune submenus (#9738)

Studiodyne 7 years ago
parent
commit
9c9cd54ef3
1 changed files with 44 additions and 13 deletions
  1. 44
    13
      Marlin/src/lcd/ultralcd.cpp

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

@@ -244,6 +244,11 @@ uint16_t max_display_update_time = 0;
244 244
     #include "../feature/bedlevel/mbl/mesh_bed_leveling.h"
245 245
   #endif
246 246
 
247
+  #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
248
+    static float new_z_fade_height;
249
+    void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); }
250
+  #endif
251
+
247 252
   ////////////////////////////////////////////
248 253
   //////////// Menu System Actions ///////////
249 254
   ////////////////////////////////////////////
@@ -991,6 +996,13 @@ void kill_screen(const char* lcd_msg) {
991 996
    *
992 997
    */
993 998
 
999
+  #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1000
+    void _lcd_goto_tune_menu() {
1001
+      lcd_goto_screen(lcd_tune_menu);
1002
+      new_z_fade_height = planner.z_fade_height;
1003
+    }
1004
+  #endif
1005
+
994 1006
   void lcd_main_menu() {
995 1007
     START_MENU();
996 1008
     MENU_BACK(MSG_WATCH);
@@ -1018,7 +1030,13 @@ void kill_screen(const char* lcd_msg) {
1018 1030
     #endif
1019 1031
 
1020 1032
     if (planner.movesplanned() || IS_SD_PRINTING) {
1021
-      MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
1033
+      MENU_ITEM(submenu, MSG_TUNE,
1034
+        #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1035
+          _lcd_goto_tune_menu
1036
+        #else
1037
+          lcd_tune_menu
1038
+        #endif
1039
+      );
1022 1040
     }
1023 1041
     else {
1024 1042
       MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
@@ -1311,7 +1329,9 @@ void kill_screen(const char* lcd_msg) {
1311 1329
     #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
1312 1330
       MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
1313 1331
     #endif
1314
-
1332
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1333
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
1334
+    #endif
1315 1335
     //
1316 1336
     // Nozzle:
1317 1337
     // Nozzle [1-4]:
@@ -1939,11 +1959,6 @@ void kill_screen(const char* lcd_msg) {
1939 1959
     static bool new_level_state;
1940 1960
     void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(new_level_state); }
1941 1961
 
1942
-    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1943
-      static float new_z_fade_height;
1944
-      void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); }
1945
-    #endif
1946
-
1947 1962
     /**
1948 1963
      * Step 1: Bed Level entry-point
1949 1964
      *
@@ -2004,17 +2019,24 @@ void kill_screen(const char* lcd_msg) {
2004 2019
       END_MENU();
2005 2020
     }
2006 2021
 
2007
-    void _lcd_goto_bed_leveling() {
2008
-      lcd_goto_screen(lcd_bed_leveling);
2009
-      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2022
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2023
+      void _lcd_goto_bed_leveling() {
2024
+        lcd_goto_screen(lcd_bed_leveling);
2010 2025
         new_z_fade_height = planner.z_fade_height;
2011
-      #endif
2012
-    }
2026
+      }
2027
+    #endif
2013 2028
 
2014 2029
   #elif ENABLED(AUTO_BED_LEVELING_UBL)
2015 2030
 
2016 2031
     void _lcd_ubl_level_bed();
2017 2032
 
2033
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2034
+      void _lcd_goto_ubl_level_bed() {
2035
+        lcd_goto_screen(_lcd_ubl_level_bed);
2036
+        new_z_fade_height = planner.z_fade_height;
2037
+      }
2038
+    #endif
2039
+
2018 2040
     static int16_t ubl_storage_slot = 0,
2019 2041
                custom_hotend_temp = 190,
2020 2042
                side_points = 3,
@@ -2532,6 +2554,9 @@ void kill_screen(const char* lcd_msg) {
2532 2554
       MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);
2533 2555
       MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu);
2534 2556
       MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W"));
2557
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2558
+        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
2559
+      #endif
2535 2560
       END_MENU();
2536 2561
     }
2537 2562
 
@@ -2573,7 +2598,13 @@ void kill_screen(const char* lcd_msg) {
2573 2598
     // Level Bed
2574 2599
     //
2575 2600
     #if ENABLED(AUTO_BED_LEVELING_UBL)
2576
-      MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed);
2601
+      MENU_ITEM(submenu, MSG_UBL_LEVEL_BED,
2602
+        #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2603
+          _lcd_goto_ubl_level_bed
2604
+        #else
2605
+          _lcd_ubl_level_bed
2606
+        #endif        
2607
+      );
2577 2608
     #elif ENABLED(LCD_BED_LEVELING)
2578 2609
       #if ENABLED(PROBE_MANUALLY)
2579 2610
         if (!g29_in_progress)

Loading…
Cancel
Save