Sfoglia il codice sorgente

Improve LCD leveling value edits

Scott Lahteine 7 anni fa
parent
commit
ece14af556
1 ha cambiato i file con 24 aggiunte e 9 eliminazioni
  1. 24
    9
      Marlin/ultralcd.cpp

+ 24
- 9
Marlin/ultralcd.cpp Vedi File

@@ -1909,11 +1909,12 @@ void kill_screen(const char* lcd_msg) {
1909 1909
       enqueue_and_echo_commands_P(PSTR("G28"));
1910 1910
     }
1911 1911
 
1912
-    static bool _level_state;
1913
-    void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(_level_state); }
1912
+    static bool new_level_state;
1913
+    void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(new_level_state); }
1914 1914
 
1915 1915
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1916
-      void _lcd_set_z_fade_height() { set_z_fade_height(planner.z_fade_height); }
1916
+      static float new_z_fade_height;
1917
+      void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); }
1917 1918
     #endif
1918 1919
 
1919 1920
     /**
@@ -1936,13 +1937,11 @@ void kill_screen(const char* lcd_msg) {
1936 1937
 
1937 1938
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
1938 1939
         MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
1939
-      else if (leveling_is_valid()) {
1940
-        _level_state = planner.leveling_active;
1941
-        MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &_level_state, _lcd_toggle_bed_leveling);
1942
-      }
1940
+      else if (leveling_is_valid())
1941
+        MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
1943 1942
 
1944 1943
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1945
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &planner.z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
1944
+        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
1946 1945
       #endif
1947 1946
 
1948 1947
       //
@@ -1973,6 +1972,16 @@ void kill_screen(const char* lcd_msg) {
1973 1972
       END_MENU();
1974 1973
     }
1975 1974
 
1975
+    void _lcd_goto_bed_leveling() {
1976
+      currentScreen = lcd_bed_leveling;
1977
+      #if ENABLED(LCD_BED_LEVELING)
1978
+        new_level_state = planner.leveling_active;
1979
+      #endif
1980
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1981
+        new_z_fade_height = planner.z_fade_height;
1982
+      #endif
1983
+    }
1984
+
1976 1985
   #elif ENABLED(AUTO_BED_LEVELING_UBL)
1977 1986
 
1978 1987
     void _lcd_ubl_level_bed();
@@ -2541,7 +2550,13 @@ void kill_screen(const char* lcd_msg) {
2541 2550
       #if ENABLED(PROBE_MANUALLY)
2542 2551
         if (!g29_in_progress)
2543 2552
       #endif
2544
-      MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
2553
+          MENU_ITEM(submenu, MSG_BED_LEVELING,
2554
+            #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2555
+              _lcd_goto_bed_leveling
2556
+            #else
2557
+              lcd_bed_leveling
2558
+            #endif
2559
+          );
2545 2560
     #else
2546 2561
       #if PLANNER_LEVELING
2547 2562
         MENU_ITEM(gcode, MSG_BED_LEVELING, PSTR("G28\nG29"));

Loading…
Annulla
Salva