@@ -337,6 +337,36 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
337337 #endif
338338}
339339
340+ #if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
341+
342+ /* *
343+ * Do preheating as required before leveling or probing
344+ */
345+ void Probe::preheat_for_probing (const uint16_t hotend_temp, const uint16_t bed_temp) {
346+ #if PROBING_NOZZLE_TEMP || LEVELING_NOZZLE_TEMP
347+ #define WAIT_FOR_NOZZLE_HEAT
348+ #endif
349+ #if PROBING_BED_TEMP || LEVELING_BED_TEMP
350+ #define WAIT_FOR_BED_HEAT
351+ #endif
352+ const uint16_t hotendPreheat = TERN0 (WAIT_FOR_NOZZLE_HEAT, thermalManager.degHotend (0 ) < hotend_temp) ? hotend_temp : 0 ,
353+ bedPreheat = TERN0 (WAIT_FOR_BED_HEAT, thermalManager.degBed () < bed_temp) ? bed_temp : 0 ;
354+ DEBUG_ECHOPGM (" Preheating " );
355+ if (hotendPreheat) {
356+ DEBUG_ECHOPAIR (" hotend (" , hotendPreheat, " ) " );
357+ if (bedPreheat) DEBUG_ECHOPGM (" and " );
358+ }
359+ if (bedPreheat) DEBUG_ECHOPAIR (" bed (" , bedPreheat, " ) " );
360+ DEBUG_EOL ();
361+
362+ TERN_ (WAIT_FOR_NOZZLE_HEAT, if (hotendPreheat) thermalManager.setTargetHotend (hotendPreheat, 0 ));
363+ TERN_ (WAIT_FOR_BED_HEAT, if (bedPreheat) thermalManager.setTargetBed (bedPreheat));
364+ TERN_ (WAIT_FOR_NOZZLE_HEAT, if (hotendPreheat) thermalManager.wait_for_hotend (0 ));
365+ TERN_ (WAIT_FOR_BED_HEAT, if (bedPreheat) thermalManager.wait_for_bed_heating ());
366+ }
367+
368+ #endif
369+
340370/* *
341371 * Attempt to deploy or stow the probe
342372 *
@@ -404,6 +434,9 @@ bool Probe::set_deployed(const bool deploy) {
404434
405435 #endif
406436
437+ // If preheating is required before any probing...
438+ TERN_ (PREHEAT_BEFORE_PROBING, if (deploy) preheat_for_probing (PROBING_NOZZLE_TEMP, PROBING_BED_TEMP));
439+
407440 do_blocking_move_to (old_xy);
408441 endstops.enable_z_probe (deploy);
409442 return false ;
0 commit comments