Skip to content

Commit

Permalink
Fix powerloss, homing and calibration with multiple tools
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndere1 committed Dec 29, 2024
1 parent 87dd27f commit fbe195f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ void PrintJobRecovery::resume() {
#endif

// Restore the previously active tool (with no_move)
#if HAS_MULTI_TOOLS || HAS_MULTI_HOTEND
#if HAS_TOOLCHANGE
PROCESS_SUBCOMMANDS_NOW(TS('T', info.active_extruder, 'S'));
#endif

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "../../module/motion.h" // for set/restore_homing_current
#endif

#if HAS_MULTI_HOTEND
#if HAS_TOOLCHANGE
#include "../../module/tool_change.h"
#endif

Expand Down Expand Up @@ -383,7 +383,7 @@ void GcodeSuite::G28() {
#endif

// Always home with tool 0 active
#if HAS_MULTI_HOTEND
#if HAS_TOOLCHANGE
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
const uint8_t old_tool_index = active_extruder;
#endif
Expand Down Expand Up @@ -661,7 +661,7 @@ void GcodeSuite::G28() {
TERN_(CAN_SET_LEVELING_AFTER_G28, if (leveling_restore_state) set_bed_leveling_enabled());

// Restore the active tool after homing
#if HAS_MULTI_HOTEND && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
#if HAS_TOOLCHANGE && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
tool_change(old_tool_index, TERN(PARKING_EXTRUDER, !pe_final_change_must_unpark, DISABLED(DUAL_X_CARRIAGE))); // Do move if one of these
#endif

Expand Down
11 changes: 6 additions & 5 deletions Marlin/src/gcode/calibrate/G425.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "../../module/endstops.h"
#include "../../feature/bedlevel/bedlevel.h"

#if HAS_MULTI_HOTEND
#if HAS_TOOLCHANGE
#include "../../module/tool_change.h"
#endif

Expand Down Expand Up @@ -750,7 +750,7 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const
TEMPORARY_BACKLASH_CORRECTION(backlash.all_on);
TEMPORARY_BACKLASH_SMOOTHING(0.0f);

TERN(HAS_MULTI_HOTEND, set_nozzle(m, extruder), UNUSED(extruder));
TERN(HAS_TOOLCHANGE, set_nozzle(m, extruder), UNUSED(extruder));

probe_sides(m, uncertainty);

Expand Down Expand Up @@ -794,7 +794,7 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty)

TERN_(HAS_HOTEND_OFFSET, normalize_hotend_offsets());

TERN_(HAS_MULTI_HOTEND, set_nozzle(m, 0));
TERN_(HAS_TOOLCHANGE, set_nozzle(m, 0));
}

/**
Expand Down Expand Up @@ -822,8 +822,9 @@ inline void calibrate_all() {
TERN_(BACKLASH_GCODE, calibrate_backlash(m, CALIBRATION_MEASUREMENT_UNCERTAIN));

// Cycle the toolheads so the servos settle into their "natural" positions
#if HAS_MULTI_HOTEND
HOTEND_LOOP() set_nozzle(m, e);
#if HAS_TOOLCHANGE
for (int8_t t = 0; t < TOOLS; t++)
set_nozzle(m, e);
#endif

// Do a slow and precise calibration of the toolheads
Expand Down

0 comments on commit fbe195f

Please sign in to comment.