Browse Source

Convert NcTime to ShortTimer

The variable is only used in ultralcd.cpp so I made it static there
and deleted it from Marlin_main.cpp

Saves 24 bytes of flash and 1 byte of SRAM
Guðni Már Gilbert 2 years ago
parent
commit
37fd9d1b11
3 changed files with 3 additions and 5 deletions
  1. 0 1
      Firmware/Marlin.h
  2. 0 1
      Firmware/Marlin_main.cpp
  3. 3 3
      Firmware/ultralcd.cpp

+ 0 - 1
Firmware/Marlin.h

@@ -330,7 +330,6 @@ extern unsigned int status_number;
 extern unsigned int heating_status_counter;
 extern char snmm_filaments_used;
 extern unsigned long PingTime;
-extern unsigned long NcTime;
 extern bool no_response;
 extern uint8_t important_status;
 extern uint8_t saved_filament_type;

+ 0 - 1
Firmware/Marlin_main.cpp

@@ -161,7 +161,6 @@ CardReader card;
 #endif
 
 unsigned long PingTime = _millis();
-unsigned long NcTime;
 
 uint8_t mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration
 

+ 3 - 3
Firmware/ultralcd.cpp

@@ -55,7 +55,7 @@
 
 
 int clock_interval = 0;
-
+static ShortTimer NcTime;
 static void lcd_sd_updir();
 static void lcd_mesh_bed_leveling_settings();
 #ifdef LCD_BL_PIN
@@ -8705,10 +8705,10 @@ void lcd_printer_connected() {
 }
 
 static void lcd_send_status() {
-	if (farm_mode && no_response && ((_millis() - NcTime) > (NC_TIME * 1000))) {
+	if (farm_mode && no_response && (NcTime.expired(NC_TIME * 1000))) {
 		//send important status messages periodicaly
 		prusa_statistics(important_status, saved_filament_type);
-		NcTime = _millis();
+		NcTime.start();
 #ifdef FARM_CONNECT_MESSAGE
 		lcd_connect_printer();
 #endif //FARM_CONNECT_MESSAGE