From 1570559bbac0cf2b6a326471ef649405b7e5dc14 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sat, 5 Dec 2020 18:33:39 -0500 Subject: [PATCH 01/15] Add safety temperature for nozzle as probe --- Marlin/Configuration.h | 7 +++++++ Marlin/src/module/probe.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ebc3311d9e..94d4615a93 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -884,6 +884,13 @@ * nozzle system or a piezo-electric smart effector. */ //#define NOZZLE_AS_PROBE +#if ENABLED(NOZZLE_AS_PROBE) + #define PROBE_REQUIRES_MINTEMP // Require a minimum temperature when using the nozzle as a probe + #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. diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 400206f83a..96b3545edc 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -348,6 +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 + #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); From bbdd481dabcb09f0c59667c9e1776a61721b0bad Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sat, 5 Dec 2020 18:34:58 -0500 Subject: [PATCH 02/15] Tweak comments --- Marlin/Configuration.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 94d4615a93..8d88cee19d 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -885,7 +885,9 @@ */ //#define NOZZLE_AS_PROBE #if ENABLED(NOZZLE_AS_PROBE) - #define PROBE_REQUIRES_MINTEMP // Require a minimum temperature when using the nozzle as a 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 From 8394f0c3f445a411d75e5d88d58204ffff45244a Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 10:23:09 -0500 Subject: [PATCH 03/15] 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); From 3a7f17d7829d92dae42f75158109b2f8d0742f3c Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 10:36:25 -0500 Subject: [PATCH 04/15] Add G12 minimum temp --- Marlin/Configuration.h | 11 +++++++++-- Marlin/src/libs/nozzle.cpp | 13 +++++++++++++ Marlin/src/module/probe.cpp | 3 ++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index dda42f2f23..9c1f255fd1 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1059,8 +1059,8 @@ // 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 +//#define PROBE_REQUIRES_MINTEMP_NOZZLE 150 +//#define PROBE_REQUIRES_MINTEMP_BED 50 @@ -1653,6 +1653,13 @@ // For a purge/clean station mounted on the X axis //#define NOZZLE_CLEAN_NO_Y + #define NOZZLE_CLEAN_MIN_TEMP + #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) + #define NOZZE_CLEAN_TEMP 170 + // Default behavior is to skip nozzles that are too cold. The allows you to force them to heat instead + //#define NOZLE_CLEAN_HEAT_LOWTEMP + #endif + // 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/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index 10021005e5..0fb382dc27 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -153,6 +153,19 @@ Nozzle nozzle; const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder; + #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) && NOZZE_CLEAN_TEMP > 0 + if(thermalManager.degTargetHotend(arrPos)) < NOZZE_CLEAN_TEMP) { + #if ENABLED(NOZLE_CLEAN_HEAT_LOWTEMP) + SERIAL_ECHOLNPGM("Nozzle too Cold - Heating"); + thermalManager.setTargetHotend(NOZZE_CLEAN_TEMP, arrPos); + thermalManager.wait_for_hotend(0); + #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 381783011b..c3fa8ac934 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -348,6 +348,8 @@ bool Probe::set_deployed(const bool deploy) { constexpr bool deploy_stow_condition = true; #endif + bool setting_bed = false; + bool setting_hotend = false; #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; @@ -359,7 +361,6 @@ bool Probe::set_deployed(const bool deploy) { #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); From 438bae5f38417ca250f779d6be077024fdf8d32b Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 10:48:13 -0500 Subject: [PATCH 05/15] Set configs disabled, add tests --- Marlin/Configuration.h | 2 +- Marlin/src/module/probe.cpp | 1 - buildroot/tests/LPC1768-tests | 3 ++- buildroot/tests/rambo-tests | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9c1f255fd1..9e6635ff32 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1653,7 +1653,7 @@ // For a purge/clean station mounted on the X axis //#define NOZZLE_CLEAN_NO_Y - #define NOZZLE_CLEAN_MIN_TEMP + //#define NOZZLE_CLEAN_MIN_TEMP #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) #define NOZZE_CLEAN_TEMP 170 // Default behavior is to skip nozzles that are too cold. The allows you to force them to heat instead diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index c3fa8ac934..de8d03ac31 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -352,7 +352,6 @@ bool Probe::set_deployed(const bool deploy) { bool setting_hotend = false; #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); diff --git a/buildroot/tests/LPC1768-tests b/buildroot/tests/LPC1768-tests index b8d0730314..11214f7cba 100755 --- a/buildroot/tests/LPC1768-tests +++ b/buildroot/tests/LPC1768-tests @@ -42,11 +42,12 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_ NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR 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 \ + Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \ NOZZLE_CLEAN_MIN_TEMP \ HOST_KEEPALIVE_FEATURE HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT \ 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 NOZZE_CLEAN_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 6d2ef4f58a..1c276b79c4 100644 --- a/buildroot/tests/rambo-tests +++ b/buildroot/tests/rambo-tests @@ -22,6 +22,8 @@ opt_add TEMP_CHAMBER_PIN 3 opt_add HEATER_CHAMBER_PIN 45 opt_set GRID_MAX_POINTS_X 16 opt_set FANMUX0_PIN 53 +opt_set PROBE_REQUIRES_MINTEMP_NOZZLE 150 +opt_set PROBE_REQUIRES_MINTEMP_BED 50 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 \ From cfb1c4c9f296e93060f3f5fb5e76f4493454f300 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 10:55:17 -0500 Subject: [PATCH 06/15] Update LPC1768-tests --- buildroot/tests/LPC1768-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/tests/LPC1768-tests b/buildroot/tests/LPC1768-tests index 11214f7cba..0877e08bdf 100755 --- a/buildroot/tests/LPC1768-tests +++ b/buildroot/tests/LPC1768-tests @@ -42,7 +42,7 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_ NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR 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 \ NOZZLE_CLEAN_MIN_TEMP \ + Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE NOZZLE_CLEAN_MIN_TEMP \ HOST_KEEPALIVE_FEATURE HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT \ 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 From 1c0770ea5c9b9180f27f480b7206ad3bd02c6a50 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 11:02:07 -0500 Subject: [PATCH 07/15] Update nozzle.cpp --- Marlin/src/libs/nozzle.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index 0fb382dc27..9fdc40f6a9 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 ENABLED(NOZZLE_CLEAN_MIN_TEMP) + #include "../module/temperature.h" +#endif + #if ENABLED(NOZZLE_CLEAN_FEATURE) /** From 62b81dc2be9f4a4a49e5d997a82c2d9974b50a94 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 11:08:32 -0500 Subject: [PATCH 08/15] Update nozzle.cpp --- Marlin/src/libs/nozzle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index 9fdc40f6a9..dd29caf517 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -158,7 +158,7 @@ Nozzle nozzle; const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder; #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) && NOZZE_CLEAN_TEMP > 0 - if(thermalManager.degTargetHotend(arrPos)) < NOZZE_CLEAN_TEMP) { + if(thermalManager.degTargetHotend(arrPos) < NOZZE_CLEAN_TEMP) { #if ENABLED(NOZLE_CLEAN_HEAT_LOWTEMP) SERIAL_ECHOLNPGM("Nozzle too Cold - Heating"); thermalManager.setTargetHotend(NOZZE_CLEAN_TEMP, arrPos); From e3982ca308bc083ba65153136aeff2c63267ccec Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 6 Dec 2020 10:48:13 -0500 Subject: [PATCH 09/15] Set configs disabled, add tests --- Marlin/Configuration.h | 2 +- Marlin/src/libs/nozzle.cpp | 6 +++++- Marlin/src/module/probe.cpp | 1 - buildroot/tests/LPC1768-tests | 3 ++- buildroot/tests/rambo-tests | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9c1f255fd1..9e6635ff32 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1653,7 +1653,7 @@ // For a purge/clean station mounted on the X axis //#define NOZZLE_CLEAN_NO_Y - #define NOZZLE_CLEAN_MIN_TEMP + //#define NOZZLE_CLEAN_MIN_TEMP #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) #define NOZZE_CLEAN_TEMP 170 // Default behavior is to skip nozzles that are too cold. The allows you to force them to heat instead diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index 0fb382dc27..dd29caf517 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 ENABLED(NOZZLE_CLEAN_MIN_TEMP) + #include "../module/temperature.h" +#endif + #if ENABLED(NOZZLE_CLEAN_FEATURE) /** @@ -154,7 +158,7 @@ Nozzle nozzle; const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder; #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) && NOZZE_CLEAN_TEMP > 0 - if(thermalManager.degTargetHotend(arrPos)) < NOZZE_CLEAN_TEMP) { + if(thermalManager.degTargetHotend(arrPos) < NOZZE_CLEAN_TEMP) { #if ENABLED(NOZLE_CLEAN_HEAT_LOWTEMP) SERIAL_ECHOLNPGM("Nozzle too Cold - Heating"); thermalManager.setTargetHotend(NOZZE_CLEAN_TEMP, arrPos); diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index c3fa8ac934..de8d03ac31 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -352,7 +352,6 @@ bool Probe::set_deployed(const bool deploy) { bool setting_hotend = false; #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); diff --git a/buildroot/tests/LPC1768-tests b/buildroot/tests/LPC1768-tests index b8d0730314..0877e08bdf 100755 --- a/buildroot/tests/LPC1768-tests +++ b/buildroot/tests/LPC1768-tests @@ -42,11 +42,12 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_ NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR 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 \ + Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE NOZZLE_CLEAN_MIN_TEMP \ HOST_KEEPALIVE_FEATURE HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT \ 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 NOZZE_CLEAN_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 6d2ef4f58a..1c276b79c4 100644 --- a/buildroot/tests/rambo-tests +++ b/buildroot/tests/rambo-tests @@ -22,6 +22,8 @@ opt_add TEMP_CHAMBER_PIN 3 opt_add HEATER_CHAMBER_PIN 45 opt_set GRID_MAX_POINTS_X 16 opt_set FANMUX0_PIN 53 +opt_set PROBE_REQUIRES_MINTEMP_NOZZLE 150 +opt_set PROBE_REQUIRES_MINTEMP_BED 50 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 \ From 72cdf4a11dbf65a4cbd432292bcefd2619b23c87 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 8 Dec 2020 20:15:18 -0800 Subject: [PATCH 10/15] Typos, comments. --- Marlin/Configuration.h | 13 +++++-------- Marlin/src/libs/nozzle.cpp | 8 ++++---- buildroot/tests/LPC1768-tests | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9e6635ff32..d07eaa9d2b 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1057,12 +1057,9 @@ //#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. +// Require minimum nozzle or bed temperature for probing. //#define PROBE_REQUIRES_MINTEMP_NOZZLE 150 -//#define PROBE_REQUIRES_MINTEMP_BED 50 - - +//#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' } @@ -1655,9 +1652,9 @@ //#define NOZZLE_CLEAN_MIN_TEMP #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) - #define NOZZE_CLEAN_TEMP 170 - // Default behavior is to skip nozzles that are too cold. The allows you to force them to heat instead - //#define NOZLE_CLEAN_HEAT_LOWTEMP + #define NOZZLE_CLEAN_TEMP 170 + // Heat nozzle if temperature is too low. Default behavior is to skip cleaning. + //#define NOZZLE_CLEAN_HEAT_LOWTEMP #endif // Explicit wipe G-code script applies to a G12 with no arguments. diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index dd29caf517..bd449ced3b 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -157,11 +157,11 @@ Nozzle nozzle; const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder; - #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) && NOZZE_CLEAN_TEMP > 0 - if(thermalManager.degTargetHotend(arrPos) < NOZZE_CLEAN_TEMP) { - #if ENABLED(NOZLE_CLEAN_HEAT_LOWTEMP) + #if ENABLED(NOZZLE_CLEAN_MIN_TEMP) && NOZZLE_CLEAN_TEMP > 0 + if(thermalManager.degTargetHotend(arrPos) < NOZZLE_CLEAN_TEMP) { + #if ENABLED(NOZZLE_CLEAN_HEAT_LOWTEMP) SERIAL_ECHOLNPGM("Nozzle too Cold - Heating"); - thermalManager.setTargetHotend(NOZZE_CLEAN_TEMP, arrPos); + thermalManager.setTargetHotend(NOZZLE_CLEAN_TEMP, arrPos); thermalManager.wait_for_hotend(0); #else SERIAL_ECHOLNPGM("Nozzle too cold - Skipping Wipe"); diff --git a/buildroot/tests/LPC1768-tests b/buildroot/tests/LPC1768-tests index 0877e08bdf..e06a04ada6 100755 --- a/buildroot/tests/LPC1768-tests +++ b/buildroot/tests/LPC1768-tests @@ -47,7 +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 NOZZE_CLEAN_TEMP 170 +opt_set NOZZLE_CLEAN_TEMP 170 exec_test $1 $2 "Re-ARM with NOZZLE_AS_PROBE and many features." "$3" # clean up From 49b53a04b59d5d1c9a4fbabf145b7551d4ec8c28 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 8 Dec 2020 20:26:36 -0800 Subject: [PATCH 11/15] Wait for the same hotend that is heating. --- Marlin/src/libs/nozzle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index bd449ced3b..4cb1c99bf9 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -162,7 +162,7 @@ Nozzle nozzle; #if ENABLED(NOZZLE_CLEAN_HEAT_LOWTEMP) SERIAL_ECHOLNPGM("Nozzle too Cold - Heating"); thermalManager.setTargetHotend(NOZZLE_CLEAN_TEMP, arrPos); - thermalManager.wait_for_hotend(0); + thermalManager.wait_for_hotend(arrPos); #else SERIAL_ECHOLNPGM("Nozzle too cold - Skipping Wipe"); return; From 0c0f7adfafffbadf387b75add55688c559e4549d Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 8 Dec 2020 20:27:01 -0800 Subject: [PATCH 12/15] Clarify that PROBE_REQUIRES_MINTEMP_NOZZLE only works with first extruder --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d07eaa9d2b..3a17d77709 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1057,7 +1057,7 @@ //#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 or bed temperature for probing. +// Require minimum nozzle or bed temperature for probing. Currently applies only to the first extruder. //#define PROBE_REQUIRES_MINTEMP_NOZZLE 150 //#define PROBE_REQUIRES_MINTEMP_BED 50 From 88f1e635accb2bcfe8c9b2e2903a72c1e3ab386f Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 8 Dec 2020 20:27:53 -0800 Subject: [PATCH 13/15] Get all new PROBE_REQUIRES_MINTEMP code inside #ifs --- Marlin/src/module/probe.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index de8d03ac31..45a3177e8a 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -348,9 +348,8 @@ bool Probe::set_deployed(const bool deploy) { constexpr bool deploy_stow_condition = true; #endif - bool setting_bed = false; - bool setting_hotend = false; #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && PROBE_REQUIRES_MINTEMP_NOZZLE < 0 && HAS_TEMP_HOTEND + bool setting_hotend = false; if (thermalManager.degTargetHotend(0) < PROBE_REQUIRES_MINTEMP_NOZZLE) { uint16_t hotendTemperature = AUTOLEVEL_PREHEAT_NOZZLE_TEMP; SERIAL_ECHOLNPAIR("Preheating hot-end to ", hotendTemperature); @@ -360,6 +359,7 @@ bool Probe::set_deployed(const bool deploy) { #endif #if defined(PROBE_REQUIRES_MINTEMP_BED) && PROBE_REQUIRES_MINTEMP_BED < 0 && HAS_HEATED_BED + bool setting_bed = false; if (thermalManager.degBed() < PROBE_REQUIRES_MINTEMP_BED) { uint16_t bedTemperature = AUTOLEVEL_PREHEAT_BED_TEMP; SERIAL_ECHOLNPAIR("Preheating bed to ", bedTemperature); @@ -368,14 +368,14 @@ bool Probe::set_deployed(const bool deploy) { } #endif - #if HAS_TEMP_HOTEND + #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && PROBE_REQUIRES_MINTEMP_NOZZLE < 0 && HAS_TEMP_HOTEND if (setting_hotend) thermalManager.wait_for_hotend(0); #endif - #if HAS_HEATED_BED + + #if defined(PROBE_REQUIRES_MINTEMP_BED) && PROBE_REQUIRES_MINTEMP_BED < 0 && 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); From 88613ca7e064eec129e8454653afb25d0748536f Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 8 Dec 2020 20:47:51 -0800 Subject: [PATCH 14/15] Invert compare, use correct constants, add parens --- Marlin/src/module/probe.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 45a3177e8a..bfe78f0225 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -348,31 +348,31 @@ bool Probe::set_deployed(const bool deploy) { constexpr bool deploy_stow_condition = true; #endif - #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && PROBE_REQUIRES_MINTEMP_NOZZLE < 0 && HAS_TEMP_HOTEND + #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && (PROBE_REQUIRES_MINTEMP_NOZZLE) > 0 && HAS_TEMP_HOTEND bool setting_hotend = false; if (thermalManager.degTargetHotend(0) < PROBE_REQUIRES_MINTEMP_NOZZLE) { - uint16_t hotendTemperature = AUTOLEVEL_PREHEAT_NOZZLE_TEMP; + uint16_t hotendTemperature = (PROBE_REQUIRES_MINTEMP_NOZZLE); 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 defined(PROBE_REQUIRES_MINTEMP_BED) && (PROBE_REQUIRES_MINTEMP_BED) > 0 && HAS_HEATED_BED bool setting_bed = false; - if (thermalManager.degBed() < PROBE_REQUIRES_MINTEMP_BED) { - uint16_t bedTemperature = AUTOLEVEL_PREHEAT_BED_TEMP; + if (thermalManager.degBed() < (PROBE_REQUIRES_MINTEMP_BED)) { + uint16_t bedTemperature = (PROBE_REQUIRES_MINTEMP_BED); SERIAL_ECHOLNPAIR("Preheating bed to ", bedTemperature); thermalManager.setTargetBed(bedTemperature); setting_bed = true; } #endif - #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && PROBE_REQUIRES_MINTEMP_NOZZLE < 0 && HAS_TEMP_HOTEND + #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && (PROBE_REQUIRES_MINTEMP_NOZZLE) < 0 && HAS_TEMP_HOTEND if (setting_hotend) thermalManager.wait_for_hotend(0); #endif - #if defined(PROBE_REQUIRES_MINTEMP_BED) && PROBE_REQUIRES_MINTEMP_BED < 0 && HAS_HEATED_BED + #if defined(PROBE_REQUIRES_MINTEMP_BED) && (PROBE_REQUIRES_MINTEMP_BED) < 0 && HAS_HEATED_BED if (setting_bed) thermalManager.wait_for_bed_heating(); #endif From c393153243a9421825d8e59ff3d0a86501569a8f Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 8 Dec 2020 20:51:57 -0800 Subject: [PATCH 15/15] cleanup --- Marlin/src/module/probe.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index bfe78f0225..c5a92ede7f 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -349,32 +349,27 @@ bool Probe::set_deployed(const bool deploy) { #endif #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && (PROBE_REQUIRES_MINTEMP_NOZZLE) > 0 && HAS_TEMP_HOTEND - bool setting_hotend = false; - if (thermalManager.degTargetHotend(0) < PROBE_REQUIRES_MINTEMP_NOZZLE) { + #define WAIT_FOR_NOZZLE_HEAT 1 + bool setting_hotend = thermalManager.degTargetHotend(0) < (PROBE_REQUIRES_MINTEMP_NOZZLE); + if (setting_hotend) { uint16_t hotendTemperature = (PROBE_REQUIRES_MINTEMP_NOZZLE); - SERIAL_ECHOLNPAIR("Preheating hot-end to ", hotendTemperature); + SERIAL_ECHOLNPAIR("Preheating hotend 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_bed = false; - if (thermalManager.degBed() < (PROBE_REQUIRES_MINTEMP_BED)) { + #define WAIT_FOR_BED_HEAT 1 + bool setting_bed = thermalManager.degBed() < (PROBE_REQUIRES_MINTEMP_BED); + if (setting_bed) { uint16_t bedTemperature = (PROBE_REQUIRES_MINTEMP_BED); SERIAL_ECHOLNPAIR("Preheating bed to ", bedTemperature); thermalManager.setTargetBed(bedTemperature); - setting_bed = true; } #endif - #if defined(PROBE_REQUIRES_MINTEMP_NOZZLE) && (PROBE_REQUIRES_MINTEMP_NOZZLE) < 0 && HAS_TEMP_HOTEND - if (setting_hotend) thermalManager.wait_for_hotend(0); - #endif - - #if defined(PROBE_REQUIRES_MINTEMP_BED) && (PROBE_REQUIRES_MINTEMP_BED) < 0 && HAS_HEATED_BED - if (setting_bed) thermalManager.wait_for_bed_heating(); - #endif + TERN_(WAIT_FOR_NOZZLE_HEAT, if (setting_hotend) thermalManager.wait_for_hotend(0)); + TERN_(WAIT_FOR_BED_HEAT, if (setting_bed) thermalManager.wait_for_bed_heating()); // For beds that fall when Z is powered off only raise for trusted Z #if ENABLED(UNKNOWN_Z_NO_RAISE)