Browse Source

Exit the _lcd_move* menus when homing/leveling

Instead of resetting the encoder status when homing or leveling, simply
exit the move/liveZ menu.

When transitioning from idle->printing, axis move shouldn't be allowed
as it would insert moves during a print. This is always wrong.
The menu must be always dismissed. Instead of checking all places where
the menu could be active, automatically dimiss the menu from within
_lcd_move when homing/MBL is happening. The long-push function and the
settings menu checks if "axis move" is possible, and thus
prevent the user to re-enter the menu already.

When doing the first layer calibration, the _lcd_babystep_z is
automatically brought back after MBL has completed.

Technically we should do the same when entering/exiting the paused state
in _lcd_move. However, it's better to dismiss _any_ menu in
stop_and_save_print_to_ram/restore_print_from_ram_and_continue instead.

To be done later...
Yuri D'Elia 3 years ago
parent
commit
e8f6c9fac9
1 changed files with 15 additions and 2 deletions
  1. 15 2
      Firmware/ultralcd.cpp

+ 15 - 2
Firmware/ultralcd.cpp

@@ -2850,6 +2850,13 @@ void lcd_menu_statistics()
 
 static void _lcd_move(const char *name, int axis, int min, int max)
 {
+    if (homing_flag || mesh_bed_leveling_flag)
+    {
+        // printer entered a new state where axis move is forbidden
+        menu_back();
+        return;
+    }
+
 	typedef struct
 	{	// 2bytes total
 		bool initialized;              // 1byte
@@ -3071,6 +3078,13 @@ static void lcd_move_z() {
  */
 static void lcd_babystep_z()
 {
+    if (homing_flag || mesh_bed_leveling_flag)
+    {
+        // printer changed to a new state where live Z is forbidden
+        menu_back();
+        return;
+    }
+
 	typedef struct
 	{
 		int8_t status;
@@ -3106,9 +3120,8 @@ static void lcd_babystep_z()
 		lcd_timeoutToStatus.start();
 	}
 
-	if (lcd_encoder != 0) 
+	if (lcd_encoder != 0)
 	{
-		if (homing_flag || mesh_bed_leveling_flag) lcd_encoder = 0;
 		_md->babystepMemZ += (int)lcd_encoder;
 
         if (_md->babystepMemZ < Z_BABYSTEP_MIN) _md->babystepMemZ = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm