Browse Source

Do not create static object in global function. Saves 8B RAM and 14B flash, because there is no need to guard constructor against concurrent calls.

Marek Bel 6 years ago
parent
commit
5f033d5a1a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Firmware/ultralcd.cpp

+ 1 - 1
Firmware/ultralcd.cpp

@@ -174,6 +174,7 @@ unsigned long display_time; //just timer for showing pid finished message on lcd
 float pid_temp = DEFAULT_PID_TEMP;
 
 bool long_press_active = false;
+static ShortTimer longPressTimer;
 unsigned long button_blanking_time = millis();
 bool button_pressed = false;
 
@@ -7703,7 +7704,6 @@ void lcd_buttons_update()
 		  lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
 		  if (millis() > button_blanking_time) {
 			  button_blanking_time = millis() + BUTTON_BLANKING_TIME;
-			  static ShortTimer longPressTimer;
 			  if (button_pressed == false && long_press_active == false) {
 			      longPressTimer.start();
 				  button_pressed = true;