Skip to content

Commit

Permalink
Minimum temp options for Probing and G12 Nozzle Clean (MarlinFirmware…
Browse files Browse the repository at this point in the history
…#20383)

Co-authored-by: Jason Smith <jason.inet@gmail.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
  • Loading branch information
3 people authored and dpreed committed Feb 5, 2021
1 parent 7e7ccf6 commit 452ff1d
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 24 deletions.
13 changes: 12 additions & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,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
Expand Down Expand Up @@ -1434,7 +1441,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

Expand Down Expand Up @@ -1806,6 +1813,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"

Expand Down
27 changes: 6 additions & 21 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
16 changes: 16 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,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
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
17 changes: 17 additions & 0 deletions Marlin/src/libs/nozzle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

/**
Expand Down Expand Up @@ -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{ \
Expand Down
33 changes: 33 additions & 0 deletions Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,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
*
Expand Down Expand Up @@ -392,6 +422,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;
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/module/probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion buildroot/tests/LPC1768-tests
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ 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 \
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 NOZZLE_CLEAN_MIN_TEMP 170
exec_test $1 $2 "Re-ARM with NOZZLE_AS_PROBE and many features." "$3"

# clean up
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/rambo-tests
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 452ff1d

Please sign in to comment.