Browse Source

Add idle_no_sleep

Scott Lahteine 4 years ago
parent
commit
77b82d300a
3 changed files with 18 additions and 31 deletions
  1. 9
    1
      Marlin/src/MarlinCore.h
  2. 4
    5
      Marlin/src/feature/pause.cpp
  3. 5
    25
      Marlin/src/gcode/calibrate/G76_M871.cpp

+ 9
- 1
Marlin/src/MarlinCore.h View File

@@ -40,10 +40,18 @@ void stop();
40 40
 
41 41
 void idle(
42 42
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
43
-    bool no_stepper_sleep = false  // pass true to keep steppers from disabling on timeout
43
+    bool no_stepper_sleep=false    // Pass true to keep steppers from timing out
44 44
   #endif
45 45
 );
46 46
 
47
+inline void idle_no_sleep() {
48
+  idle(
49
+    #if ENABLED(ADVANCED_PAUSE_FEATURE)
50
+      true
51
+    #endif
52
+  );
53
+}
54
+
47 55
 #if ENABLED(EXPERIMENTAL_I2CBUS)
48 56
   #include "feature/twibus.h"
49 57
   extern TWIBus i2c;

+ 4
- 5
Marlin/src/feature/pause.cpp View File

@@ -202,7 +202,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
202 202
       #if HAS_BUZZER
203 203
         filament_change_beep(max_beep_count);
204 204
       #endif
205
-      idle(true);
205
+      idle_no_sleep();
206 206
     }
207 207
   }
208 208
 
@@ -280,7 +280,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
280 280
           KEEPALIVE_STATE(PAUSED_FOR_USER);
281 281
           wait_for_user = false;
282 282
           lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
283
-          while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle(true);
283
+          while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
284 284
         }
285 285
       #endif
286 286
 
@@ -541,7 +541,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
541 541
       #endif
542 542
 
543 543
       // Wait for LCD click or M108
544
-      while (wait_for_user) idle(true);
544
+      while (wait_for_user) idle_no_sleep();
545 545
 
546 546
       #if ENABLED(HOST_PROMPT_SUPPORT)
547 547
         host_prompt_do(PROMPT_INFO, PSTR("Reheating"));
@@ -576,8 +576,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
576 576
         filament_change_beep(max_beep_count, true);
577 577
       #endif
578 578
     }
579
-
580
-    idle(true);
579
+    idle_no_sleep();
581 580
   }
582 581
   #if ENABLED(DUAL_X_CARRIAGE)
583 582
     active_extruder = saved_ext;

+ 5
- 25
Marlin/src/gcode/calibrate/G76_M871.cpp View File

@@ -137,11 +137,7 @@ void GcodeSuite::G76() {
137 137
     while (thermalManager.degBed() > target_bed
138 138
       || thermalManager.degProbe() > target_probe
139 139
     ) {
140
-      idle(
141
-        #if ENABLED(ADVANCED_PAUSE_FEATURE)
142
-          true
143
-        #endif
144
-      );
140
+      idle_no_sleep();
145 141
       const millis_t ms = millis();
146 142
       if (ELAPSED(ms, next_temp_report)) {
147 143
         thermalManager.print_heater_states(active_extruder);
@@ -167,11 +163,7 @@ void GcodeSuite::G76() {
167 163
       SERIAL_ECHOLNPGM("Waiting for bed and probe to reach target temp.");
168 164
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
169 165
       while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1 || thermalManager.degProbe() > target_probe) {
170
-        idle(
171
-          #if ENABLED(ADVANCED_PAUSE_FEATURE)
172
-            true
173
-          #endif
174
-        );
166
+        idle_no_sleep();
175 167
         const millis_t ms = millis();
176 168
         if (ELAPSED(ms, next_temp_report)) {
177 169
           thermalManager.print_heater_states(active_extruder);
@@ -191,11 +183,7 @@ void GcodeSuite::G76() {
191 183
       do_blocking_move_to(destination);
192 184
       SERIAL_ECHOLNPGM("Waiting for probe heating.");
193 185
       while (thermalManager.degProbe() < target_probe) {
194
-        idle(
195
-          #if ENABLED(ADVANCED_PAUSE_FEATURE)
196
-            true
197
-          #endif
198
-        );
186
+        idle_no_sleep();
199 187
         const millis_t ms = millis();
200 188
         if (ELAPSED(ms, next_temp_report)) {
201 189
           thermalManager.print_heater_states(active_extruder);
@@ -262,11 +250,7 @@ void GcodeSuite::G76() {
262 250
     while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1f
263 251
            || thermalManager.degProbe() > target_probe
264 252
     ) {
265
-      idle(
266
-        #if ENABLED(ADVANCED_PAUSE_FEATURE)
267
-          true
268
-        #endif
269
-      );
253
+      idle_no_sleep();
270 254
       const millis_t ms = millis();
271 255
       if (ELAPSED(ms, next_temp_report)) {
272 256
         thermalManager.print_heater_states(active_extruder);
@@ -293,11 +277,7 @@ void GcodeSuite::G76() {
293 277
 
294 278
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
295 279
       while (thermalManager.degProbe() < target_probe) {
296
-        idle(
297
-          #if ENABLED(ADVANCED_PAUSE_FEATURE)
298
-            true
299
-          #endif
300
-        );
280
+        idle_no_sleep();
301 281
         const millis_t ms = millis();
302 282
         if (ELAPSED(ms, next_temp_report)) {
303 283
           thermalManager.print_heater_states(active_extruder);

Loading…
Cancel
Save