Browse Source

Add parameter `D` to gcode `M73` for silent/stealth mode

3d-gussner 3 years ago
parent
commit
d063ffb141
3 changed files with 45 additions and 18 deletions
  1. 2 1
      Firmware/Marlin.h
  2. 10 6
      Firmware/Marlin_main.cpp
  3. 33 11
      Firmware/ultralcd.cpp

+ 2 - 1
Firmware/Marlin.h

@@ -366,7 +366,8 @@ extern uint8_t print_percent_done_normal;
 extern uint16_t print_time_remaining_normal;
 extern uint8_t print_percent_done_silent;
 extern uint16_t print_time_remaining_silent;
-extern uint16_t print_time_to_change;
+extern uint16_t print_time_to_change_normal;
+extern uint16_t print_time_to_change_silent;
 
 #define PRINT_TIME_REMAINING_INIT 0xffff
 

+ 10 - 6
Firmware/Marlin_main.cpp

@@ -316,7 +316,8 @@ uint8_t print_percent_done_normal = PRINT_PERCENT_DONE_INIT;
 uint16_t print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes
 uint8_t print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
 uint16_t print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes
-uint16_t print_time_to_change = PRINT_TIME_REMAINING_INIT; //estimated remaining time to next change in minutes
+uint16_t print_time_to_change_normal = PRINT_TIME_REMAINING_INIT; //estimated remaining time to next change in minutes
+uint16_t print_time_to_change_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining time to next change in minutes
 
 uint32_t IP_address = 0;
 
@@ -6419,11 +6420,13 @@ Sigma_Exit:
       printf_P(_msg_mode_done_remain, _N("SILENT"), int(print_percent_done_silent), print_time_remaining_silent);
     }
 
-    print_time_to_change = PRINT_TIME_REMAINING_INIT;
-    if(code_seen('C')) 
+    if(code_seen('C')) print_time_to_change_normal = code_value();
+    if(code_seen('D')) print_time_to_change_silent = code_value();
+    
     {
-      print_time_to_change = code_value();
-      printf_P(_N("Change in mins: %d\n"), print_time_to_change);
+      const char* _msg_mode_done_remain = _N("%S MODE: Change in mins: %d\n");
+      printf_P(_msg_mode_done_remain, _N("NORMAL"), print_time_to_change_normal);
+      printf_P(_msg_mode_done_remain, _N("SILENT"), print_time_to_change_silent);
     }
     break;
   }
@@ -11696,7 +11699,8 @@ static void print_time_remaining_init()
     print_percent_done_normal = PRINT_PERCENT_DONE_INIT;
     print_time_remaining_silent = PRINT_TIME_REMAINING_INIT;
     print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
-    print_time_to_change = PRINT_TIME_REMAINING_INIT;
+    print_time_to_change_normal = PRINT_TIME_REMAINING_INIT;
+    print_time_to_change_silent = PRINT_TIME_REMAINING_INIT;
 }
 
 void load_filament_final_feed()

+ 33 - 11
Firmware/ultralcd.cpp

@@ -676,33 +676,55 @@ void lcdui_print_time(void)
     if ((PRINTER_ACTIVE) && (starttime != 0))
     {
         uint16_t print_t = 0;
+        uint16_t print_tr = 0;
+        uint16_t print_tc = 0;
         char suff = ' ';
         char suff_doubt = ' ';
 
-        if (print_time_to_change != PRINT_TIME_REMAINING_INIT)
+        #ifdef TMC2130
+        if (SilentModeMenu != SILENT_MODE_OFF)
         {
-            print_t = print_time_to_change;
-            suff = 'C';
+            if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT)
+            {
+                print_tr = print_time_remaining_silent;
+            }
+            if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT)
+            {
+                print_tc = print_time_to_change_silent;
+            }
         }
         else
         {
-            suff = 'R';
+        #endif //TMC2130
+            if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
+            {
+                print_tr = print_time_remaining_normal;
+            }
+            if (print_time_to_change_normal != PRINT_TIME_REMAINING_INIT)
+            {
+                print_tc = print_time_to_change_normal;
+            }
         #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 (print_tc != 0)
+        {
+            print_t = print_tc;
+            suff = 'C';
         }
-		
+        else if (print_tr != 0)
+        {
+            print_t = print_tr;
+            suff = 'R';
+        }
+
         if (feedmultiply != 100)
         {
             suff_doubt = '?';
             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