Browse Source

Improve LCD leveling value edits

Scott Lahteine 7 years ago
parent
commit
ece14af556
1 changed files with 24 additions and 9 deletions
  1. 24
    9
      Marlin/ultralcd.cpp

+ 24
- 9
Marlin/ultralcd.cpp View File

1909
       enqueue_and_echo_commands_P(PSTR("G28"));
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
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
     #endif
1918
     #endif
1918
 
1919
 
1919
     /**
1920
     /**
1936
 
1937
 
1937
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
1938
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
1938
         MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
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
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
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
       #endif
1945
       #endif
1947
 
1946
 
1948
       //
1947
       //
1973
       END_MENU();
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
   #elif ENABLED(AUTO_BED_LEVELING_UBL)
1985
   #elif ENABLED(AUTO_BED_LEVELING_UBL)
1977
 
1986
 
1978
     void _lcd_ubl_level_bed();
1987
     void _lcd_ubl_level_bed();
2541
       #if ENABLED(PROBE_MANUALLY)
2550
       #if ENABLED(PROBE_MANUALLY)
2542
         if (!g29_in_progress)
2551
         if (!g29_in_progress)
2543
       #endif
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
     #else
2560
     #else
2546
       #if PLANNER_LEVELING
2561
       #if PLANNER_LEVELING
2547
         MENU_ITEM(gcode, MSG_BED_LEVELING, PSTR("G28\nG29"));
2562
         MENU_ITEM(gcode, MSG_BED_LEVELING, PSTR("G28\nG29"));

Loading…
Cancel
Save