Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@
#define E5_AUTO_FAN_PIN -1
#define E6_AUTO_FAN_PIN -1
#define E7_AUTO_FAN_PIN -1

//#define EDITABLE_AUTO_FAN_SPEED // Add G-code and menu items to modify Extruder Auto Fan Speeds

#define CHAMBER_AUTO_FAN_PIN -1
#define COOLER_AUTO_FAN_PIN -1

Expand Down
1 change: 1 addition & 0 deletions Marlin/src/inc/Conditionals-5-post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2853,6 +2853,7 @@
#undef COOLER_AUTO_FAN_TEMPERATURE
#endif
#if !HAS_E_AUTO_FAN
#undef EDITABLE_AUTO_FAN_SPEED
#undef EXTRUDER_AUTO_FAN_SPEED
#undef EXTRUDER_AUTO_FAN_TEMPERATURE
#endif
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ namespace LanguageNarrow_en {
LSTR MSG_STORED_FAN_N = _UxGT("Stored Fan ~");
LSTR MSG_EXTRA_FAN_SPEED = _UxGT("Extra Fan Speed");
LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("Extra Fan Speed ~");
LSTR MSG_FANS = _UxGT("Fans");
LSTR MSG_EXTRUDER_AUTO_FAN_SPEED = _UxGT("Extruder fan speed");
LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune");
LSTR MSG_PID_AUTOTUNE_E = _UxGT("Autotune * PID");
LSTR MSG_JERK = _UxGT("Jerk");
Expand Down
25 changes: 15 additions & 10 deletions Marlin/src/lcd/menu/menu_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,19 +350,24 @@ void menu_advanced_settings();

#endif

#if ENABLED(CONTROLLER_FAN_MENU)
#if ANY(CONTROLLER_FAN_MENU, EDITABLE_AUTO_FAN_SPEED)

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

void menu_controller_fan() {
void menu_fans() {
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_IDLE_SPEED, &controllerFan.settings.idle_speed, CONTROLLERFAN_SPEED_MIN, 255);
EDIT_ITEM(bool, MSG_CONTROLLER_FAN_AUTO_ON, &controllerFan.settings.auto_mode);
if (controllerFan.settings.auto_mode) {
EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_SPEED, &controllerFan.settings.active_speed, CONTROLLERFAN_SPEED_MIN, 255);
EDIT_ITEM(uint16_4, MSG_CONTROLLER_FAN_DURATION, &controllerFan.settings.duration, 0, 4800);
}
#if ENABLED(CONTROLLER_FAN_MENU)
EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_IDLE_SPEED, &controllerFan.settings.idle_speed, CONTROLLERFAN_SPEED_MIN, 255);
EDIT_ITEM(bool, MSG_CONTROLLER_FAN_AUTO_ON, &controllerFan.settings.auto_mode);
if (controllerFan.settings.auto_mode) {
EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_SPEED, &controllerFan.settings.active_speed, CONTROLLERFAN_SPEED_MIN, 255);
EDIT_ITEM(uint16_4, MSG_CONTROLLER_FAN_DURATION, &controllerFan.settings.duration, 0, 4800);
}
#endif
#if ENABLED(EDITABLE_AUTO_FAN_SPEED)
EDIT_ITEM_FAST(percent, MSG_EXTRUDER_AUTO_FAN_SPEED, &thermalManager.extruder_fan_speed, 0, 255);
#endif
END_MENU();
}

Expand Down Expand Up @@ -595,8 +600,8 @@ void menu_configuration() {
//
// Set Fan Controller speed
//
#if ENABLED(CONTROLLER_FAN_MENU)
SUBMENU(MSG_CONTROLLER_FAN, menu_controller_fan);
#if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_SPEED_MENU)
SUBMENU(MSG_FANS, menu_fans);
#endif

if (!busy) {
Expand Down
36 changes: 35 additions & 1 deletion Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/

// Change EEPROM version if the structure changes
#define EEPROM_VERSION "V90"
#define EEPROM_VERSION "V91"
#define EEPROM_OFFSET 100

// Check the integrity of data offsets.
Expand Down Expand Up @@ -452,6 +452,13 @@ typedef struct SettingsDataStruct {
//
controllerFan_settings_t controllerFan_settings; // M710

//
// Extruder fan settings
//
#if ENABLED(EDITABLE_AUTO_FAN_SPEED)
uint8_t extruder_fan_speed;
#endif

//
// POWER_LOSS_RECOVERY
//
Expand Down Expand Up @@ -1356,6 +1363,16 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(cfs);
}

//
// Extruder fan
//
#if ENABLED(EDITABLE_AUTO_FAN_SPEED)
{
_FIELD_TEST(extruder_fan_speed);
EEPROM_WRITE(thermalManager.extruder_fan_speed);
}
#endif

//
// Power-Loss Recovery
//
Expand Down Expand Up @@ -2445,6 +2462,18 @@ void MarlinSettings::postprocess() {
TERN_(CONTROLLER_FAN_EDITABLE, if (!validating) controllerFan.settings = cfs);
}

//
// Extruder Fan
//
#if ENABLED(EDITABLE_AUTO_FAN_SPEED)
{
_FIELD_TEST(extruder_fan_speed);
uint8_t efs;
EEPROM_READ(efs);
if (!validating) thermalManager.extruder_fan_speed = efs;
}
#endif

//
// Power-Loss Recovery
//
Expand Down Expand Up @@ -3584,6 +3613,11 @@ void MarlinSettings::reset() {
//
TERN_(USE_CONTROLLER_FAN, controllerFan.reset());

//
// Extruder Fan
//
TERN_(EDITABLE_AUTO_FAN_SPEED, thermalManager.extruder_fan_speed = EXTRUDER_AUTO_FAN_SPEED);

//
// Power-Loss Recovery
//
Expand Down
14 changes: 10 additions & 4 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
uint8_t Temperature::autofan_speed[HOTENDS] = ARRAY_N_1(HOTENDS, FAN_OFF_PWM);
#endif

#if ENABLED(EDITABLE_AUTO_FAN_SPEED)
uint8_t Temperature::extruder_fan_speed; // Initialized by settings.load
#elif HAS_E_AUTO_FAN
constexpr uint8_t Temperature::extruder_fan_speed;
#endif

#if ENABLED(AUTO_POWER_CHAMBER_FAN)
uint8_t Temperature::chamberfan_speed = FAN_OFF_PWM;
#endif
Expand Down Expand Up @@ -1492,7 +1498,7 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
#endif

#define _UPDATE_AUTO_FAN(P,D,A) do{ \
if (PWM_PIN(P##_AUTO_FAN_PIN) && A < 255) \
if (PWM_PIN(P##_AUTO_FAN_PIN)) \
hal.set_pwm_duty(pin_t(P##_AUTO_FAN_PIN), D ? A : 0); \
else \
WRITE(P##_AUTO_FAN_PIN, D); \
Expand All @@ -1516,15 +1522,15 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
#endif
default:
#if ANY(AUTO_POWER_E_FANS, HAS_FANCHECK)
autofan_speed[realFan] = fan_on ? EXTRUDER_AUTO_FAN_SPEED : 0;
autofan_speed[realFan] = fan_on ? extruder_fan_speed : 0;
#endif
break;
}

#if ALL(HAS_FANCHECK, HAS_PWMFANCHECK)
#define _AUTOFAN_SPEED() fan_check.is_measuring() ? 255 : EXTRUDER_AUTO_FAN_SPEED
#define _AUTOFAN_SPEED() fan_check.is_measuring() ? 255 : extruder_fan_speed
#else
#define _AUTOFAN_SPEED() EXTRUDER_AUTO_FAN_SPEED
#define _AUTOFAN_SPEED() extruder_fan_speed
#endif
#define _AUTOFAN_CASE(N) case N: _UPDATE_AUTO_FAN(E##N, fan_on, _AUTOFAN_SPEED()); break;
#define _AUTOFAN_NOT(N)
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,13 @@ class Temperature {
#if ANY(AUTO_POWER_E_FANS, HAS_FANCHECK)
static uint8_t autofan_speed[HOTENDS];
#endif

#if ENABLED(EDITABLE_AUTO_FAN_SPEED)
static uint8_t extruder_fan_speed;
#elif HAS_E_AUTO_FAN
static constexpr uint8_t extruder_fan_speed = EXTRUDER_AUTO_FAN_SPEED;
#endif

#if ENABLED(AUTO_POWER_CHAMBER_FAN)
static uint8_t chamberfan_speed;
#endif
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/DUE
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ opt_enable S_CURVE_ACCELERATION FREEZE_FEATURE SOFT_FEED_HOLD EEPROM_SETTINGS GC
PSU_CONTROL AUTO_POWER_CONTROL E_DUAL_STEPPER_DRIVERS \
PIDTEMPBED SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER \
PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL MAX7219_REINIT_ON_POWERUP \
EXTENSIBLE_UI
EXTENSIBLE_UI EDITABLE_AUTO_FAN_SPEED
opt_add EXTUI_EXAMPLE
exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options." "$3"

Expand Down