Skip to content

Commit 622af13

Browse files
InsanityAutomationsjasonsmiththinkyhead
committed
Minimum temp options for Probing and G12 Nozzle Clean (MarlinFirmware#20383)
Co-authored-by: Jason Smith <[email protected]> Co-authored-by: Scott Lahteine <[email protected]>
1 parent 412c0b2 commit 622af13

File tree

9 files changed

+95
-24
lines changed

9 files changed

+95
-24
lines changed

Marlin/Configuration.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,13 @@
10661066
//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing
10671067
//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors
10681068

1069+
// Require minimum nozzle and/or bed temperature for probing.
1070+
//#define PREHEAT_BEFORE_PROBING
1071+
#if ENABLED(PREHEAT_BEFORE_PROBING)
1072+
#define PROBING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time
1073+
#define PROBING_BED_TEMP 50
1074+
#endif
1075+
10691076
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
10701077
// :{ 0:'Low', 1:'High' }
10711078
#define X_ENABLE_ON 0
@@ -1295,7 +1302,7 @@
12951302
*/
12961303
//#define PREHEAT_BEFORE_LEVELING
12971304
#if ENABLED(PREHEAT_BEFORE_LEVELING)
1298-
#define LEVELING_NOZZLE_TEMP 120
1305+
#define LEVELING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time
12991306
#define LEVELING_BED_TEMP 50
13001307
#endif
13011308

@@ -1670,6 +1677,10 @@
16701677
// For a purge/clean station mounted on the X axis
16711678
//#define NOZZLE_CLEAN_NO_Y
16721679

1680+
// Require a minimum hotend temperature for cleaning
1681+
#define NOZZLE_CLEAN_MIN_TEMP 170
1682+
//#define NOZZLE_CLEAN_HEATUP // Heat up the nozzle instead of skipping wipe
1683+
16731684
// Explicit wipe G-code script applies to a G12 with no arguments.
16741685
//#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"
16751686

Marlin/src/gcode/bedlevel/abl/G29.cpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include "../../../module/probe.h"
3737
#include "../../queue.h"
3838

39-
#if EITHER(PROBE_TEMP_COMPENSATION, PREHEAT_BEFORE_LEVELING)
40-
#include "../../../module/temperature.h"
41-
#endif
42-
4339
#if ENABLED(PROBE_TEMP_COMPENSATION)
4440
#include "../../../feature/probe_temp_comp.h"
41+
#include "../../../module/temperature.h"
4542
#endif
4643

4744
#if HAS_DISPLAY
@@ -404,25 +401,13 @@ G29_TYPE GcodeSuite::G29() {
404401
ExtUI::onMeshLevelingStart();
405402
#endif
406403

407-
if (!faux) remember_feedrate_scaling_off();
404+
if (!faux) {
405+
remember_feedrate_scaling_off();
408406

409-
#if ENABLED(PREHEAT_BEFORE_LEVELING)
410-
#ifndef LEVELING_NOZZLE_TEMP
411-
#define LEVELING_NOZZLE_TEMP 0
407+
#if ENABLED(PREHEAT_BEFORE_LEVELING)
408+
if (!dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, LEVELING_BED_TEMP);
412409
#endif
413-
#ifndef LEVELING_BED_TEMP
414-
#define LEVELING_BED_TEMP 0
415-
#endif
416-
if (!dryrun && !faux) {
417-
constexpr uint16_t hotendPreheat = LEVELING_NOZZLE_TEMP, bedPreheat = LEVELING_BED_TEMP;
418-
if (DEBUGGING(LEVELING))
419-
DEBUG_ECHOLNPAIR("Preheating hotend (", hotendPreheat, ") and bed (", bedPreheat, ")");
420-
if (hotendPreheat) thermalManager.setTargetHotend(hotendPreheat, 0);
421-
if (bedPreheat) thermalManager.setTargetBed(bedPreheat);
422-
if (hotendPreheat) thermalManager.wait_for_hotend(0);
423-
if (bedPreheat) thermalManager.wait_for_bed_heating();
424-
}
425-
#endif
410+
}
426411

427412
// Disable auto bed leveling during G29.
428413
// Be formal so G29 can be done successively without G28.

Marlin/src/inc/Conditionals_LCD.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,22 @@
818818
#define TOTAL_PROBING MULTIPLE_PROBING
819819
#endif
820820
#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
821837
#else
822838
// Clear probe pin settings when no probe is selected
823839
#undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

Marlin/src/inc/SanityCheck.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
15191519
#endif
15201520
#endif
15211521

1522+
#if BOTH(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
1523+
#error "Disable PREHEAT_BEFORE_LEVELING when using PREHEAT_BEFORE_PROBING."
1524+
#endif
1525+
15221526
/**
15231527
* Homing
15241528
*/

Marlin/src/libs/nozzle.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Nozzle nozzle;
3131
#include "../MarlinCore.h"
3232
#include "../module/motion.h"
3333

34+
#if NOZZLE_CLEAN_MIN_TEMP > 20
35+
#include "../module/temperature.h"
36+
#endif
37+
3438
#if ENABLED(NOZZLE_CLEAN_FEATURE)
3539

3640
/**
@@ -153,6 +157,19 @@ Nozzle nozzle;
153157

154158
const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder;
155159

160+
#if NOZZLE_CLEAN_MIN_TEMP > 20
161+
if (thermalManager.degTargetHotend(arrPos) < NOZZLE_CLEAN_MIN_TEMP) {
162+
#if ENABLED(NOZZLE_CLEAN_HEATUP)
163+
SERIAL_ECHOLNPGM("Nozzle too Cold - Heating");
164+
thermalManager.setTargetHotend(NOZZLE_CLEAN_MIN_TEMP, arrPos);
165+
thermalManager.wait_for_hotend(arrPos);
166+
#else
167+
SERIAL_ECHOLNPGM("Nozzle too cold - Skipping wipe");
168+
return;
169+
#endif
170+
}
171+
#endif
172+
156173
#if HAS_SOFTWARE_ENDSTOPS
157174

158175
#define LIMIT_AXIS(A) do{ \

Marlin/src/module/probe.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

Marlin/src/module/probe.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class Probe {
5151

5252
static xyz_pos_t offset;
5353

54+
#if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
55+
static void preheat_for_probing(const uint16_t hotend_temp, const uint16_t bed_temp);
56+
#endif
57+
5458
static bool set_deployed(const bool deploy);
5559

5660
#if IS_KINEMATIC

buildroot/tests/LPC1768-tests

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ opt_set TEMP_SENSOR_1 -1
3939
opt_set TEMP_SENSOR_BED 5
4040
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \
4141
FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING SOUND_MENU_ITEM \
42-
NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
42+
NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR PREHEAT_BEFORE_LEVELING G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
4343
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
4444
PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
4545
Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \
4646
HOST_KEEPALIVE_FEATURE HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT \
4747
LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER
4848
opt_set GRID_MAX_POINTS_X 16
4949
opt_set NOZZLE_TO_PROBE_OFFSET "{ 0, 0, 0 }"
50+
opt_set NOZZLE_CLEAN_MIN_TEMP 170
5051
exec_test $1 $2 "Re-ARM with NOZZLE_AS_PROBE and many features." "$3"
5152

5253
# clean up

buildroot/tests/rambo-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ opt_set FANMUX0_PIN 53
2525
opt_disable USE_WATCHDOG
2626
opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \
2727
FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING PIDTEMPBED PROBE_TEMP_COMPENSATION \
28-
PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \
28+
PREHEAT_BEFORE_PROBING PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \
2929
EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \
3030
BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \
3131
NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \

0 commit comments

Comments
 (0)