Parcourir la source

Optimisation: Remove forceMenuExpire variable

During first layer calibration we have the live Z baby step menu
on the LCD and the user can tune their Z offset live.

Once the first layer calibration is done, we want to exit the menu
immediately. For this purpose it is much more efficient to
call lcd_return_to_status(). There is no visual difference
on the LCD for the user.

Change in memory footprint:
Flash: -34 bytes
SRAM: -1 byte
Guðni Már Gilbert il y a 2 ans
Parent
commit
2276217cbb
1 fichiers modifiés avec 2 ajouts et 10 suppressions
  1. 2 10
      Firmware/ultralcd.cpp

+ 2 - 10
Firmware/ultralcd.cpp

@@ -76,7 +76,6 @@ bool isPrintPaused = false;
 static ShortTimer display_time; //just timer for showing pid finished message on lcd;
 static ShortTimer display_time; //just timer for showing pid finished message on lcd;
 static uint16_t pid_temp = DEFAULT_PID_TEMP;
 static uint16_t pid_temp = DEFAULT_PID_TEMP;
 
 
-static bool forceMenuExpire = false;
 static bool lcd_autoDeplete;
 static bool lcd_autoDeplete;
 
 
 
 
@@ -966,7 +965,7 @@ void lcd_commands()
                 enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position
                 enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position
                 if (MMU2::mmu2.Enabled()) enquecommand_P(PSTR("M702")); //unload from nozzle
                 if (MMU2::mmu2.Enabled()) enquecommand_P(PSTR("M702")); //unload from nozzle
                 enquecommand_P(PSTR("M84"));// disable motors
                 enquecommand_P(PSTR("M84"));// disable motors
-                forceMenuExpire = true; //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
+                lcd_return_to_status(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
                 lcd_commands_step = 1;
                 lcd_commands_step = 1;
                 break;
                 break;
             case 1:
             case 1:
@@ -7722,13 +7721,6 @@ static inline bool other_menu_expired()
             && menu_menu != lcd_babystep_z
             && menu_menu != lcd_babystep_z
             && lcd_timeoutToStatus.expired(LCD_TIMEOUT_TO_STATUS));
             && lcd_timeoutToStatus.expired(LCD_TIMEOUT_TO_STATUS));
 }
 }
-static inline bool forced_menu_expire()
-{
-    bool retval = (menu_menu != lcd_status_screen
-            && forceMenuExpire);
-    forceMenuExpire = false;
-    return retval;
-}
 
 
 void menu_lcd_lcdupdate_func(void)
 void menu_lcd_lcdupdate_func(void)
 {
 {
@@ -7796,7 +7788,7 @@ void menu_lcd_lcdupdate_func(void)
 
 
 		(*menu_menu)();
 		(*menu_menu)();
 
 
-		if (z_menu_expired() || other_menu_expired() || forced_menu_expire())
+		if (z_menu_expired() || other_menu_expired())
 		{
 		{
 		// Exiting a menu. Let's call the menu function the last time with menu_leaving flag set to true
 		// Exiting a menu. Let's call the menu function the last time with menu_leaving flag set to true
 		// to give it a chance to save its state.
 		// to give it a chance to save its state.