From 8394f0c3f445a411d75e5d88d58204ffff45244a Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 10:23:09 -0500 Subject: [PATCH] Generalize function out of nozzle as probe --- Marlin/Configuration.h | 16 +++++------- Marlin/src/module/probe.cpp | 52 ++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8d88cee19d..dda42f2f23 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -884,15 +884,6 @@ * nozzle system or a piezo-electric smart effector. */ //#define NOZZLE_AS_PROBE -#if ENABLED(NOZZLE_AS_PROBE) - // Require a minimum temperature when using the nozzle as a probe. Useful on machines such as the Lulzbot series - // which uses a conductive nozzle or the Creality CR6 and other strain gauge sensors to prevent misreads from filament debris. - #define PROBE_REQUIRES_MINTEMP - #if ENABLED(PROBE_REQUIRES_MINTEMP) - #define PROBE_REQUIRES_MINTEMP_NOZZLE 150 - #define PROBE_REQUIRES_MINTEMP_BED 50 - #endif -#endif /** * Z Servo Probe, such as an endstop switch on a rotating arm. @@ -1066,6 +1057,13 @@ //#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors +// Require a minimum temperature when ubefore allowing probing. Useful on machines such as the Lulzbot series +// which uses a conductive nozzle or the Creality CR6 and other strain gauge sensors to prevent misreads from filament debris. +#define PROBE_REQUIRES_MINTEMP_NOZZLE 150 +#define PROBE_REQUIRES_MINTEMP_BED 50 + + + // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 // :{ 0:'Low', 1:'High' } #define X_ENABLE_ON 0 diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 96b3545edc..381783011b 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -348,34 +348,34 @@ bool Probe::set_deployed(const bool deploy) { constexpr bool deploy_stow_condition = true; #endif - #if BOTH(NOZZLE_AS_PROBE, PROBE_REQUIRES_MINTEMP) - bool setting_hotend, setting_bed = false; - #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && PROBE_REQUIRES_MINTEMP_NOZZLE < 0 && HAS_TEMP_HOTEND - if (thermalManager.degTargetHotend(0) < PROBE_REQUIRES_MINTEMP_NOZZLE) { - uint16_t hotendTemperature = AUTOLEVEL_PREHEAT_NOZZLE_TEMP; - SERIAL_ECHOLNPAIR("Preheating hot-end to ", hotendTemperature); - thermalManager.setTargetHotend(hotendTemperature, 0); - setting_hotend = true; - } - #endif - - #if defined(PROBE_REQUIRES_MINTEMP_BED) && PROBE_REQUIRES_MINTEMP_BED < 0 && HAS_HEATED_BED - if (thermalManager.degBed() < PROBE_REQUIRES_MINTEMP_BED) { - uint16_t bedTemperature = AUTOLEVEL_PREHEAT_BED_TEMP; - SERIAL_ECHOLNPAIR("Preheating bed to ", bedTemperature); - thermalManager.setTargetBed(bedTemperature); - setting_bed = true; - } - #endif - - #if HAS_TEMP_HOTEND - if (setting_hotend) thermalManager.wait_for_hotend(0); - #endif - #if HAS_HEATED_BED - if (setting_bed) thermalManager.wait_for_bed_heating(); - #endif + #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && PROBE_REQUIRES_MINTEMP_NOZZLE < 0 && HAS_TEMP_HOTEND + if (thermalManager.degTargetHotend(0) < PROBE_REQUIRES_MINTEMP_NOZZLE) { + bool setting_hotend = false; + uint16_t hotendTemperature = AUTOLEVEL_PREHEAT_NOZZLE_TEMP; + SERIAL_ECHOLNPAIR("Preheating hot-end to ", hotendTemperature); + thermalManager.setTargetHotend(hotendTemperature, 0); + setting_hotend = true; + } #endif + #if defined(PROBE_REQUIRES_MINTEMP_BED) && PROBE_REQUIRES_MINTEMP_BED < 0 && HAS_HEATED_BED + bool setting_hotend, setting_bed = false; + if (thermalManager.degBed() < PROBE_REQUIRES_MINTEMP_BED) { + uint16_t bedTemperature = AUTOLEVEL_PREHEAT_BED_TEMP; + SERIAL_ECHOLNPAIR("Preheating bed to ", bedTemperature); + thermalManager.setTargetBed(bedTemperature); + setting_bed = true; + } + #endif + + #if HAS_TEMP_HOTEND + if (setting_hotend) thermalManager.wait_for_hotend(0); + #endif + #if HAS_HEATED_BED + if (setting_bed) thermalManager.wait_for_bed_heating(); + #endif + + // For beds that fall when Z is powered off only raise for trusted Z #if ENABLED(UNKNOWN_Z_NO_RAISE) const bool unknown_condition = axis_is_trusted(Z_AXIS);