diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index adf6a3d5361f..0c166d5dda8a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1067,6 +1067,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 minimum nozzle and/or bed temperature for probing. +//#define PREHEAT_BEFORE_PROBING +#if ENABLED(PREHEAT_BEFORE_PROBING) + #define PROBING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time + #define PROBING_BED_TEMP 50 +#endif + // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 // :{ 0:'Low', 1:'High' } #define X_ENABLE_ON 0 @@ -1296,7 +1303,7 @@ */ //#define PREHEAT_BEFORE_LEVELING #if ENABLED(PREHEAT_BEFORE_LEVELING) - #define LEVELING_NOZZLE_TEMP 120 + #define LEVELING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time #define LEVELING_BED_TEMP 50 #endif @@ -1666,6 +1673,10 @@ // For a purge/clean station mounted on the X axis //#define NOZZLE_CLEAN_NO_Y + // Require a minimum hotend temperature for cleaning + #define NOZZLE_CLEAN_MIN_TEMP 170 + //#define NOZZLE_CLEAN_HEATUP // Heat up the nozzle instead of skipping wipe + // Explicit wipe G-code script applies to a G12 with no arguments. //#define WIPE_SEQUENCE_COMMANDS "G1 X-17 Y25 Z10 F4000\nG1 Z1\nM114\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 X-17 Y25\nG1 X-17 Y95\nG1 Z15\nM400\nG0 X-10.0 Y-9.0" diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 157353c0630b..8e87bb4f7d6f 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -36,12 +36,9 @@ #include "../../../module/probe.h" #include "../../queue.h" -#if EITHER(PROBE_TEMP_COMPENSATION, PREHEAT_BEFORE_LEVELING) - #include "../../../module/temperature.h" -#endif - #if ENABLED(PROBE_TEMP_COMPENSATION) #include "../../../feature/probe_temp_comp.h" + #include "../../../module/temperature.h" #endif #if HAS_DISPLAY @@ -404,25 +401,13 @@ G29_TYPE GcodeSuite::G29() { ExtUI::onMeshLevelingStart(); #endif - if (!faux) remember_feedrate_scaling_off(); + if (!faux) { + remember_feedrate_scaling_off(); - #if ENABLED(PREHEAT_BEFORE_LEVELING) - #ifndef LEVELING_NOZZLE_TEMP - #define LEVELING_NOZZLE_TEMP 0 + #if ENABLED(PREHEAT_BEFORE_LEVELING) + if (!dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, LEVELING_BED_TEMP); #endif - #ifndef LEVELING_BED_TEMP - #define LEVELING_BED_TEMP 0 - #endif - if (!dryrun && !faux) { - constexpr uint16_t hotendPreheat = LEVELING_NOZZLE_TEMP, bedPreheat = LEVELING_BED_TEMP; - if (DEBUGGING(LEVELING)) - DEBUG_ECHOLNPAIR("Preheating hotend (", hotendPreheat, ") and bed (", bedPreheat, ")"); - if (hotendPreheat) thermalManager.setTargetHotend(hotendPreheat, 0); - if (bedPreheat) thermalManager.setTargetBed(bedPreheat); - if (hotendPreheat) thermalManager.wait_for_hotend(0); - if (bedPreheat) thermalManager.wait_for_bed_heating(); - } - #endif + } // Disable auto bed leveling during G29. // Be formal so G29 can be done successively without G28. diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 2ddd7609128f..0433728df313 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -835,6 +835,22 @@ #define TOTAL_PROBING MULTIPLE_PROBING #endif #endif + #if ENABLED(PREHEAT_BEFORE_PROBING) + #ifndef PROBING_NOZZLE_TEMP + #define PROBING_NOZZLE_TEMP 0 + #endif + #ifndef PROBING_BED_TEMP + #define PROBING_BED_TEMP 0 + #endif + #endif + #if ENABLED(PREHEAT_BEFORE_LEVELING) + #ifndef LEVELING_NOZZLE_TEMP + #define LEVELING_NOZZLE_TEMP 0 + #endif + #ifndef LEVELING_BED_TEMP + #define LEVELING_BED_TEMP 0 + #endif + #endif #else // Clear probe pin settings when no probe is selected #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index be7d97e2cac6..904ef0d38a4e 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1514,6 +1514,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif +#if BOTH(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) + #error "Disable PREHEAT_BEFORE_LEVELING when using PREHEAT_BEFORE_PROBING." +#endif + /** * Homing */ diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index 10021005e5b3..4277e8d8d047 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -31,6 +31,10 @@ Nozzle nozzle; #include "../MarlinCore.h" #include "../module/motion.h" +#if NOZZLE_CLEAN_MIN_TEMP > 20 + #include "../module/temperature.h" +#endif + #if ENABLED(NOZZLE_CLEAN_FEATURE) /** @@ -153,6 +157,19 @@ Nozzle nozzle; const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder; + #if NOZZLE_CLEAN_MIN_TEMP > 20 + if (thermalManager.degTargetHotend(arrPos) < NOZZLE_CLEAN_MIN_TEMP) { + #if ENABLED(NOZZLE_CLEAN_HEATUP) + SERIAL_ECHOLNPGM("Nozzle too Cold - Heating"); + thermalManager.setTargetHotend(NOZZLE_CLEAN_MIN_TEMP, arrPos); + thermalManager.wait_for_hotend(arrPos); + #else + SERIAL_ECHOLNPGM("Nozzle too cold - Skipping wipe"); + return; + #endif + } + #endif + #if HAS_SOFTWARE_ENDSTOPS #define LIMIT_AXIS(A) do{ \ diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index a27d66bf9efd..ea3d9c39ebb7 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -337,6 +337,36 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { #endif } +#if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) + + /** + * Do preheating as required before leveling or probing + */ + void Probe::preheat_for_probing(const uint16_t hotend_temp, const uint16_t bed_temp) { + #if PROBING_NOZZLE_TEMP || LEVELING_NOZZLE_TEMP + #define WAIT_FOR_NOZZLE_HEAT + #endif + #if PROBING_BED_TEMP || LEVELING_BED_TEMP + #define WAIT_FOR_BED_HEAT + #endif + const uint16_t hotendPreheat = TERN0(WAIT_FOR_NOZZLE_HEAT, thermalManager.degHotend(0) < hotend_temp) ? hotend_temp : 0, + bedPreheat = TERN0(WAIT_FOR_BED_HEAT, thermalManager.degBed() < bed_temp) ? bed_temp : 0; + DEBUG_ECHOPGM("Preheating "); + if (hotendPreheat) { + DEBUG_ECHOPAIR("hotend (", hotendPreheat, ") "); + if (bedPreheat) DEBUG_ECHOPGM("and "); + } + if (bedPreheat) DEBUG_ECHOPAIR("bed (", bedPreheat, ") "); + DEBUG_EOL(); + + TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotendPreheat) thermalManager.setTargetHotend(hotendPreheat, 0)); + TERN_(WAIT_FOR_BED_HEAT, if (bedPreheat) thermalManager.setTargetBed(bedPreheat)); + TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotendPreheat) thermalManager.wait_for_hotend(0)); + TERN_(WAIT_FOR_BED_HEAT, if (bedPreheat) thermalManager.wait_for_bed_heating()); + } + +#endif + /** * Attempt to deploy or stow the probe * @@ -404,6 +434,9 @@ bool Probe::set_deployed(const bool deploy) { #endif + // If preheating is required before any probing... + TERN_(PREHEAT_BEFORE_PROBING, if (deploy) preheat_for_probing(PROBING_NOZZLE_TEMP, PROBING_BED_TEMP)); + do_blocking_move_to(old_xy); endstops.enable_z_probe(deploy); return false; diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 137d360175e4..3ee699b4db30 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -51,6 +51,10 @@ class Probe { static xyz_pos_t offset; + #if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) + static void preheat_for_probing(const uint16_t hotend_temp, const uint16_t bed_temp); + #endif + static bool set_deployed(const bool deploy); #if IS_KINEMATIC diff --git a/buildroot/tests/LPC1768-tests b/buildroot/tests/LPC1768-tests index b8d073031409..72d794634f95 100755 --- a/buildroot/tests/LPC1768-tests +++ b/buildroot/tests/LPC1768-tests @@ -39,7 +39,7 @@ opt_set TEMP_SENSOR_1 -1 opt_set TEMP_SENSOR_BED 5 opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING SOUND_MENU_ITEM \ - NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ + NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR PREHEAT_BEFORE_LEVELING G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \ @@ -47,6 +47,7 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_ LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER opt_set GRID_MAX_POINTS_X 16 opt_set NOZZLE_TO_PROBE_OFFSET "{ 0, 0, 0 }" +opt_set NOZZLE_CLEAN_MIN_TEMP 170 exec_test $1 $2 "Re-ARM with NOZZLE_AS_PROBE and many features." "$3" # clean up diff --git a/buildroot/tests/rambo-tests b/buildroot/tests/rambo-tests index f93b2d14f255..5bc1b39f7e1f 100755 --- a/buildroot/tests/rambo-tests +++ b/buildroot/tests/rambo-tests @@ -25,7 +25,7 @@ opt_set FANMUX0_PIN 53 opt_disable USE_WATCHDOG opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING PIDTEMPBED PROBE_TEMP_COMPENSATION \ - PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \ + PREHEAT_BEFORE_PROBING PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \ EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \ NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \