Browse Source

Reduce code size

3d-gussner 3 years ago
parent
commit
91c767b0f2
4 changed files with 29 additions and 50 deletions
  1. 1 1
      Firmware/Configuration.h
  2. 0 2
      Firmware/Marlin.h
  3. 1 27
      Firmware/Marlin_main.cpp
  4. 27 20
      Firmware/ultralcd.cpp

+ 1 - 1
Firmware/Configuration.h

@@ -17,7 +17,7 @@ extern PGM_P sPrinterName;
 
 // Firmware version
 #define FW_VERSION "3.9.3"
-#define FW_COMMIT_NR 3556
+#define FW_COMMIT_NR 5002
 // FW_VERSION_UNKNOWN means this is an unofficial build.
 // The firmware should only be checked into github with this symbol.
 #define FW_DEV_VERSION FW_VERSION_UNKNOWN

+ 0 - 2
Firmware/Marlin.h

@@ -438,8 +438,6 @@ extern void cancel_saved_printing();
 
 
 //estimated time to end of the print
-extern uint16_t print_time_remaining();
-extern uint16_t print_time_to_change_remaining();
 extern uint8_t calc_percent_done();
 
 

+ 1 - 27
Firmware/Marlin_main.cpp

@@ -6423,7 +6423,7 @@ Sigma_Exit:
     if(code_seen('C')) 
     {
       print_time_to_change = code_value();
-      printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change);
+      printf_P(_N("Change in mins: %d\n"), print_time_to_change);
     }
     break;
   }
@@ -11664,32 +11664,6 @@ void print_mesh_bed_leveling_table()
   SERIAL_ECHOLN();
 }
 
-uint16_t print_time_remaining()
-{
-  uint16_t print_t = PRINT_TIME_REMAINING_INIT;
-#ifdef TMC2130 
-  if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal;
-  else print_t = print_time_remaining_silent;
-#else
-  print_t = print_time_remaining_normal;
-#endif //TMC2130
-  if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
-  return print_t;
-}
-
-uint16_t print_time_to_change_remaining()
-{
-  uint16_t print_t = PRINT_TIME_REMAINING_INIT;
-#ifdef TMC2130 
-  if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change;
-  else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent);
-#else
-  print_t = print_time_to_change;
-#endif //TMC2130
-  if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
-  return print_t;
-}
-
 uint8_t calc_percent_done()
 {
   //in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize

+ 27 - 20
Firmware/ultralcd.cpp

@@ -672,30 +672,37 @@ void lcdui_print_cmd_diag(void)
 void lcdui_print_time(void)
 {
     //if remaining print time estimation is available print it else print elapsed time
-    uint16_t print_t = 0;
     int chars = 0;
-    char suff = ' ';
-    char suff_doubt = ' ';
-
-    if(print_time_to_change != PRINT_TIME_REMAINING_INIT)
-    {
-        print_t = print_time_to_change_remaining();
-        suff = 'C';
-        if (feedmultiply != 100)
-            suff_doubt = '?';
-    }
-    else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
+    if ((PRINTER_ACTIVE) && (starttime != 0))
     {
-        print_t = print_time_remaining();
-        suff = 'R';
+        uint16_t print_t = 0;
+        char suff = ' ';
+        char suff_doubt = ' ';
+
+        if (print_time_to_change != PRINT_TIME_REMAINING_INIT)
+        {
+            print_t = print_time_to_change;
+            suff = 'C';
+        }
+        else
+        {
+            suff = 'R';
+        #ifdef TMC2130
+        if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT && (SilentModeMenu != SILENT_MODE_OFF))
+        {
+            print_t = print_time_remaining_silent;
+        }
+        else
+        #endif //TMC2130
+            print_t = print_time_remaining_normal;
+        }
+		
         if (feedmultiply != 100)
+        {
             suff_doubt = '?';
-    }
-    else if(starttime != 0)
-        print_t = _millis() / 60000 - starttime / 60000;
-
-    if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0)))
-    {
+            print_t = 100ul * print_t / feedmultiply;
+        }
+		
         if (print_t < 6000) //time<100h
             chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt);
         else //time>=100h