Skip to content

Commit

Permalink
Restore, improve PREHEAT_BEFORE_LEVELING
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 18, 2020
1 parent 1ea84d5 commit 7859f87
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,15 @@
//#define RESTORE_LEVELING_AFTER_G28
//#define ENABLE_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.
* Turn on with the command 'M111 S32'.
Expand Down
31 changes: 30 additions & 1 deletion Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
#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 @@ -403,6 +406,32 @@ G29_TYPE GcodeSuite::G29() {

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) {
const uint16_t hotendPreheat = TERN0(HAS_HOTEND, thermalManager.degHotend(0) < (LEVELING_NOZZLE_TEMP)) ? (LEVELING_NOZZLE_TEMP) : 0;
const uint16_t bedPreheat = TERN0(HAS_HEATED_BED, thermalManager.degBed() < (LEVELING_BED_TEMP)) ? (LEVELING_BED_TEMP) : 0;
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Preheating "
#if HAS_HOTEND
"hotend (", hotendPreheat, ") " TERN_(HAS_HEATED_BED, "and ")
#endif
#if HAS_HEATED_BED
"bed (", bedPreheat, ")"
#endif
);
TERN_(HAS_HOTEND, if (hotendPreheat) thermalManager.setTargetHotend(hotendPreheat, 0));
TERN_(HAS_HEATED_BED, if (bedPreheat) thermalManager.setTargetBed(bedPreheat));
TERN_(HAS_HOTEND, if (hotendPreheat) thermalManager.wait_for_hotend(0));
TERN_(HAS_HEATED_BED, if (bedPreheat) thermalManager.wait_for_bed_heating());
UNU(hotendPreheat, bedPreheat);
}
#endif

// Disable auto bed leveling during G29.
// Be formal so G29 can be done successively without G28.
if (!no_action) set_bed_leveling_enabled(false);
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
2 changes: 1 addition & 1 deletion buildroot/tests/LPC1768-tests
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ 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 \
Expand Down

0 comments on commit 7859f87

Please sign in to comment.