Minimum temp options for Probing and G12 Nozzle Clean (#20383)

Co-authored-by: Jason Smith <jason.inet@gmail.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
InsanityAutomation
2020-12-19 23:02:38 -05:00
committed by Scott Lahteine
parent 87fbb89330
commit 588fec6474
9 changed files with 95 additions and 24 deletions

View File

@ -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"

View File

@ -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.

View File

@ -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

View File

@ -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
*/

View File

@ -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{ \

View File

@ -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
*
@ -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;

View File

@ -51,6 +51,10 @@ public:
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