Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
35e14b4
Add Controller fan settings (DWIN display)
wlkmanist Apr 3, 2024
0cc7140
Add editable Kickstart with DWIN support, fix&improve Controller fan …
wlkmanist Apr 4, 2024
d5b5670
configuration_adv: enable Controller and Extruder fan menu settings
wlkmanist Apr 3, 2024
38ca05f
configuration_adv: Kickstart
wlkmanist Apr 4, 2024
ff85609
Add editable Extruder Auto Fans settings with DWIN support
wlkmanist Apr 8, 2024
b348626
Controller Fan and Auto Fans small improvements
wlkmanist Apr 8, 2024
77c3379
fix Controller Fan with Kickstart
wlkmanist Apr 8, 2024
0cb89f6
Add RU locale for fan settings menu
wlkmanist Apr 8, 2024
5489534
Fix fan speed calculation macro
wlkmanist Apr 8, 2024
84d6907
dwin: fix advanced settings items count
wlkmanist Apr 17, 2024
2437714
dwin: function namings
wlkmanist Apr 17, 2024
dc89046
controllerfan: reduce fan speed update interval during kickstart
wlkmanist Apr 17, 2024
9cc1574
fix M711 and M712 report
wlkmanist Apr 18, 2024
1a53257
dwin: fix menu back item for Fans Settings
wlkmanist Apr 20, 2024
b7e9ef1
Merge branch 'upstream' into adv_fan_menu
wlkmanist Apr 20, 2024
40c3cab
dwin: fix incudes for controllerfan, kickstart, autofans
wlkmanist Apr 21, 2024
bad6240
check if fans actually connected to use with editable/menu
wlkmanist Apr 21, 2024
3db853a
return back checking every extruder auto fan for specific builds
wlkmanist Apr 21, 2024
dec739e
Merge branch 'upstream' into adv_fan_menu
wlkmanist Apr 22, 2024
7185c1d
dwin: use ternary for Fans Settings menu items count
wlkmanist Apr 21, 2024
6c8fd02
Merge branch '2024-December' of https://github.com/classicrocker883/M…
classicrocker883 Dec 28, 2024
4a631da
cleanup dwin menu
classicrocker883 Dec 28, 2024
1c5f5d9
rename CALC_FAN_SPEED
classicrocker883 Dec 28, 2024
8989ab8
update configs_adv
classicrocker883 Dec 28, 2024
1f803bb
fix errors, rearrange - update
classicrocker883 Dec 29, 2024
3f26c7e
Update BTT SKR Mini configs
classicrocker883 Dec 30, 2024
ad674b8
Update feature/controllerfan
classicrocker883 Dec 30, 2024
bd7361a
arrange and define changes
classicrocker883 Dec 31, 2024
81ec1c0
Update - check-pr.yml
classicrocker883 Jan 2, 2025
b00008f
Merge branch '2024-December' of https://github.com/classicrocker883/M…
classicrocker883 Jan 2, 2025
8a0da24
Merge branch '2025-January' of https://github.com/classicrocker883/MR…
classicrocker883 Jan 13, 2025
e859eff
config addons
classicrocker883 Jan 20, 2025
c2526a9
Update check-pr.yml date
classicrocker883 Aug 29, 2025
c63f084
Merge branch '2025-August' into adv_fan_menu
classicrocker883 Aug 30, 2025
02561e9
revert configs
classicrocker883 Aug 30, 2025
8cb23e7
move kickstart and autofans to controllerfan
classicrocker883 Aug 30, 2025
64257fb
small changes
classicrocker883 Aug 30, 2025
9f3d00e
use FLIP
classicrocker883 Aug 31, 2025
93c62fe
Merge branch '2025-September' into adv_fan_menu
classicrocker883 Sep 7, 2025
6da8a16
Merge branch '2025-September' into adv_fan_menu
classicrocker883 Sep 23, 2025
37ce7a2
add fans to test
classicrocker883 Sep 23, 2025
4cb89e3
Merge branch '2025-September' into adv_fan_menu
classicrocker883 Sep 23, 2025
7f7716c
update pioutil.py
classicrocker883 Sep 24, 2025
2602848
check unwam
classicrocker883 Sep 24, 2025
6600ea7
Merge branch '2025-September' into adv_fan_menu
classicrocker883 Sep 24, 2025
191d78d
Merge branch '2025-October' into adv_fan_menu
classicrocker883 Oct 7, 2025
b9b01fa
Merge branch '2025-October' into adv_fan_menu
classicrocker883 Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ name: Bad PR Target
on:
pull_request_target:
types: [opened]
branches:
- 2025-*

jobs:
bad_target:
Expand Down
27 changes: 22 additions & 5 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@
//#define CONTROLLER_FAN2_PIN -1 // Set a custom pin for second controller fan
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
//#define CONTROLLER_FAN_IGNORE_Z // Ignore Z stepper. Useful when stepper timeout is disabled.
#define CONTROLLERFAN_SPEED_MIN 0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
#define CONTROLLERFAN_SPEED_MIN 40 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
#define CONTROLLERFAN_SPEED_MAX 127 // (0-255) Maximum speed. (Use only for a specific hardware build, or with non default PWM Scale, needs testing with other builds.)
#define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
#define CONTROLLERFAN_SPEED_IDLE 0 // (0-255) Idle speed, used when motors are disabled
#define CONTROLLERFAN_IDLE_TIME 60 // (seconds) Extra time to keep the fan running after disabling motors
Expand Down Expand Up @@ -618,6 +619,10 @@
//#define FAN_KICKSTART_POWER 180 // 64-255
//#define FAN_KICKSTART_LINEAR // Set kickstart time linearly based on the speed, e.g., for 20% (51) it will be FAN_KICKSTART_TIME * 0.2.
// Useful for quick speed up to low speed. Kickstart power must be set to 255.
//#define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings
#if ENABLED(FAN_KICKSTART_EDITABLE)
#define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu
#endif

// Some coolers may require a non-zero "off" state.
//#define FAN_OFF_PWM 1
Expand Down Expand Up @@ -684,16 +689,20 @@
#endif

/**
* Extruder cooling fans
* Cooling fans
*
* Extruder auto fans automatically turn on when their extruders'
* temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE.
* Fans automatically turn on when their extruders'
* temperatures go above threshold.
*
* Your board's pins file specifies the recommended pins. Override those here
* or set to -1 to disable completely.
*
* Multiple extruders can be assigned to the same pin in which case
* the fan will turn on when any selected extruder is above the threshold.
*
* EXAMPLE: When 'EXTRUDER_AUTO_FAN_TEMPERATURE' >= 50
* Fan spins at full speed:
* 'EXTRUDER_AUTO_FAN_SPEED' 255 == full speed
*/
#define E0_AUTO_FAN_PIN -1
#define E1_AUTO_FAN_PIN -1
Expand All @@ -707,12 +716,20 @@
#define COOLER_AUTO_FAN_PIN -1

#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed
#define EXTRUDER_AUTO_FAN_SPEED 255
#define CHAMBER_AUTO_FAN_TEMPERATURE 30
#define CHAMBER_AUTO_FAN_SPEED 255
#define COOLER_AUTO_FAN_TEMPERATURE 18
#define COOLER_AUTO_FAN_SPEED 255

/**
* Allow Auto Cooling Fans to be editable
*/
//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings
#if ENABLED(AUTO_FAN_EDITABLE)
#define AUTO_FAN_MENU // Enable the Editable Auto Fans submenu
#endif

/**
* Hotend Cooling Fans tachometers
*
Expand Down
10 changes: 9 additions & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
#include "feature/fancheck.h"
#endif

#if ENABLED(USE_CONTROLLER_FAN)
#if ANY(USE_CONTROLLER_FAN, FAN_KICKSTART_EDITABLE, AUTO_FAN_EDITABLE)
#include "feature/controllerfan.h"
#endif

Expand Down Expand Up @@ -1328,6 +1328,14 @@ void setup() {
SETUP_RUN(leds2.setup());
#endif

#if ENABLED(FAN_KICKSTART_EDITABLE)
SETUP_RUN(kickstart.setup());
#endif

#if ENABLED(AUTO_FAN_EDITABLE)
SETUP_RUN(autofans.setup());
#endif

#if ENABLED(USE_CONTROLLER_FAN) // Set up fan controller to initialize also the default configurations.
SETUP_RUN(controllerFan.setup());
#endif
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@
#define STR_INPUT_SHAPING "Input Shaping"
#define STR_HOTEND_TIMEOUT "Hotend Idle Timeout"
#define STR_CONTROLLER_FAN "Controller Fan"
#define STR_FAN_KICKSTART "Fan Kickstart"
#define STR_AUTOFANS "Auto Fans"
#define STR_STEPPER_MOTOR_CURRENTS "Stepper motor currents"
#define STR_RETRACT_S_F_Z "Retract (S<length> F<feedrate> Z<lift>)"
#define STR_RECOVER_S_F "Recover (S<length> F<feedrate>)"
Expand Down
43 changes: 37 additions & 6 deletions Marlin/src/feature/controllerfan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,22 @@

#include "../inc/MarlinConfig.h"

#if ANY(USE_CONTROLLER_FAN, FAN_KICKSTART_EDITABLE, AUTO_FAN_EDITABLE)
#include "controllerfan.h"
#endif

#if ENABLED(FAN_KICKSTART_EDITABLE)
Kickstart kickstart;
kickstart_settings_t Kickstart::settings; // {0}
#endif

#if ENABLED(AUTO_FAN_EDITABLE)
Autofans autofans;
autofans_settings_t Autofans::settings; // {0}
#endif

#if ENABLED(USE_CONTROLLER_FAN)

#include "controllerfan.h"
#include "../module/stepper.h"
#include "../module/temperature.h"

Expand All @@ -34,8 +47,8 @@ uint8_t ControllerFan::speed;

#if ENABLED(CONTROLLER_FAN_EDITABLE)
controllerFan_settings_t ControllerFan::settings; // {0}
#else
const controllerFan_settings_t &ControllerFan::settings = controllerFan_defaults;
#else
const controllerFan_settings_t &ControllerFan::settings = controllerFan_defaults;
#endif

#if ENABLED(FAN_SOFT_PWM)
Expand Down Expand Up @@ -114,15 +127,33 @@ void ControllerFan::update() {

speed = CALC_FAN_SPEED(speed);

#if FAN_KICKSTART_TIME
#if ENABLED(FAN_KICKSTART_EDITABLE)
static millis_t fan_kick_end = 0;
if (speed > FAN_OFF_PWM && kickstart.settings.enabled) {
if (!fan_kick_end) {
fan_kick_end = ms + kickstart.settings.duration;
speed = map(kickstart.settings.speed, 0, 255, 0, CONTROLLERFAN_SPEED_MAX);
nextFanCheck = ms + 20UL; // Reduce update interval for controller fn check while Kickstart is active.
}
else if (PENDING(ms, fan_kick_end)) {
speed = map(kickstart.settings.speed, 0, 255, 0, CONTROLLERFAN_SPEED_MAX);
nextFanCheck = ms + 20UL; // Reduce update interval for controller fn check while Kickstart is active.
}
}
else
fan_kick_end = 0;
#elif FAN_KICKSTART_TIME
static millis_t fan_kick_end = 0;
if (speed > FAN_OFF_PWM) {
if (!fan_kick_end) {
fan_kick_end = ms + FAN_KICKSTART_TIME; // May be longer based on slow update interval for controller fn check. Sets minimum
fan_kick_end = ms + FAN_KICKSTART_TIME;
speed = FAN_KICKSTART_POWER;
nextFanCheck = ms + 20UL; // Reduce update interval for controller fn check while Kickstart is active.
}
else if (PENDING(ms, fan_kick_end))
else if (PENDING(ms, fan_kick_end)) {
speed = FAN_KICKSTART_POWER;
nextFanCheck = ms + 20UL; // Reduce update interval for controller fn check while Kickstart is active.
}
}
else
fan_kick_end = 0;
Expand Down
93 changes: 89 additions & 4 deletions Marlin/src/feature/controllerfan.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#include "../inc/MarlinConfigPre.h"

typedef struct {
uint8_t active_speed, // 0-255 (fullspeed); Speed with enabled stepper motors
idle_speed; // 0-255 (fullspeed); Speed after idle period with all motors are disabled
uint16_t duration; // Duration in seconds for the fan to run after all motors are disabled
bool auto_mode; // Default true
uint8_t active_speed, // 0-255 (fullspeed); Speed with enabled stepper motors
idle_speed; // 0-255 (fullspeed); Speed after idle period with all motors are disabled
uint16_t duration; // Duration in seconds for the fan to run after all motors are disabled
bool auto_mode; // Default true
} controllerFan_settings_t;

#ifndef CONTROLLERFAN_SPEED_ACTIVE
Expand Down Expand Up @@ -73,3 +73,88 @@ class ControllerFan {
extern ControllerFan controllerFan;

#endif

/**
* Fan Kickstart settings
*
*/
#if ENABLED(FAN_KICKSTART_EDITABLE)

typedef struct {
uint8_t speed; // 0-255 (fullspeed); Fans first start speed
uint16_t duration; // Duration in milliseconds for the fan to run at kickstart speed
bool enabled;
} kickstart_settings_t;

#ifndef FAN_KICKSTART_TIME
#define FAN_KICKSTART_TIME 100
#endif
#ifndef FAN_KICKSTART_POWER
#define FAN_KICKSTART_POWER 180
#endif

static constexpr kickstart_settings_t kickstart_defaults = {
FAN_KICKSTART_TIME,
FAN_KICKSTART_POWER,
true
};

class Kickstart {
public:
static kickstart_settings_t settings;

static void reset() { settings = kickstart_defaults; }
static void setup() { reset(); }
};

extern Kickstart kickstart;

#endif

/**
* Auto Fans settings
*
*/
#if ENABLED(AUTO_FAN_EDITABLE)

typedef struct {
uint8_t extruder_temp, // Auto fans temperature thresholds
chamber_temp,
cooler_temp;
} autofans_settings_t;

#ifndef EXTRUDER_AUTO_FAN_TEMPERATURE
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#endif
#ifndef CHAMBER_AUTO_FAN_TEMPERATURE
#define CHAMBER_AUTO_FAN_TEMPERATURE 30
#endif
#ifndef COOLER_AUTO_FAN_TEMPERATURE
#define COOLER_AUTO_FAN_TEMPERATURE 18
#endif

static constexpr autofans_settings_t autofans_defaults = {
EXTRUDER_AUTO_FAN_TEMPERATURE,
CHAMBER_AUTO_FAN_TEMPERATURE,
COOLER_AUTO_FAN_TEMPERATURE
};

class Autofans {
public:
static autofans_settings_t settings;

static void reset() { settings = autofans_defaults; }
static void setup() { reset(); }
};

extern Autofans autofans;

#undef EXTRUDER_AUTO_FAN_TEMPERATURE
#define EXTRUDER_AUTO_FAN_TEMPERATURE (autofans.settings.extruder_temp)
#undef CHAMBER_AUTO_FAN_TEMPERATURE
#define CHAMBER_AUTO_FAN_TEMPERATURE (autofans.settings.chamber_temp)
#undef COOLER_AUTO_FAN_TEMPERATURE
#define COOLER_AUTO_FAN_TEMPERATURE (autofans.settings.cooler_temp)

#endif

71 changes: 71 additions & 0 deletions Marlin/src/gcode/feature/controllerfan/M711.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* Fan Kickstart settings
* Author: wlkmanist
* Date: 2024/04/04
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

#include "../../../inc/MarlinConfigPre.h"

#if ENABLED(FAN_KICKSTART_EDITABLE)

#include "../../gcode.h"
#include "../../../feature/controllerfan.h"

/**
* M711: Set Fan Kickstart settings
*
* R : Reset to defaults
* S[0-255] : Fan speed when fans first start
* D : Set Kickstart duration (ms)
* E[0|1] : Turn Kickstart feature on or off
*
* Examples:
* M711 ; Report current Settings
* M711 R ; Reset SDE to defaults
* M711 S255 ; Set Kickstart fan speed to 100%
* M711 E0 ; Set Kickstart to OFF
* M711 E1 S180 D100 ; Set Kickstart to ON, Kickstart fan speed 70%, duration to 100 milliseconds
*/
void GcodeSuite::M711() {

const bool seenR = parser.seen('R');
const bool seenS = parser.seenval('S');
const bool seenD = parser.seenval('D');
const bool seenE = parser.seenval('E');

if (seenR) kickstart.reset();
else if (seenS) kickstart.settings.speed = parser.value_byte();
else if (seenD) kickstart.settings.duration = parser.value_ushort();
else if (seenE) kickstart.settings.enabled = parser.value_bool();

if (!(seenR || seenS || seenD || seenE))
M711_report();
}

void GcodeSuite::M711_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);

report_heading_etc(forReplay, F(STR_FAN_KICKSTART));
SERIAL_ECHOLNPGM(" M711"
" S", int(kickstart.settings.speed),
" D", int(kickstart.settings.duration),
" E", int(kickstart.settings.enabled),
" ; (", (int(kickstart.settings.speed) * 100) / 255, "%)"
);
}

#endif // FAN_KICKSTART_EDITABLE
Loading