|
@ -259,11 +259,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a |
|
|
#elif ENABLED(PARKING_EXTRUDER) |
|
|
#elif ENABLED(PARKING_EXTRUDER) |
|
|
|
|
|
|
|
|
void pe_solenoid_init() { |
|
|
void pe_solenoid_init() { |
|
|
LOOP_LE_N(n, 1) |
|
|
LOOP_LE_N(n, 1) pe_solenoid_set_pin_state(n, !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE); |
|
|
TERN(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid, pe_deactivate_solenoid)(n); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state) { |
|
|
void pe_solenoid_set_pin_state(const uint8_t extruder_num, const uint8_t state) { |
|
|
switch (extruder_num) { |
|
|
switch (extruder_num) { |
|
|
case 1: OUT_WRITE(SOL1_PIN, state); break; |
|
|
case 1: OUT_WRITE(SOL1_PIN, state); break; |
|
|
default: OUT_WRITE(SOL0_PIN, state); break; |
|
|
default: OUT_WRITE(SOL0_PIN, state); break; |
|
@ -282,11 +281,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a |
|
|
if (!extruder_parked) return false; // nothing to do
|
|
|
if (!extruder_parked) return false; // nothing to do
|
|
|
|
|
|
|
|
|
if (homed_towards_final_tool) { |
|
|
if (homed_towards_final_tool) { |
|
|
pe_deactivate_solenoid(1 - final_tool); |
|
|
pe_solenoid_magnet_off(1 - final_tool); |
|
|
DEBUG_ECHOLNPAIR("Disengage magnet", (int)(1 - final_tool)); |
|
|
DEBUG_ECHOLNPAIR("Disengage magnet", (int)(1 - final_tool)); |
|
|
pe_activate_solenoid(final_tool); |
|
|
pe_solenoid_magnet_on(final_tool); |
|
|
DEBUG_ECHOLNPAIR("Engage magnet", (int)final_tool); |
|
|
DEBUG_ECHOLNPAIR("Engage magnet", (int)final_tool); |
|
|
extruder_parked = false; |
|
|
parking_extruder_set_parked(false); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -335,7 +334,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a |
|
|
|
|
|
|
|
|
planner.synchronize(); |
|
|
planner.synchronize(); |
|
|
DEBUG_ECHOLNPGM("(2) Disengage magnet"); |
|
|
DEBUG_ECHOLNPGM("(2) Disengage magnet"); |
|
|
pe_deactivate_solenoid(active_extruder); |
|
|
pe_solenoid_magnet_off(active_extruder); |
|
|
|
|
|
|
|
|
// STEP 3
|
|
|
// STEP 3
|
|
|
|
|
|
|
|
@ -353,8 +352,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a |
|
|
DEBUG_ECHOLNPGM("(4) Engage magnetic field"); |
|
|
DEBUG_ECHOLNPGM("(4) Engage magnetic field"); |
|
|
|
|
|
|
|
|
// Just save power for inverted magnets
|
|
|
// Just save power for inverted magnets
|
|
|
TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid(active_extruder)); |
|
|
TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_solenoid_magnet_on(active_extruder)); |
|
|
pe_activate_solenoid(new_tool); |
|
|
pe_solenoid_magnet_on(new_tool); |
|
|
|
|
|
|
|
|
// STEP 5
|
|
|
// STEP 5
|
|
|
|
|
|
|
|
@ -382,10 +381,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a |
|
|
extruder_parked = false; |
|
|
extruder_parked = false; |
|
|
} |
|
|
} |
|
|
else if (do_solenoid_activation) { // && nomove == true
|
|
|
else if (do_solenoid_activation) { // && nomove == true
|
|
|
// Deactivate old extruder solenoid
|
|
|
// Deactivate current extruder solenoid
|
|
|
TERN(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid, pe_deactivate_solenoid)(active_extruder); |
|
|
pe_solenoid_set_pin_state(active_extruder, !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE); |
|
|
// Only engage magnetic field for new extruder
|
|
|
// Engage new extruder magnetic field
|
|
|
TERN(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_deactivate_solenoid, pe_activate_solenoid)(new_tool); |
|
|
pe_solenoid_set_pin_state(new_tool, PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
do_solenoid_activation = true; // Activate solenoid for subsequent tool_change()
|
|
|
do_solenoid_activation = true; // Activate solenoid for subsequent tool_change()
|
|
@ -1149,9 +1148,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { |
|
|
// Just move back down
|
|
|
// Just move back down
|
|
|
DEBUG_ECHOLNPGM("Move back Z only"); |
|
|
DEBUG_ECHOLNPGM("Move back Z only"); |
|
|
|
|
|
|
|
|
#if ENABLED(TOOLCHANGE_PARK) |
|
|
if (TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) |
|
|
if (toolchange_settings.enable_park) |
|
|
|
|
|
#endif |
|
|
|
|
|
do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]); |
|
|
do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]); |
|
|
|
|
|
|
|
|
#else |
|
|
#else |
|
|