Browse Source

M600 R<resume temperature> (#17919)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
chestwood96 4 years ago
parent
commit
1475fd312a
No account linked to committer's email address
3 changed files with 27 additions and 13 deletions
  1. 23
    11
      Marlin/src/feature/pause.cpp
  2. 1
    1
      Marlin/src/feature/pause.h
  3. 3
    1
      Marlin/src/gcode/feature/pause/M600.cpp

+ 23
- 11
Marlin/src/feature/pause.cpp View File

@@ -84,26 +84,30 @@ fil_change_settings_t fc_settings[EXTRUDERS];
84 84
 #endif
85 85
 
86 86
 #if HAS_BUZZER
87
-  static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
87
+  static void impatient_beep(const int8_t max_beep_count, const bool restart=false) {
88 88
 
89 89
     if (TERN0(HAS_LCD_MENU, pause_mode == PAUSE_MODE_PAUSE_PRINT)) return;
90 90
 
91 91
     static millis_t next_buzz = 0;
92 92
     static int8_t runout_beep = 0;
93 93
 
94
-    if (init) next_buzz = runout_beep = 0;
94
+    if (restart) next_buzz = runout_beep = 0;
95
+
96
+    const bool always = max_beep_count < 0;
95 97
 
96 98
     const millis_t ms = millis();
97 99
     if (ELAPSED(ms, next_buzz)) {
98
-      if (max_beep_count < 0 || runout_beep < max_beep_count + 5) { // Only beep as long as we're supposed to
99
-        next_buzz = ms + ((max_beep_count < 0 || runout_beep < max_beep_count) ? 1000 : 500);
100
+      if (always || runout_beep < max_beep_count + 5) { // Only beep as long as we're supposed to
101
+        next_buzz = ms + ((always || runout_beep < max_beep_count) ? 1000 : 500);
100 102
         BUZZ(50, 880 - (runout_beep & 1) * 220);
101 103
         runout_beep++;
102 104
       }
103 105
     }
104 106
   }
107
+  inline void first_impatient_beep(const int8_t max_beep_count) { impatient_beep(max_beep_count, true); }
105 108
 #else
106
-  inline void filament_change_beep(const int8_t, const bool=false) {}
109
+  inline void impatient_beep(const int8_t, const bool=false) {}
110
+  inline void first_impatient_beep(const int8_t) {}
107 111
 #endif
108 112
 
109 113
 /**
@@ -165,7 +169,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
165 169
     #endif
166 170
     SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
167 171
 
168
-    filament_change_beep(max_beep_count, true);
172
+    first_impatient_beep(max_beep_count);
169 173
 
170 174
     KEEPALIVE_STATE(PAUSED_FOR_USER);
171 175
     #if ENABLED(HOST_PROMPT_SUPPORT)
@@ -180,7 +184,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
180 184
     #endif
181 185
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
182 186
     while (wait_for_user) {
183
-      filament_change_beep(max_beep_count);
187
+      impatient_beep(max_beep_count);
184 188
       idle_no_sleep();
185 189
     }
186 190
   }
@@ -448,7 +452,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
448 452
 
449 453
   show_continue_prompt(is_reload);
450 454
 
451
-  filament_change_beep(max_beep_count, true);
455
+  first_impatient_beep(max_beep_count);
452 456
 
453 457
   // Start the heater idle timers
454 458
   const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
@@ -468,7 +472,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
468 472
   TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
469 473
   wait_for_user = true;    // LCD click or M108 will clear this
470 474
   while (wait_for_user) {
471
-    filament_change_beep(max_beep_count);
475
+    impatient_beep(max_beep_count);
472 476
 
473 477
     // If the nozzle has timed out...
474 478
     if (!nozzle_timed_out)
@@ -508,7 +512,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
508 512
       wait_for_user = true;
509 513
       nozzle_timed_out = false;
510 514
 
511
-      filament_change_beep(max_beep_count, true);
515
+      first_impatient_beep(max_beep_count);
512 516
     }
513 517
     idle_no_sleep();
514 518
   }
@@ -539,7 +543,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
539 543
  * - Send host action for resume, if configured
540 544
  * - Resume the current SD print job, if any
541 545
  */
542
-void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
546
+void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/, int16_t targetTemp/*=0*/ DXC_ARGS) {
543 547
   /*
544 548
   SERIAL_ECHOLNPAIR(
545 549
     "start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,
@@ -558,9 +562,17 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
558 562
     thermalManager.reset_hotend_idle_timer(e);
559 563
   }
560 564
 
565
+  if (targetTemp > thermalManager.degTargetHotend(active_extruder))
566
+    thermalManager.setTargetHotend(targetTemp, active_extruder);
567
+
561 568
   if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament
562 569
     load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_SAME DXC_PASS);
563 570
 
571
+  if (targetTemp > 0) {
572
+    thermalManager.setTargetHotend(targetTemp, active_extruder);
573
+    thermalManager.wait_for_hotend(active_extruder, false);
574
+  }
575
+
564 576
   TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_RESUME));
565 577
 
566 578
   // Retract to prevent oozing

+ 1
- 1
Marlin/src/feature/pause.h View File

@@ -87,7 +87,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
87 87
 
88 88
 void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS);
89 89
 
90
-void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0 DXC_PARAMS);
90
+void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0, int16_t targetTemp=0 DXC_PARAMS);
91 91
 
92 92
 bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0, const bool show_lcd=false,
93 93
                           const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);

+ 3
- 1
Marlin/src/gcode/feature/pause/M600.cpp View File

@@ -56,6 +56,7 @@
56 56
  *  L[distance] - Extrude distance for insertion (manual reload)
57 57
  *  B[count]    - Number of times to beep, -1 for indefinite (if equipped with a buzzer)
58 58
  *  T[toolhead] - Select extruder for filament change
59
+ *  R[temp]     - Resume temperature (in current units)
59 60
  *
60 61
  *  Default values are used for omitted arguments.
61 62
  */
@@ -153,7 +154,8 @@ void GcodeSuite::M600() {
153 154
       resume_print(slow_load_length, fast_load_length, 0, beep_count DXC_PASS);
154 155
     #else
155 156
       wait_for_confirmation(true, beep_count DXC_PASS);
156
-      resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count DXC_PASS);
157
+      resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH,
158
+                   beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS);
157 159
     #endif
158 160
   }
159 161
 

Loading…
Cancel
Save