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
 
40
 
41
 void idle(
41
 void idle(
42
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
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
   #endif
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
 #if ENABLED(EXPERIMENTAL_I2CBUS)
55
 #if ENABLED(EXPERIMENTAL_I2CBUS)
48
   #include "feature/twibus.h"
56
   #include "feature/twibus.h"
49
   extern TWIBus i2c;
57
   extern TWIBus i2c;

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

202
       #if HAS_BUZZER
202
       #if HAS_BUZZER
203
         filament_change_beep(max_beep_count);
203
         filament_change_beep(max_beep_count);
204
       #endif
204
       #endif
205
-      idle(true);
205
+      idle_no_sleep();
206
     }
206
     }
207
   }
207
   }
208
 
208
 
280
           KEEPALIVE_STATE(PAUSED_FOR_USER);
280
           KEEPALIVE_STATE(PAUSED_FOR_USER);
281
           wait_for_user = false;
281
           wait_for_user = false;
282
           lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
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
       #endif
285
       #endif
286
 
286
 
541
       #endif
541
       #endif
542
 
542
 
543
       // Wait for LCD click or M108
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
       #if ENABLED(HOST_PROMPT_SUPPORT)
546
       #if ENABLED(HOST_PROMPT_SUPPORT)
547
         host_prompt_do(PROMPT_INFO, PSTR("Reheating"));
547
         host_prompt_do(PROMPT_INFO, PSTR("Reheating"));
576
         filament_change_beep(max_beep_count, true);
576
         filament_change_beep(max_beep_count, true);
577
       #endif
577
       #endif
578
     }
578
     }
579
-
580
-    idle(true);
579
+    idle_no_sleep();
581
   }
580
   }
582
   #if ENABLED(DUAL_X_CARRIAGE)
581
   #if ENABLED(DUAL_X_CARRIAGE)
583
     active_extruder = saved_ext;
582
     active_extruder = saved_ext;

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

137
     while (thermalManager.degBed() > target_bed
137
     while (thermalManager.degBed() > target_bed
138
       || thermalManager.degProbe() > target_probe
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
       const millis_t ms = millis();
141
       const millis_t ms = millis();
146
       if (ELAPSED(ms, next_temp_report)) {
142
       if (ELAPSED(ms, next_temp_report)) {
147
         thermalManager.print_heater_states(active_extruder);
143
         thermalManager.print_heater_states(active_extruder);
167
       SERIAL_ECHOLNPGM("Waiting for bed and probe to reach target temp.");
163
       SERIAL_ECHOLNPGM("Waiting for bed and probe to reach target temp.");
168
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
164
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
169
       while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1 || thermalManager.degProbe() > target_probe) {
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
         const millis_t ms = millis();
167
         const millis_t ms = millis();
176
         if (ELAPSED(ms, next_temp_report)) {
168
         if (ELAPSED(ms, next_temp_report)) {
177
           thermalManager.print_heater_states(active_extruder);
169
           thermalManager.print_heater_states(active_extruder);
191
       do_blocking_move_to(destination);
183
       do_blocking_move_to(destination);
192
       SERIAL_ECHOLNPGM("Waiting for probe heating.");
184
       SERIAL_ECHOLNPGM("Waiting for probe heating.");
193
       while (thermalManager.degProbe() < target_probe) {
185
       while (thermalManager.degProbe() < target_probe) {
194
-        idle(
195
-          #if ENABLED(ADVANCED_PAUSE_FEATURE)
196
-            true
197
-          #endif
198
-        );
186
+        idle_no_sleep();
199
         const millis_t ms = millis();
187
         const millis_t ms = millis();
200
         if (ELAPSED(ms, next_temp_report)) {
188
         if (ELAPSED(ms, next_temp_report)) {
201
           thermalManager.print_heater_states(active_extruder);
189
           thermalManager.print_heater_states(active_extruder);
262
     while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1f
250
     while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1f
263
            || thermalManager.degProbe() > target_probe
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
       const millis_t ms = millis();
254
       const millis_t ms = millis();
271
       if (ELAPSED(ms, next_temp_report)) {
255
       if (ELAPSED(ms, next_temp_report)) {
272
         thermalManager.print_heater_states(active_extruder);
256
         thermalManager.print_heater_states(active_extruder);
293
 
277
 
294
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
278
       const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
295
       while (thermalManager.degProbe() < target_probe) {
279
       while (thermalManager.degProbe() < target_probe) {
296
-        idle(
297
-          #if ENABLED(ADVANCED_PAUSE_FEATURE)
298
-            true
299
-          #endif
300
-        );
280
+        idle_no_sleep();
301
         const millis_t ms = millis();
281
         const millis_t ms = millis();
302
         if (ELAPSED(ms, next_temp_report)) {
282
         if (ELAPSED(ms, next_temp_report)) {
303
           thermalManager.print_heater_states(active_extruder);
283
           thermalManager.print_heater_states(active_extruder);

Loading…
Cancel
Save