Browse Source

Improve probe preheat behavior (#21033)

Co-authored-by: InsanityAutomation <d.menzel@insanityautomation.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Michael Telatynski 4 years ago
parent
commit
42d00b13df
No account linked to committer's email address
2 changed files with 45 additions and 30 deletions
  1. 0
    16
      Marlin/src/inc/Conditionals_LCD.h
  2. 45
    14
      Marlin/src/module/probe.cpp

+ 0
- 16
Marlin/src/inc/Conditionals_LCD.h View File

@@ -818,22 +818,6 @@
818 818
       #define TOTAL_PROBING MULTIPLE_PROBING
819 819
     #endif
820 820
   #endif
821
-  #if ENABLED(PREHEAT_BEFORE_PROBING)
822
-    #ifndef PROBING_NOZZLE_TEMP
823
-      #define PROBING_NOZZLE_TEMP 0
824
-    #endif
825
-    #ifndef PROBING_BED_TEMP
826
-      #define PROBING_BED_TEMP 0
827
-    #endif
828
-  #endif
829
-  #if ENABLED(PREHEAT_BEFORE_LEVELING)
830
-    #ifndef LEVELING_NOZZLE_TEMP
831
-      #define LEVELING_NOZZLE_TEMP 0
832
-    #endif
833
-    #ifndef LEVELING_BED_TEMP
834
-      #define LEVELING_BED_TEMP 0
835
-    #endif
836
-  #endif
837 821
 #else
838 822
   // Clear probe pin settings when no probe is selected
839 823
   #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

+ 45
- 14
Marlin/src/module/probe.cpp View File

@@ -327,30 +327,61 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
327 327
 
328 328
 #if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
329 329
 
330
+  #if ENABLED(PREHEAT_BEFORE_PROBING)
331
+    #ifndef PROBING_NOZZLE_TEMP
332
+      #define PROBING_NOZZLE_TEMP 0
333
+    #endif
334
+    #ifndef PROBING_BED_TEMP
335
+      #define PROBING_BED_TEMP 0
336
+    #endif
337
+  #endif
338
+  #if ENABLED(PREHEAT_BEFORE_LEVELING)
339
+    #ifndef LEVELING_NOZZLE_TEMP
340
+      #define LEVELING_NOZZLE_TEMP 0
341
+    #endif
342
+    #ifndef LEVELING_BED_TEMP
343
+      #define LEVELING_BED_TEMP 0
344
+    #endif
345
+  #endif
346
+
330 347
   /**
331
-   * Do preheating as required before leveling or probing
348
+   * Do preheating as required before leveling or probing.
349
+   *  - If a preheat input is higher than the current target, raise the target temperature.
350
+   *  - If a preheat input is higher than the current temperature, wait for stabilization.
332 351
    */
333 352
   void Probe::preheat_for_probing(const uint16_t hotend_temp, const uint16_t bed_temp) {
334
-    #if PROBING_NOZZLE_TEMP || LEVELING_NOZZLE_TEMP
353
+    #if HAS_HOTEND && (PROBING_NOZZLE_TEMP || LEVELING_NOZZLE_TEMP)
335 354
       #define WAIT_FOR_NOZZLE_HEAT
336 355
     #endif
337
-    #if PROBING_BED_TEMP || LEVELING_BED_TEMP
356
+    #if HAS_HEATED_BED && (PROBING_BED_TEMP || LEVELING_BED_TEMP)
338 357
       #define WAIT_FOR_BED_HEAT
339 358
     #endif
340
-    const uint16_t hotendPreheat = TERN0(WAIT_FOR_NOZZLE_HEAT, thermalManager.degHotend(0) < hotend_temp) ? hotend_temp : 0,
341
-                      bedPreheat = TERN0(WAIT_FOR_BED_HEAT,    thermalManager.degBed()     < bed_temp)    ? bed_temp    : 0;
359
+
342 360
     DEBUG_ECHOPGM("Preheating ");
343
-    if (hotendPreheat) {
344
-      DEBUG_ECHOPAIR("hotend (", hotendPreheat, ") ");
345
-      if (bedPreheat) DEBUG_ECHOPGM("and ");
346
-    }
347
-    if (bedPreheat) DEBUG_ECHOPAIR("bed (", bedPreheat, ") ");
361
+
362
+    #if ENABLED(WAIT_FOR_NOZZLE_HEAT)
363
+      const uint16_t hotendPreheat = hotend_temp > thermalManager.degTargetHotend(0) ? hotend_temp : 0;
364
+      if (hotendPreheat) {
365
+        DEBUG_ECHOPAIR("hotend (", hotendPreheat, ")");
366
+        thermalManager.setTargetHotend(hotendPreheat, 0);
367
+      }
368
+    #elif ENABLED(WAIT_FOR_BED_HEAT)
369
+      constexpr uint16_t hotendPreheat = 0;
370
+    #endif
371
+
372
+    #if ENABLED(WAIT_FOR_BED_HEAT)
373
+      const uint16_t bedPreheat = bed_temp > thermalManager.degTargetBed() ? bed_temp : 0;
374
+      if (bedPreheat) {
375
+        if (hotendPreheat) DEBUG_ECHOPGM(" and ");
376
+        DEBUG_ECHOPAIR("bed (", bedPreheat, ")");
377
+        thermalManager.setTargetBed(bedPreheat);
378
+      }
379
+    #endif
380
+
348 381
     DEBUG_EOL();
349 382
 
350
-    TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotendPreheat) thermalManager.setTargetHotend(hotendPreheat, 0));
351
-    TERN_(WAIT_FOR_BED_HEAT,    if (bedPreheat)    thermalManager.setTargetBed(bedPreheat));
352
-    TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotendPreheat) thermalManager.wait_for_hotend(0));
353
-    TERN_(WAIT_FOR_BED_HEAT,    if (bedPreheat)    thermalManager.wait_for_bed_heating());
383
+    TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotend_temp > thermalManager.degHotend(0) + (TEMP_WINDOW)) thermalManager.wait_for_hotend(0));
384
+    TERN_(WAIT_FOR_BED_HEAT,    if (bed_temp > thermalManager.degBed() + (TEMP_BED_WINDOW))    thermalManager.wait_for_bed_heating());
354 385
   }
355 386
 
356 387
 #endif

Loading…
Cancel
Save