Browse Source

Merge pull request #3486 from gudnimg/gudni-optimisation

Flash optimizations in loop() and status screen menu
DRracer 2 years ago
parent
commit
3ebd8b88a4
4 changed files with 11 additions and 11 deletions
  1. 1 1
      Firmware/Marlin_main.cpp
  2. 0 1
      Firmware/lcd.cpp
  3. 0 2
      Firmware/lcd.h
  4. 10 7
      Firmware/ultralcd.cpp

+ 1 - 1
Firmware/Marlin_main.cpp

@@ -1940,7 +1940,7 @@ void loop()
 }
   //check heater every n milliseconds
   manage_heater();
-  isPrintPaused ? manage_inactivity(true) : manage_inactivity(false);
+  manage_inactivity(isPrintPaused);
   checkHitEndstops();
   lcd_update(0);
 #ifdef TMC2130

+ 0 - 1
Firmware/lcd.cpp

@@ -638,7 +638,6 @@ uint8_t lcd_button_pressed = 0;
 uint8_t lcd_update_enabled = 1;
 
 uint32_t lcd_next_update_millis = 0;
-uint8_t lcd_status_update_delay = 0;
 
 
 

+ 0 - 2
Firmware/lcd.h

@@ -107,8 +107,6 @@ extern LongTimer lcd_timeoutToStatus;
 
 extern uint32_t lcd_next_update_millis;
 
-extern uint8_t lcd_status_update_delay;
-
 extern lcd_longpress_func_t lcd_longpress_func;
 extern bool lcd_longpress_trigger;
 

+ 10 - 7
Firmware/ultralcd.cpp

@@ -758,6 +758,7 @@ void lcdui_print_status_screen(void)
 // Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent
 void lcd_status_screen()                          // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
 {
+	static uint8_t lcd_status_update_delay = 0;
 #ifdef ULTIPANEL_FEEDMULTIPLY
 	// Dead zone at 100% feedrate
 	if ((feedmultiply < 100 && (feedmultiply + int(lcd_encoder)) > 100) ||
@@ -788,14 +789,17 @@ void lcd_status_screen()                          // NOT static due to using ins
 	else if (feedmultiply > 999)
 		feedmultiply = 999;
 
+	if (lcd_draw_update) {
+		// Update the status screen immediately
+		lcd_status_update_delay = 0;
+	}
+
 	if (lcd_status_update_delay)
 		lcd_status_update_delay--;
 	else
-		lcd_draw_update = 1;
-
-
-	if (lcd_draw_update)
-	{
+	{	// Redraw the main screen every second (see LCD_UPDATE_INTERVAL).
+		// This is easier then trying keep track of all things that change on the screen
+		lcd_status_update_delay = 10;
 		ReInitLCD++;
 		if (ReInitLCD == 30)
 		{
@@ -832,10 +836,9 @@ void lcd_status_screen()                          // NOT static due to using ins
 			}
 		} // end of farm_mode
 
-		lcd_status_update_delay = 10;   /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
 		if (lcd_commands_type != LcdCommands::Idle)
 			lcd_commands();
-	} // end of lcd_draw_update
+	}
 
 	bool current_click = LCD_CLICKED;