New feature: Part-Cooling Fan Multiplexer

This commit is contained in:
Vben
2017-08-15 14:48:10 +02:00
committed by Scott Lahteine
parent e82e9073d6
commit c0409b85e7
32 changed files with 361 additions and 4 deletions

View File

@@ -10271,6 +10271,31 @@ inline void invalid_extruder_error(const uint8_t e) {
#endif // PARKING_EXTRUDER
#if HAS_FANMUX
void fanmux_switch(const uint8_t e) {
WRITE(FANMUX0_PIN, TEST(e, 0) ? HIGH : LOW);
#if PIN_EXISTS(FANMUX1)
WRITE(FANMUX1_PIN, TEST(e, 1) ? HIGH : LOW);
#if PIN_EXISTS(FANMUX2)
WRITE(FANMUX2, TEST(e, 2) ? HIGH : LOW);
#endif
#endif
}
FORCE_INLINE void fanmux_init(void){
SET_OUTPUT(FANMUX0_PIN);
#if PIN_EXISTS(FANMUX1)
SET_OUTPUT(FANMUX1_PIN);
#if PIN_EXISTS(FANMUX2)
SET_OUTPUT(FANMUX2_PIN);
#endif
#endif
fanmux_switch(0);
}
#endif // HAS_FANMUX
/**
* Perform a tool-change, which may result in moving the
* previous tool out of the way and the new tool into place.
@@ -10353,7 +10378,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
// Activate the new extruder
// Activate the new extruder ahead of calling set_axis_is_at_home!
active_extruder = tmp_extruder;
// This function resets the max/min values - the current position may be overwritten below.
@@ -10687,14 +10712,19 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
select_multiplexed_stepper(tmp_extruder);
#endif
// Set the new active extruder
active_extruder = tmp_extruder;
#endif // HOTENDS <= 1
#if ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH
stepper.synchronize();
move_extruder_servo(tmp_extruder);
move_extruder_servo(active_extruder);
#endif
active_extruder = tmp_extruder;
#if HAS_FANMUX
fanmux_switch(active_extruder);
#endif
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, (int)active_extruder);
@@ -13433,7 +13463,11 @@ void setup() {
SET_OUTPUT(E_MUX1_PIN);
SET_OUTPUT(E_MUX2_PIN);
#endif
#if HAS_FANMUX
fanmux_init();
#endif
lcd_init();
#ifndef CUSTOM_BOOTSCREEN_TIMEOUT