Browse Source

Optimise lcd_status_screen

Saves 20 bytes of flash
Guðni Már Gilbert 2 years ago
parent
commit
f6fd91a235
3 changed files with 5 additions and 10 deletions
  1. 0 1
      Firmware/lcd.cpp
  2. 0 2
      Firmware/lcd.h
  3. 5 7
      Firmware/ultralcd.cpp

+ 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;
 

+ 5 - 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) ||
@@ -791,11 +792,9 @@ void lcd_status_screen()                          // NOT static due to using ins
 	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 +831,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;