From 0556da85b0d1aa9dee1fa229296270468cb13180 Mon Sep 17 00:00:00 2001 From: Anson Liu Date: Sat, 27 Nov 2021 17:58:05 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20UM2=20extruder=20cooling=20fan?= =?UTF-8?q?=20on=20PJ6=20(#23194)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/temperature.cpp | 16 ++++++++++++++-- Marlin/src/pins/ramps/pins_ULTIMAIN_2.h | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 3f52ed9407..661a10da93 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -881,9 +881,21 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { }; uint8_t fanState = 0; - HOTEND_LOOP() - if (temp_hotend[e].celsius >= EXTRUDER_AUTO_FAN_TEMPERATURE) + HOTEND_LOOP() { + if (temp_hotend[e].celsius >= EXTRUDER_AUTO_FAN_TEMPERATURE) { SBI(fanState, pgm_read_byte(&fanBit[e])); + #if MOTHERBOARD == BOARD_ULTIMAIN_2 + // For the UM2 the head fan is connected to PJ6, which does not have an Arduino PIN definition. So use direct register access. + // https://github.com/Ultimaker/Ultimaker2Marlin/blob/master/Marlin/temperature.cpp#L553 + SBI(DDRJ, 6); SBI(PORTJ, 6); + #endif + } + else { + #if MOTHERBOARD == BOARD_ULTIMAIN_2 + SBI(DDRJ, 6); CBI(PORTJ, 6); + #endif + } + } #if HAS_AUTO_CHAMBER_FAN if (temp_chamber.celsius >= CHAMBER_AUTO_FAN_TEMPERATURE) diff --git a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h index 128f1974e0..9823d4cf4b 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h @@ -98,7 +98,7 @@ #endif #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN 77 + #define E0_AUTO_FAN_PIN 69 #endif //