Preheat before leveling

This commit is contained in:
Scott Lahteine 2020-12-05 19:56:16 -06:00 committed by Scott Lahteine
parent 6599e4ea53
commit 20bd54f6d3
2 changed files with 31 additions and 1 deletions

View file

@ -1289,6 +1289,15 @@
*/ */
//#define RESTORE_LEVELING_AFTER_G28 //#define RESTORE_LEVELING_AFTER_G28
/**
* Auto-leveling needs preheating
*/
//#define PREHEAT_BEFORE_LEVELING
#if ENABLED(PREHEAT_BEFORE_LEVELING)
#define LEVELING_NOZZLE_TEMP 120
#define LEVELING_BED_TEMP 50
#endif
/** /**
* Enable detailed logging of G28, G29, M48, etc. * Enable detailed logging of G28, G29, M48, etc.
* Turn on with the command 'M111 S32'. * Turn on with the command 'M111 S32'.

View file

@ -36,9 +36,12 @@
#include "../../../module/probe.h" #include "../../../module/probe.h"
#include "../../queue.h" #include "../../queue.h"
#if EITHER(PROBE_TEMP_COMPENSATION, PREHEAT_BEFORE_LEVELING)
#include "../../../module/temperature.h"
#endif
#if ENABLED(PROBE_TEMP_COMPENSATION) #if ENABLED(PROBE_TEMP_COMPENSATION)
#include "../../../feature/probe_temp_comp.h" #include "../../../feature/probe_temp_comp.h"
#include "../../../module/temperature.h"
#endif #endif
#if HAS_DISPLAY #if HAS_DISPLAY
@ -403,6 +406,24 @@ G29_TYPE GcodeSuite::G29() {
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
#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. // Disable auto bed leveling during G29.
// Be formal so G29 can be done successively without G28. // Be formal so G29 can be done successively without G28.
if (!no_action) set_bed_leveling_enabled(false); if (!no_action) set_bed_leveling_enabled(false);