From 35e14b459bbae2b4a7969ac577ed8be8391fbe3e Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Wed, 3 Apr 2024 21:54:55 +0300 Subject: [PATCH 01/36] Add Controller fan settings (DWIN display) Signed-off-by: wlkmanist Conflicts: Marlin/src/lcd/e3v2/proui/dwin.cpp --- Marlin/src/inc/Conditionals_post.h | 55 +++++++++++++++++++ Marlin/src/lcd/e3v2/proui/dwin.cpp | 86 ++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 349848c484..9965c11dbe 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2730,6 +2730,61 @@ #define HAS_FANMUX 1 // Part Cooling fan multipliexer #endif +/** + * Up to 8 Extruder cooling fans + */ +#define _HAS_FAN_E_AUTO(N) (PIN_EXISTS(E##N##_AUTO_FAN)) + +#if _HAS_FAN_E_AUTO(0) + #define HAS_FAN_E0_AUTO 1 +#endif +#if _HAS_FAN_E_AUTO(1) + #define HAS_FAN_E1_AUTO 1 +#endif +#if _HAS_FAN_E_AUTO(2) + #define HAS_FAN_E2_AUTO 1 +#endif +#if _HAS_FAN_E_AUTO(3) + #define HAS_FAN_E3_AUTO 1 +#endif +#if _HAS_FAN_E_AUTO(4) + #define HAS_FAN_E4_AUTO 1 +#endif +#if _HAS_FAN_E_AUTO(5) + #define HAS_FAN_E5_AUTO 1 +#endif +#if _HAS_FAN_E_AUTO(6) + #define HAS_FAN_E6_AUTO 1 +#endif +#if _HAS_FAN_E_AUTO(7) + #define HAS_FAN_E7_AUTO 1 +#endif +#undef _HAS_FAN_E_AUTO + +#if HAS_FAN7 + #define EXTRUDER_AUTO_FAN_COUNT 8 +#elif HAS_FAN6 + #define EXTRUDER_AUTO_FAN_COUNT 7 +#elif HAS_FAN5 + #define EXTRUDER_AUTO_FAN_COUNT 6 +#elif HAS_FAN4 + #define EXTRUDER_AUTO_FAN_COUNT 5 +#elif HAS_FAN3 + #define EXTRUDER_AUTO_FAN_COUNT 4 +#elif HAS_FAN2 + #define EXTRUDER_AUTO_FAN_COUNT 3 +#elif HAS_FAN1 + #define EXTRUDER_AUTO_FAN_COUNT 2 +#elif HAS_FAN0 + #define EXTRUDER_AUTO_FAN_COUNT 1 +#else + #define EXTRUDER_AUTO_FAN_COUNT 0 +#endif + +#if EXTRUDER_AUTO_FAN_COUNT > 0 + #define HAS_EXTRUDER_AUTO_FAN 1 +#endif + /** * MIN/MAX fan PWM scaling */ diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 260d61015b..4976a09052 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -90,6 +90,10 @@ #include "../../../feature/tmc_util.h" #endif +#if ENABLED(CONTROLLER_FAN_MENU) + #include "../../feature/controllerfan.h" +#endif + #if ANY(HAS_GCODE_PREVIEW, CV_LASER_MODULE) #include "gcode_preview.h" #endif @@ -141,6 +145,10 @@ #define MAX_TMC_CURRENT 3000 #endif +#if ENABLED(CONTROLLER_FAN_MENU) + #define MAX_CONTROLLER_FAN_IDLE_TIME 4800 +#endif + // Editable temperature limits #define MIN_ETEMP 0 #define MAX_ETEMP thermalManager.hotend_max_target(EXT) @@ -299,6 +307,12 @@ MenuClass *PIDMenu = nullptr; #if HAS_TRINAMIC_CONFIG MenuClass *TrinamicConfigMenu = nullptr; #endif +#if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU) + MenuClass *AdvancedFanMenu = nullptr; +#endif +#if ENABLED(CONTROLLER_FAN_MENU) + MenuClass *ControllerFanMenu = nullptr; +#endif #if ENABLED(CV_LASER_MODULE) MenuClass *LaserSettings = nullptr; MenuClass *LaserPrintMenu = nullptr; @@ -2743,6 +2757,24 @@ void ApplyMove() { void SetFanSpeed() { SetIntOnClick(0, 255, thermalManager.fan_speed[EXT], ApplyFanSpeed); } #endif +#if HAS_CONTROLLER_FAN + //uint8_t ConvertControllerFanSpeed(uint8_t val) { + // return map(val, 0, 255, (CONTROLLERFAN_SPEED_MIN > 0 ? CONTROLLERFAN_SPEED_MIN : 1) - 1, 255); + //} + + void SetControllerFanIdleSpeed() { SetIntOnClick((CONTROLLERFAN_SPEED_MIN > 0 ? CONTROLLERFAN_SPEED_MIN : 1) - 1, 255, + controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } + void SetControllerFanSpeed() { SetIntOnClick((CONTROLLERFAN_SPEED_MIN > 0 ? CONTROLLERFAN_SPEED_MIN : 1) - 1, 255, + controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } + void SetControllerFanDuration() { SetIntOnClick(1, 4800, + controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } + void SetControllerFanAutoOn() { Toggle_Chkb_Line(controllerFan.settings.auto_mode); } /// ReDrawMenu(true); +#endif + +//#if HAS_EXTRUDER_AUTO_FAN +// +//#endif + #if ENABLED(SHOW_SPEED_IND) void SetSpdInd() { Toggle_Chkb_Line(HMI_data.SpdInd); } #endif @@ -3682,6 +3714,57 @@ void Draw_Tune_Menu() { #endif +#if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU) + namespace GET_LANG(LCD_LANGUAGE) { + LSTR MSG_MISC_FANS = _UxGT("Misc Fans"); /// TODO: proper locale + LSTR MSG_CONTROLLER_FAN = _UxGT("Controller Fan"); + LSTR MSG_KICKSTART_TIME = _UxGT("Kickstart Time"); + LSTR MSG_KICKSTART_POWER = _UxGT("Kickstart Power"); + } + + /// TODO: add kickstart options, add extruder fan options + + void Draw_AdvancedFan_menu(); + + void Draw_ControllerFan_menu() { + checkkey = Menu; + if (SET_MENU(ControllerFanMenu, MSG_CONTROLLER_FAN, 5)) { + BACK_ITEM(Draw_AdvancedFan_menu); + + #if ENABLED(CONTROLLER_FAN_MENU) + EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_IDLE_SPEED, onDrawPInt8Menu, SetControllerFanIdleSpeed, &controllerFan.settings.idle_speed); + EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_AUTO_ON, onDrawChkbMenu, SetControllerFanAutoOn, &controllerFan.settings.auto_mode); + if (controllerFan.settings.auto_mode) { + EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_SPEED, onDrawPInt8Menu, SetControllerFanSpeed, &controllerFan.settings.active_speed); + EDIT_ITEM(ICON_RemainTime, MSG_CONTROLLER_FAN_DURATION, onDrawPIntMenu, SetControllerFanDuration, &controllerFan.settings.duration); + } + #endif + } + UpdateMenu(ControllerFanMenu); + } + + void Draw_AdvancedFan_menu() { + checkkey = Menu; + if (SET_MENU(AdvancedFanMenu, MSG_MISC_FANS, 2)) { + BACK_ITEM(Draw_Advanced_Menu); + + #if ENABLED(CONTROLLER_FAN_MENU) + MENU_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN, onDrawSubMenu, Draw_ControllerFan_menu); + #endif + + //#if (ENABLED(EXTRUDER_AUTO_FAN_MENU) && (HAS_EXTRUDER_AUTO_FAN)) + ///// TODO: E_AUTO fans code here (check Marlin/src/module/temperature.cpp, line 1377, then Temperature::update_autofans()) + //#endif + + //#if ((FAN_KICKSTART_TIME > 0) && DISABLED(LASER_SYNCHRONOUS_M106_M107)) + ///// TODO: kickstart code here + //#endif + } + UpdateMenu(AdvancedFanMenu); + } + +#endif + void Draw_Motion_Menu() { checkkey = Menu; if (SET_MENU(MotionMenu, MSG_MOTION, 8)) { @@ -4727,6 +4810,9 @@ void Draw_AdvancedSettings_Menu() { #if HAS_TRINAMIC_CONFIG MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, Draw_TrinamicConfig_menu); #endif + #if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU) + MENU_ITEM(ICON_FanSpeed, MSG_MISC_FANS, onDrawSubMenu, Draw_AdvancedFan_menu); + #endif #if ENABLED(PRINTCOUNTER) MENU_ITEM(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, printStatsReset); #endif From 0cc7140165e6e664184690b0535671b769101a2c Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Thu, 4 Apr 2024 06:44:41 +0300 Subject: [PATCH 02/36] Add editable Kickstart with DWIN support, fix&improve Controller fan settings - Added FAN_KICKSTART_EDITABLE (Enable M711 configurable settings (320 bytes of flash)) - Added FAN_KICKSTART_MENU (Enable the Fan Kickstart submenu (384 bytes of flash)) - Improved Controller fan scaling - Dynamic menu update at auto or enable parameter changed - Kickstart saves parameters to EEPROM - 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 Signed-off-by: wlkmanist Conflicts: Marlin/src/lcd/e3v2/proui/dwin.cpp --- Marlin/src/MarlinCore.cpp | 8 +++ Marlin/src/core/language.h | 1 + Marlin/src/feature/controllerfan.cpp | 27 +++++--- Marlin/src/feature/controllerfan.h | 1 - Marlin/src/feature/kickstart.cpp | 30 ++++++++ Marlin/src/feature/kickstart.h | 49 +++++++++++++ Marlin/src/gcode/feature/kickstart/M711.cpp | 73 ++++++++++++++++++++ Marlin/src/gcode/gcode.cpp | 4 ++ Marlin/src/gcode/gcode.h | 5 ++ Marlin/src/inc/Conditionals_post.h | 7 ++ Marlin/src/lcd/e3v2/proui/dwin.cpp | 76 ++++++++++++++------- Marlin/src/lcd/e3v2/proui/menus.cpp | 5 ++ Marlin/src/lcd/e3v2/proui/menus.h | 3 + Marlin/src/module/planner.cpp | 18 +++++ Marlin/src/module/settings.cpp | 35 ++++++++++ ini/features.ini | 1 + 16 files changed, 309 insertions(+), 34 deletions(-) create mode 100644 Marlin/src/feature/kickstart.cpp create mode 100644 Marlin/src/feature/kickstart.h create mode 100644 Marlin/src/gcode/feature/kickstart/M711.cpp diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 6c35562921..5bca8e6671 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -223,6 +223,10 @@ #include "feature/fancheck.h" #endif +#if ENABLED(FAN_KICKSTART_EDITABLE) + #include "feature/kickstart.h" +#endif + #if ENABLED(USE_CONTROLLER_FAN) #include "feature/controllerfan.h" #endif @@ -1307,6 +1311,10 @@ void setup() { SETUP_RUN(leds2.setup()); #endif + #if ENABLED(FAN_KICKSTART_EDITABLE) + SETUP_RUN(kickstart.setup()); + #endif + #if ENABLED(USE_CONTROLLER_FAN) // Set up fan controller to initialize also the default configurations. SETUP_RUN(controllerFan.setup()); #endif diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 0cf543a769..e410ffbd2c 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -300,6 +300,7 @@ #define STR_LINEAR_ADVANCE "Linear Advance" #define STR_NONLINEAR_EXTRUSION "Nonlinear Extrusion" #define STR_CONTROLLER_FAN "Controller Fan" +#define STR_FAN_KICKSTART "Fan Kickstart" #define STR_STEPPER_MOTOR_CURRENTS "Stepper motor currents" #define STR_RETRACT_S_F_Z "Retract (S F Z)" #define STR_RECOVER_S_F "Recover (S F)" diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index acbae459e7..d0fbaa391d 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -28,6 +28,10 @@ #include "../module/stepper.h" #include "../module/temperature.h" +#if ENABLED(FAN_KICKSTART_EDITABLE) + #include "kickstart.h" +#endif + ControllerFan controllerFan; uint8_t ControllerFan::speed; @@ -50,10 +54,6 @@ void ControllerFan::setup() { init(); } -void ControllerFan::set_fan_speed(const uint8_t s) { - speed = s < (CONTROLLERFAN_SPEED_MIN) ? 0 : s; // Fan OFF below minimum -} - void ControllerFan::update() { static millis_t lastComponentOn = 0, // Last time a stepper, heater, etc. was turned on nextFanCheck = 0; // Last time the state was checked @@ -84,15 +84,21 @@ void ControllerFan::update() { * - If AutoMode is on and hot components have been powered for CONTROLLERFAN_IDLE_TIME seconds. * - If System is on idle and idle fan speed settings is activated. */ - set_fan_speed( - settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) - ? settings.active_speed : settings.idle_speed - ); - - speed = CALC_FAN_SPEED(speed); + speed = CALC_CONTROLLER_FAN_SPEED(settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) + ? settings.active_speed : settings.idle_speed); #if FAN_KICKSTART_TIME static millis_t fan_kick_end = 0; + #if ENABLED(FAN_KICKSTART_EDITABLE) + if (speed > FAN_OFF_PWM && kickstart.settings.enabled) { + if (!fan_kick_end) { + fan_kick_end = ms + kickstart.settings.duration_ms; // May be longer based on slow update interval for controller fn check. Sets minimum + speed = kickstart.settings.speed; + } + else if (PENDING(ms, fan_kick_end)) + speed = kickstart.settings.speed; + } + #else 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 @@ -101,6 +107,7 @@ void ControllerFan::update() { else if (PENDING(ms, fan_kick_end)) speed = FAN_KICKSTART_POWER; } + #endif else fan_kick_end = 0; #endif diff --git a/Marlin/src/feature/controllerfan.h b/Marlin/src/feature/controllerfan.h index 68502afa66..431990a977 100644 --- a/Marlin/src/feature/controllerfan.h +++ b/Marlin/src/feature/controllerfan.h @@ -52,7 +52,6 @@ static constexpr controllerFan_settings_t controllerFan_defaults = { class ControllerFan { private: static uint8_t speed; - static void set_fan_speed(const uint8_t s); public: #if ENABLED(CONTROLLER_FAN_EDITABLE) diff --git a/Marlin/src/feature/kickstart.cpp b/Marlin/src/feature/kickstart.cpp new file mode 100644 index 0000000000..d5f69d1321 --- /dev/null +++ b/Marlin/src/feature/kickstart.cpp @@ -0,0 +1,30 @@ +/** + * Fan Kickstart settings + * Author: wlkmanist + * Date: 2024/04/03 + * + * 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 . + * + */ + +#include "../inc/MarlinConfig.h" + +#if ENABLED(FAN_KICKSTART_EDITABLE) + +#include "kickstart.h" + +Kickstart kickstart; +kickstart_settings_t Kickstart::settings; // {0} + +#endif diff --git a/Marlin/src/feature/kickstart.h b/Marlin/src/feature/kickstart.h new file mode 100644 index 0000000000..e91e93c411 --- /dev/null +++ b/Marlin/src/feature/kickstart.h @@ -0,0 +1,49 @@ +/** + * Fan Kickstart settings + * Author: wlkmanist + * Date: 2024/04/03 + * + * 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 . + * + */ + +#pragma once + +#include "../inc/MarlinConfigPre.h" + +typedef struct { + uint16_t duration_ms; // Duration in milliseconds for the fan to run at kickstart speed + uint8_t speed; // 0-255 (fullspeed); Fans first start speed + bool enabled; +} kickstart_settings_t; + +static constexpr kickstart_settings_t kickstart_defaults = { + FAN_KICKSTART_TIME, + FAN_KICKSTART_POWER, + true +}; + +#if ENABLED(FAN_KICKSTART_EDITABLE) + +class Kickstart { + public: + static kickstart_settings_t settings; + + static void reset() { TERN_(FAN_KICKSTART_EDITABLE, settings = kickstart_defaults); } + static void setup() { reset(); } +}; + +extern Kickstart kickstart; + +#endif diff --git a/Marlin/src/gcode/feature/kickstart/M711.cpp b/Marlin/src/gcode/feature/kickstart/M711.cpp new file mode 100644 index 0000000000..fde4983769 --- /dev/null +++ b/Marlin/src/gcode/feature/kickstart/M711.cpp @@ -0,0 +1,73 @@ +/** + * 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 . + * + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(FAN_KICKSTART_EDITABLE) + +#include "../../gcode.h" +#include "../../../feature/kickstart.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'); + if (seenR) kickstart.reset(); + + const bool seenS = parser.seenval('S'); + if (seenS) kickstart.settings.speed = parser.value_byte(); + + const bool seenD = parser.seenval('D'); + if (seenD) kickstart.settings.duration_ms = parser.value_ushort(); + + const bool seenE = parser.seenval('E'); + 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_ms), + " E", int(kickstart.settings.enabled), + " ; (", (int(kickstart.settings.speed) * 100) / 255, "%)" + ); +} + +#endif // FAN_KICKSTART_EDITABLE diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index c37cf0fb28..391a2c8a9a 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -1006,6 +1006,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 710: M710(); break; // M710: Set Controller Fan settings #endif + #if ENABLED(FAN_KICKSTART_EDITABLE) + case 711: M711(); break; // M711: Set Fan Kickstart settings + #endif + #if ENABLED(GCODE_MACROS) case 810: case 811: case 812: case 813: case 814: case 815: case 816: case 817: case 818: case 819: diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 74d2895db8..d58c07ee77 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -1297,6 +1297,11 @@ class GcodeSuite { static void M710_report(const bool forReplay=true); #endif + #if ENABLED(FAN_KICKSTART_EDITABLE) + static void M711(); + static void M711_report(const bool forReplay=true); + #endif + static void T(const int8_t tool_index) IF_DISABLED(HAS_TOOLCHANGE, { UNUSED(tool_index); }); }; diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 9965c11dbe..388d1748aa 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2807,6 +2807,13 @@ #else #define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM) #endif + #if ENABLED(USE_CONTROLLER_FAN) + #if CONTROLLERFAN_SPEED_MIN == 0 && FAN_MAX_PWM == 255 + #define CALC_CONTROLLER_FAN_SPEED(f) (f ?: FAN_OFF_PWM) + #else + #define CALC_CONTROLLER_FAN_SPEED(f) (f ? map(f, 1, 255, CONTROLLERFAN_SPEED_MIN, FAN_MAX_PWM) : FAN_OFF_PWM) + #endif + #endif #endif // Fan Kickstart diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 4976a09052..138dea1090 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -94,6 +94,10 @@ #include "../../feature/controllerfan.h" #endif +#if ENABLED(FAN_KICKSTART_MENU) + #include "../../feature/kickstart.h" +#endif + #if ANY(HAS_GCODE_PREVIEW, CV_LASER_MODULE) #include "gcode_preview.h" #endif @@ -307,12 +311,15 @@ MenuClass *PIDMenu = nullptr; #if HAS_TRINAMIC_CONFIG MenuClass *TrinamicConfigMenu = nullptr; #endif -#if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU) +#if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU, FAN_KICKSTART_MENU) MenuClass *AdvancedFanMenu = nullptr; #endif #if ENABLED(CONTROLLER_FAN_MENU) MenuClass *ControllerFanMenu = nullptr; #endif +#if ENABLED(FAN_KICKSTART_MENU) + MenuClass *KickstartMenu = nullptr; +#endif #if ENABLED(CV_LASER_MODULE) MenuClass *LaserSettings = nullptr; MenuClass *LaserPrintMenu = nullptr; @@ -2757,18 +2764,23 @@ void ApplyMove() { void SetFanSpeed() { SetIntOnClick(0, 255, thermalManager.fan_speed[EXT], ApplyFanSpeed); } #endif -#if HAS_CONTROLLER_FAN - //uint8_t ConvertControllerFanSpeed(uint8_t val) { - // return map(val, 0, 255, (CONTROLLERFAN_SPEED_MIN > 0 ? CONTROLLERFAN_SPEED_MIN : 1) - 1, 255); - //} +#if ENABLED(CONTROLLER_FAN_MENU) + void Draw_ControllerFan_menu(); + + void SetControllerFanIdleSpeed() { SetIntOnClick(0, 255, controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } + void SetControllerFanSpeed() { SetIntOnClick(0, 255, controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } + void SetControllerFanDuration() { SetIntOnClick(1, 4800, controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } + void SetControllerFanAutoOn() { controllerFan.settings.auto_mode ^= true; PrepareRefreshMenu(); Draw_ControllerFan_menu(); } +#endif + +#if ENABLED(FAN_KICKSTART_MENU) + void Draw_Kickstart_menu(); - void SetControllerFanIdleSpeed() { SetIntOnClick((CONTROLLERFAN_SPEED_MIN > 0 ? CONTROLLERFAN_SPEED_MIN : 1) - 1, 255, - controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } - void SetControllerFanSpeed() { SetIntOnClick((CONTROLLERFAN_SPEED_MIN > 0 ? CONTROLLERFAN_SPEED_MIN : 1) - 1, 255, - controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } - void SetControllerFanDuration() { SetIntOnClick(1, 4800, - controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } - void SetControllerFanAutoOn() { Toggle_Chkb_Line(controllerFan.settings.auto_mode); } /// ReDrawMenu(true); + void SetKickstartEnabled() { kickstart.settings.enabled ^= true; PrepareRefreshMenu(); Draw_Kickstart_menu(); } + void SetKickstartSpeed() { SetIntOnClick((FAN_MIN_PWM > 96 ? FAN_MIN_PWM : 96), FAN_MAX_PWM, + kickstart.settings.speed, []{ kickstart.settings.speed = MenuData.Value; }); } + void SetKickstartDuration() { SetIntOnClick(10, 1500, + kickstart.settings.duration_ms, []{ kickstart.settings.duration_ms = MenuData.Value; }); } #endif //#if HAS_EXTRUDER_AUTO_FAN @@ -3718,34 +3730,52 @@ void Draw_Tune_Menu() { namespace GET_LANG(LCD_LANGUAGE) { LSTR MSG_MISC_FANS = _UxGT("Misc Fans"); /// TODO: proper locale LSTR MSG_CONTROLLER_FAN = _UxGT("Controller Fan"); - LSTR MSG_KICKSTART_TIME = _UxGT("Kickstart Time"); - LSTR MSG_KICKSTART_POWER = _UxGT("Kickstart Power"); + LSTR MSG_FAN_KICKSTART = _UxGT("Fan Kickstart"); + LSTR MSG_FAN_KICKSTART_ENABLE = _UxGT("Enable Kickstart"); + LSTR MSG_FAN_KICKSTART_DURATION = _UxGT("Kickstart Time"); + LSTR MSG_FAN_KICKSTART_POWER = _UxGT("Kickstart Power"); } - /// TODO: add kickstart options, add extruder fan options + /// TODO: add extruder fan options void Draw_AdvancedFan_menu(); + #if ENABLED(CONTROLLER_FAN_MENU) void Draw_ControllerFan_menu() { checkkey = Menu; if (SET_MENU(ControllerFanMenu, MSG_CONTROLLER_FAN, 5)) { BACK_ITEM(Draw_AdvancedFan_menu); - #if ENABLED(CONTROLLER_FAN_MENU) - EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_IDLE_SPEED, onDrawPInt8Menu, SetControllerFanIdleSpeed, &controllerFan.settings.idle_speed); EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_AUTO_ON, onDrawChkbMenu, SetControllerFanAutoOn, &controllerFan.settings.auto_mode); + EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_IDLE_SPEED, onDrawPInt8Menu, SetControllerFanIdleSpeed, &controllerFan.settings.idle_speed); if (controllerFan.settings.auto_mode) { EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_SPEED, onDrawPInt8Menu, SetControllerFanSpeed, &controllerFan.settings.active_speed); EDIT_ITEM(ICON_RemainTime, MSG_CONTROLLER_FAN_DURATION, onDrawPIntMenu, SetControllerFanDuration, &controllerFan.settings.duration); } - #endif } UpdateMenu(ControllerFanMenu); } + #endif + + #if ENABLED(FAN_KICKSTART_MENU) + void Draw_Kickstart_menu() { + checkkey = Menu; + if (SET_MENU(KickstartMenu, MSG_FAN_KICKSTART, 4)) { + BACK_ITEM(Draw_AdvancedFan_menu); + + EDIT_ITEM(ICON_Motion, MSG_FAN_KICKSTART_ENABLE, onDrawChkbMenu, SetKickstartEnabled, &kickstart.settings.enabled); + if (kickstart.settings.enabled) { + EDIT_ITEM(ICON_FanSpeed, MSG_FAN_KICKSTART_POWER, onDrawPInt8Menu, SetKickstartSpeed, &kickstart.settings.speed); + EDIT_ITEM(ICON_RemainTime, MSG_FAN_KICKSTART_DURATION, onDrawPIntMenu, SetKickstartDuration, &kickstart.settings.duration_ms); + } + } + UpdateMenu(KickstartMenu); + } + #endif void Draw_AdvancedFan_menu() { checkkey = Menu; - if (SET_MENU(AdvancedFanMenu, MSG_MISC_FANS, 2)) { + if (SET_MENU(AdvancedFanMenu, MSG_MISC_FANS, 3)) { BACK_ITEM(Draw_Advanced_Menu); #if ENABLED(CONTROLLER_FAN_MENU) @@ -3756,9 +3786,9 @@ void Draw_Tune_Menu() { ///// TODO: E_AUTO fans code here (check Marlin/src/module/temperature.cpp, line 1377, then Temperature::update_autofans()) //#endif - //#if ((FAN_KICKSTART_TIME > 0) && DISABLED(LASER_SYNCHRONOUS_M106_M107)) - ///// TODO: kickstart code here - //#endif + #if ENABLED(FAN_KICKSTART_MENU) + MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); + #endif } UpdateMenu(AdvancedFanMenu); } @@ -4810,7 +4840,7 @@ void Draw_AdvancedSettings_Menu() { #if HAS_TRINAMIC_CONFIG MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, Draw_TrinamicConfig_menu); #endif - #if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU) + #if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU, FAN_KICKSTART_MENU) MENU_ITEM(ICON_FanSpeed, MSG_MISC_FANS, onDrawSubMenu, Draw_AdvancedFan_menu); #endif #if ENABLED(PRINTCOUNTER) diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 6f03264ae2..aa9dede6bc 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -490,6 +490,11 @@ void InvalidateMenu() { CurrentMenu = nullptr; } +void PrepareRefreshMenu() { + if (CurrentMenu) CurrentMenu->topline = 0; + CurrentMenu = nullptr; +} + void UpdateMenu(MenuClass* &menu) { if (!menu) return; if (CurrentMenu != menu) { diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h index ebac5831b8..2a4b1df7fc 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.h +++ b/Marlin/src/lcd/e3v2/proui/menus.h @@ -171,6 +171,9 @@ void ResetMenu(MenuClass* &menu); // Invalidate CurrentMenu to prepare for full menu drawing void InvalidateMenu(); +// Invalidate CurrentMenu without resetting current position +void PrepareRefreshMenu(); + // Update the Menu and Draw if it is valid void UpdateMenu(MenuClass* &menu); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b99863d1f6..97f42e9add 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -113,6 +113,10 @@ #include "../feature/spindle_laser.h" #endif +#if ENABLED(FAN_KICKSTART_EDITABLE) + #include "../feature/kickstart.h" +#endif + // Delay for delivery of first block to the stepper ISR, if the queue contains 2 or // fewer movements. The delay is measured in milliseconds, and must be less than 250ms #define BLOCK_DELAY_NONE 0U @@ -1312,6 +1316,19 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { #if FAN_KICKSTART_TIME void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) { + #if ENABLED(FAN_KICKSTART_EDITABLE) + if (!kickstart.settings.enabled) return; + + static millis_t fan_kick_end[FAN_COUNT] = { 0 }; + if (fan_speed[f] > FAN_OFF_PWM) { + if (fan_kick_end[f] == 0) { + fan_kick_end[f] = ms + kickstart.settings.duration_ms; + fan_speed[f] = kickstart.settings.speed; + } + else if (PENDING(ms, fan_kick_end[f])) + fan_speed[f] = kickstart.settings.speed; + } + #else static millis_t fan_kick_end[FAN_COUNT] = { 0 }; if (fan_speed[f] > FAN_OFF_PWM) { if (fan_kick_end[f] == 0) { @@ -1321,6 +1338,7 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { else if (PENDING(ms, fan_kick_end[f])) fan_speed[f] = FAN_KICKSTART_POWER; } + #endif else fan_kick_end[f] = 0; } diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index dc89d59e51..73509ec331 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -143,6 +143,8 @@ #include "../feature/controllerfan.h" +#include "../feature/kickstart.h" + #if ENABLED(CASE_LIGHT_ENABLE) #include "../feature/caselight.h" #endif @@ -447,6 +449,11 @@ typedef struct SettingsDataStruct { // controllerFan_settings_t controllerFan_settings; // M710 + // + // Fan Kickstart settings + // + kickstart_settings_t kickstart_settings; // M711 + // // POWER_LOSS_RECOVERY // @@ -1331,6 +1338,19 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(cfs); } + // + // Fan Kickstart + // + { + _FIELD_TEST(kickstart_settings); + #if ENABLED(FAN_KICKSTART_EDITABLE) + const kickstart_settings_t &fks = kickstart.settings; + #else + constexpr kickstart_settings_t fks = kickstart_defaults; + #endif + EEPROM_WRITE(fks); + } + // // Power-Loss Recovery // @@ -2424,6 +2444,16 @@ void MarlinSettings::postprocess() { TERN_(CONTROLLER_FAN_EDITABLE, if (!validating) controllerFan.settings = cfs); } + // + // Fan Kickstart + // + { + kickstart_settings_t fks = { 0 }; + _FIELD_TEST(kickstart_settings); + EEPROM_READ(fks); + TERN_(FAN_KICKSTART_EDITABLE, if (!validating) kickstart.settings = fks); + } + // // Power-Loss Recovery // @@ -3660,6 +3690,11 @@ void MarlinSettings::reset() { // TERN_(USE_CONTROLLER_FAN, controllerFan.reset()); + // + // Fan Kickstart + // + TERN_(FAN_KICKSTART_EDITABLE, kickstart.reset()); + // // Power-Loss Recovery // diff --git a/ini/features.ini b/ini/features.ini index ba8ca180a4..0ea13f2dd2 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -228,6 +228,7 @@ CANCEL_OBJECTS = build_src_filter=+ + EXTERNAL_CLOSED_LOOP_CONTROLLER = build_src_filter=+ + USE_CONTROLLER_FAN = build_src_filter=+ +FAN_KICKSTART_EDITABLE = build_src_filter=+ + HAS_COOLER|LASER_COOLANT_FLOW_METER = build_src_filter=+ HAS_MOTOR_CURRENT_DAC = build_src_filter=+ DIRECT_STEPPING = build_src_filter=+ + From d5b567007cbba9a492d610e5e07a30416cf78290 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Wed, 3 Apr 2024 21:56:43 +0300 Subject: [PATCH 03/36] configuration_adv: enable Controller and Extruder fan menu settings Signed-off-by: wlkmanist Conflicts: Marlin/Configuration_adv.h --- Marlin/Configuration_adv.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 7d8c884e83..7f8f4bb2e0 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -585,7 +585,7 @@ //#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_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 @@ -596,7 +596,7 @@ // Use TEMP_SENSOR_SOC as a trigger for enabling the controller fan //#define CONTROLLER_FAN_MIN_SOC_TEMP 40 // (°C) Turn on the fan if the SoC reaches this temperature - //#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings + #define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings #if ENABLED(CONTROLLER_FAN_EDITABLE) #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu #endif @@ -705,6 +705,8 @@ #define COOLER_AUTO_FAN_TEMPERATURE 18 #define COOLER_AUTO_FAN_SPEED 255 +#define EXTRUDER_AUTO_FAN_MENU // Enable the Extruder Fans submenu + /** * Hotend Cooling Fans tachometers * From 38ca05f032a1a073ceb3145df0fa5e7988f6cde7 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Thu, 4 Apr 2024 07:45:18 +0300 Subject: [PATCH 04/36] configuration_adv: Kickstart Signed-off-by: wlkmanist Conflicts: Marlin/Configuration_adv.h --- Marlin/Configuration_adv.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 7f8f4bb2e0..fa3ff65fe5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -596,9 +596,9 @@ // Use TEMP_SENSOR_SOC as a trigger for enabling the controller fan //#define CONTROLLER_FAN_MIN_SOC_TEMP 40 // (°C) Turn on the fan if the SoC reaches this temperature - #define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings + #define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings (472 bytes of flash) #if ENABLED(CONTROLLER_FAN_EDITABLE) - #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu + #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu (456 bytes of flash) #endif #endif @@ -608,9 +608,15 @@ * gets it spinning reliably for a short time before setting the requested speed. * (Does not work on Sanguinololu with FAN_SOFT_PWM.) */ -//#define FAN_KICKSTART_TIME 100 // (ms) -//#define FAN_KICKSTART_POWER 180 // 64-255 +#define FAN_KICKSTART_TIME 100 // (ms) +#define FAN_KICKSTART_POWER 180 // 64-255 +#if FAN_KICKSTART_TIME + #define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings (320 bytes of flash) + #if ENABLED(FAN_KICKSTART_EDITABLE) + #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu (384 bytes of flash) + #endif +#endif // Some coolers may require a non-zero "off" state. //#define FAN_OFF_PWM 1 From ff856098f92a096473939fb683d9fa7f98f82839 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Mon, 8 Apr 2024 16:51:20 +0300 Subject: [PATCH 05/36] Add editable Extruder Auto Fans settings with DWIN support - Added AUTO_FAN_EDITABLE (Enable M712 configurable settings (320 bytes of flash)) - Added AUTO_FAN_MENU (Enable the Extruder Auto Fans submenu (104 bytes of flash)) - Auto Fans saves parameters to EEPROM - M712: Set Extruder Auto Fans settings: -- R : Reset to defaults -- E : Set Extruder fans temperature threshold -- H : Set Chamber fan temperature threshold -- C : Set Cooler fan temperature threshold -- Examples: -- M712 ; Report current Settings -- M712 R ; Reset EHC to defaults -- M712 E60 ; Set Extruder temp to 60 -- M712 E50 H30 C18 ; Set Extruder temp to 50, Chamber temp to 30, Cooler temp to 18 Signed-off-by: wlkmanist Conflicts: Marlin/src/lcd/e3v2/proui/dwin.cpp --- Marlin/Configuration_adv.h | 5 +- Marlin/src/MarlinCore.cpp | 8 +++ Marlin/src/core/language.h | 1 + Marlin/src/feature/autofans.cpp | 30 ++++++++ Marlin/src/feature/autofans.h | 56 +++++++++++++++ Marlin/src/gcode/feature/autofans/M712.cpp | 71 +++++++++++++++++++ Marlin/src/gcode/gcode.cpp | 4 ++ Marlin/src/gcode/gcode.h | 5 ++ Marlin/src/inc/Conditionals_post.h | 79 +++++++--------------- Marlin/src/lcd/e3v2/proui/dwin.cpp | 46 +++++++++---- Marlin/src/module/settings.cpp | 37 +++++++++- Marlin/src/module/temperature.cpp | 4 ++ ini/features.ini | 1 + 13 files changed, 277 insertions(+), 70 deletions(-) create mode 100644 Marlin/src/feature/autofans.cpp create mode 100644 Marlin/src/feature/autofans.h create mode 100644 Marlin/src/gcode/feature/autofans/M712.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index fa3ff65fe5..d5f333704b 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -711,7 +711,10 @@ #define COOLER_AUTO_FAN_TEMPERATURE 18 #define COOLER_AUTO_FAN_SPEED 255 -#define EXTRUDER_AUTO_FAN_MENU // Enable the Extruder Fans submenu +#define AUTO_FAN_EDITABLE // Enable M712 configurable settings (320 bytes of flash) +#if ENABLED(AUTO_FAN_EDITABLE) + #define AUTO_FAN_MENU // Enable the Extruder Auto Fans submenu (104 bytes of flash) +#endif /** * Hotend Cooling Fans tachometers diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 5bca8e6671..a5dcf1c3b7 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -227,6 +227,10 @@ #include "feature/kickstart.h" #endif +#if ENABLED(AUTO_FAN_EDITABLE) + #include "feature/autofans.h" +#endif + #if ENABLED(USE_CONTROLLER_FAN) #include "feature/controllerfan.h" #endif @@ -1315,6 +1319,10 @@ void setup() { 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 diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index e410ffbd2c..09f9d3f6cd 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -301,6 +301,7 @@ #define STR_NONLINEAR_EXTRUSION "Nonlinear Extrusion" #define STR_CONTROLLER_FAN "Controller Fan" #define STR_FAN_KICKSTART "Fan Kickstart" +#define STR_AUTOFANS "Extruder Auto Fans" #define STR_STEPPER_MOTOR_CURRENTS "Stepper motor currents" #define STR_RETRACT_S_F_Z "Retract (S F Z)" #define STR_RECOVER_S_F "Recover (S F)" diff --git a/Marlin/src/feature/autofans.cpp b/Marlin/src/feature/autofans.cpp new file mode 100644 index 0000000000..b6ac5a2f15 --- /dev/null +++ b/Marlin/src/feature/autofans.cpp @@ -0,0 +1,30 @@ +/** + * Auto Fans settings (Extruder Cooling Fans) + * Author: wlkmanist + * Date: 2024/04/08 + * + * 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 . + * + */ + +#include "../inc/MarlinConfig.h" + +#if ENABLED(AUTO_FAN_EDITABLE) + +#include "autofans.h" + +Autofans autofans; +autofans_settings_t Autofans::settings; // {0} + +#endif diff --git a/Marlin/src/feature/autofans.h b/Marlin/src/feature/autofans.h new file mode 100644 index 0000000000..49574c2430 --- /dev/null +++ b/Marlin/src/feature/autofans.h @@ -0,0 +1,56 @@ +/** + * Auto Fans settings (Extruder Cooling Fans) + * Author: wlkmanist + * Date: 2024/04/08 + * + * 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 . + * + */ + +#pragma once + +#include "../inc/MarlinConfigPre.h" + +typedef struct { + uint8_t extruder_temp; // Auto fans temperature thresholds + uint8_t chamber_temp; + uint8_t cooler_temp; +} autofans_settings_t; + +static constexpr autofans_settings_t autofans_defaults = { + EXTRUDER_AUTO_FAN_TEMPERATURE, + CHAMBER_AUTO_FAN_TEMPERATURE, + COOLER_AUTO_FAN_TEMPERATURE +}; + +#if ENABLED(AUTO_FAN_EDITABLE) + +class Autofans { + public: + static autofans_settings_t settings; + + static void reset() { TERN_(AUTO_FAN_EDITABLE, 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 diff --git a/Marlin/src/gcode/feature/autofans/M712.cpp b/Marlin/src/gcode/feature/autofans/M712.cpp new file mode 100644 index 0000000000..2818332dbf --- /dev/null +++ b/Marlin/src/gcode/feature/autofans/M712.cpp @@ -0,0 +1,71 @@ +/** + * Auto Fans settings (Extruder Cooling Fans) + * Author: wlkmanist + * Date: 2024/04/08 + * + * 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 . + * + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(AUTO_FAN_EDITABLE) + +#include "../../gcode.h" +#include "../../../feature/autofans.h" + +/** + * M712: Set Extruder Auto Fans settings + * + * R : Reset to defaults + * E : Set Extruder fans temperature threshold + * H : Set Chamber fan temperature threshold + * C : Set Cooler fan temperature threshold + * + * Examples: + * M712 ; Report current Settings + * M712 R ; Reset EHC to defaults + * M712 E60 ; Set Extruder temp to 60 + * M712 E50 H30 C18 ; Set Extruder temp to 50, Chamber temp to 30, Cooler temp to 18 + */ +void GcodeSuite::M712() { + + const bool seenR = parser.seen('R'); + if (seenR) autofans.reset(); + + const bool seenE = parser.seenval('E'); + if (seenE) autofans.settings.extruder_temp = parser.value_byte(); + + const bool seenH = parser.seenval('H'); + if (seenH) autofans.settings.chamber_temp = parser.value_byte(); + + const bool seenC = parser.seenval('C'); + if (seenC) autofans.settings.cooler_temp = parser.value_byte(); + + if (!(seenR || seenE || seenH || seenC)) + M712_report(); +} + +void GcodeSuite::M712_report(const bool forReplay/*=true*/) { + TERN_(MARLIN_SMALL_BUILD, return); + + report_heading_etc(forReplay, F(STR_AUTOFANS)); + SERIAL_ECHOLNPGM(" M712" + " E", int(autofans.settings.extruder_temp), + " H", int(autofans.settings.chamber_temp), + " C", int(autofans.settings.cooler_temp) + ); +} + +#endif // AUTO_FAN_EDITABLE diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 391a2c8a9a..c8f47f2377 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -1010,6 +1010,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 711: M711(); break; // M711: Set Fan Kickstart settings #endif + #if ENABLED(AUTO_FAN_EDITABLE) + case 712: M712(); break; // M712: Set Auto Fans settings + #endif + #if ENABLED(GCODE_MACROS) case 810: case 811: case 812: case 813: case 814: case 815: case 816: case 817: case 818: case 819: diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index d58c07ee77..b734d18596 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -1302,6 +1302,11 @@ class GcodeSuite { static void M711_report(const bool forReplay=true); #endif + #if ENABLED(AUTO_FAN_EDITABLE) + static void M712(); + static void M712_report(const bool forReplay=true); + #endif + static void T(const int8_t tool_index) IF_DISABLED(HAS_TOOLCHANGE, { UNUSED(tool_index); }); }; diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 388d1748aa..8948f2f0f6 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2552,6 +2552,30 @@ #define HAS_AUTO_COOLER_FAN 1 #endif +#if HAS_AUTO_FAN_7 + #define AUTO_EXTRUDER_FAN_COUNT 8 +#elif HAS_AUTO_FAN_6 + #define AUTO_EXTRUDER_FAN_COUNT 7 +#elif HAS_AUTO_FAN_5 + #define AUTO_EXTRUDER_FAN_COUNT 6 +#elif HAS_AUTO_FAN_4 + #define AUTO_EXTRUDER_FAN_COUNT 5 +#elif HAS_AUTO_FAN_3 + #define AUTO_EXTRUDER_FAN_COUNT 4 +#elif HAS_AUTO_FAN_2 + #define AUTO_EXTRUDER_FAN_COUNT 3 +#elif HAS_AUTO_FAN_1 + #define AUTO_EXTRUDER_FAN_COUNT 2 +#elif HAS_AUTO_FAN_0 + #define AUTO_EXTRUDER_FAN_COUNT 1 +#else + #define AUTO_EXTRUDER_FAN_COUNT 0 +#endif + +#if AUTO_EXTRUDER_FAN_COUNT > 0 + #define HAS_AUTO_EXTRUDER_FAN 1 +#endif + #if ANY(HAS_AUTO_FAN_0, HAS_AUTO_FAN_1, HAS_AUTO_FAN_2, HAS_AUTO_FAN_3, HAS_AUTO_FAN_4, HAS_AUTO_FAN_5, HAS_AUTO_FAN_6, HAS_AUTO_FAN_7, HAS_AUTO_CHAMBER_FAN, HAS_AUTO_COOLER_FAN) #define HAS_AUTO_FAN 1 #define _FANOVERLAP(I,T) (T##_AUTO_FAN_PIN == E##I##_AUTO_FAN_PIN) @@ -2730,61 +2754,6 @@ #define HAS_FANMUX 1 // Part Cooling fan multipliexer #endif -/** - * Up to 8 Extruder cooling fans - */ -#define _HAS_FAN_E_AUTO(N) (PIN_EXISTS(E##N##_AUTO_FAN)) - -#if _HAS_FAN_E_AUTO(0) - #define HAS_FAN_E0_AUTO 1 -#endif -#if _HAS_FAN_E_AUTO(1) - #define HAS_FAN_E1_AUTO 1 -#endif -#if _HAS_FAN_E_AUTO(2) - #define HAS_FAN_E2_AUTO 1 -#endif -#if _HAS_FAN_E_AUTO(3) - #define HAS_FAN_E3_AUTO 1 -#endif -#if _HAS_FAN_E_AUTO(4) - #define HAS_FAN_E4_AUTO 1 -#endif -#if _HAS_FAN_E_AUTO(5) - #define HAS_FAN_E5_AUTO 1 -#endif -#if _HAS_FAN_E_AUTO(6) - #define HAS_FAN_E6_AUTO 1 -#endif -#if _HAS_FAN_E_AUTO(7) - #define HAS_FAN_E7_AUTO 1 -#endif -#undef _HAS_FAN_E_AUTO - -#if HAS_FAN7 - #define EXTRUDER_AUTO_FAN_COUNT 8 -#elif HAS_FAN6 - #define EXTRUDER_AUTO_FAN_COUNT 7 -#elif HAS_FAN5 - #define EXTRUDER_AUTO_FAN_COUNT 6 -#elif HAS_FAN4 - #define EXTRUDER_AUTO_FAN_COUNT 5 -#elif HAS_FAN3 - #define EXTRUDER_AUTO_FAN_COUNT 4 -#elif HAS_FAN2 - #define EXTRUDER_AUTO_FAN_COUNT 3 -#elif HAS_FAN1 - #define EXTRUDER_AUTO_FAN_COUNT 2 -#elif HAS_FAN0 - #define EXTRUDER_AUTO_FAN_COUNT 1 -#else - #define EXTRUDER_AUTO_FAN_COUNT 0 -#endif - -#if EXTRUDER_AUTO_FAN_COUNT > 0 - #define HAS_EXTRUDER_AUTO_FAN 1 -#endif - /** * MIN/MAX fan PWM scaling */ diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 138dea1090..b11d4afd93 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -98,6 +98,10 @@ #include "../../feature/kickstart.h" #endif +#if ENABLED(AUTO_FAN_MENU) + #include "../../feature/autofans.h" +#endif + #if ANY(HAS_GCODE_PREVIEW, CV_LASER_MODULE) #include "gcode_preview.h" #endif @@ -320,6 +324,9 @@ MenuClass *PIDMenu = nullptr; #if ENABLED(FAN_KICKSTART_MENU) MenuClass *KickstartMenu = nullptr; #endif +#if ENABLED(AUTO_FAN_MENU) + MenuClass *AutofanMenu = nullptr; +#endif #if ENABLED(CV_LASER_MODULE) MenuClass *LaserSettings = nullptr; MenuClass *LaserPrintMenu = nullptr; @@ -2783,9 +2790,11 @@ void ApplyMove() { kickstart.settings.duration_ms, []{ kickstart.settings.duration_ms = MenuData.Value; }); } #endif -//#if HAS_EXTRUDER_AUTO_FAN -// -//#endif +#if ENABLED(AUTO_FAN_MENU) + void SetExtruderFanSpeed() { SetIntOnClick(10, 120, autofans.settings.extruder_temp, []{ autofans.settings.extruder_temp = MenuData.Value; }); } + void SetChamberFanSpeed() { SetIntOnClick(10, 80, autofans.settings.chamber_temp, []{ autofans.settings.chamber_temp = MenuData.Value; }); } + void SetCoolerFanSpeed() { SetIntOnClick(10, 100, autofans.settings.cooler_temp, []{ autofans.settings.cooler_temp = MenuData.Value; }); } +#endif #if ENABLED(SHOW_SPEED_IND) void SetSpdInd() { Toggle_Chkb_Line(HMI_data.SpdInd); } @@ -3726,14 +3735,17 @@ void Draw_Tune_Menu() { #endif -#if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU) +#if ANY(CONTROLLER_FAN_MENU, AUTO_FAN_MENU, FAN_KICKSTART_MENU) namespace GET_LANG(LCD_LANGUAGE) { - LSTR MSG_MISC_FANS = _UxGT("Misc Fans"); /// TODO: proper locale + LSTR MSG_MISC_FANS = _UxGT("Fans Settings"); /// TODO: proper locale LSTR MSG_CONTROLLER_FAN = _UxGT("Controller Fan"); LSTR MSG_FAN_KICKSTART = _UxGT("Fan Kickstart"); LSTR MSG_FAN_KICKSTART_ENABLE = _UxGT("Enable Kickstart"); LSTR MSG_FAN_KICKSTART_DURATION = _UxGT("Kickstart Time"); LSTR MSG_FAN_KICKSTART_POWER = _UxGT("Kickstart Power"); + LSTR MSG_FAN_EXTRUDER_TEMP = _UxGT("Extruder Fan Temp"); + LSTR MSG_FAN_CHAMBER_TEMP = _UxGT("Chamber Fan Temp"); + LSTR MSG_FAN_COOLER_TEMP = _UxGT("Cooler Fan Temp"); } /// TODO: add extruder fan options @@ -3775,19 +3787,27 @@ void Draw_Tune_Menu() { void Draw_AdvancedFan_menu() { checkkey = Menu; - if (SET_MENU(AdvancedFanMenu, MSG_MISC_FANS, 3)) { + if (SET_MENU(AdvancedFanMenu, MSG_MISC_FANS, 6)) { BACK_ITEM(Draw_Advanced_Menu); + #if ENABLED(FAN_KICKSTART_MENU) + MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); + #endif + #if ENABLED(CONTROLLER_FAN_MENU) MENU_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN, onDrawSubMenu, Draw_ControllerFan_menu); #endif - //#if (ENABLED(EXTRUDER_AUTO_FAN_MENU) && (HAS_EXTRUDER_AUTO_FAN)) - ///// TODO: E_AUTO fans code here (check Marlin/src/module/temperature.cpp, line 1377, then Temperature::update_autofans()) - //#endif - - #if ENABLED(FAN_KICKSTART_MENU) - MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); + #if (ENABLED(AUTO_FAN_MENU)) + #if HAS_AUTO_EXTRUDER_FAN + EDIT_ITEM(ICON_Temperature, MSG_FAN_EXTRUDER_TEMP, onDrawPInt8Menu, SetExtruderFanSpeed, &autofans.settings.extruder_temp); + #endif + #if HAS_AUTO_CHAMBER_FAN + EDIT_ITEM(ICON_Temperature, MSG_FAN_CHAMBER_TEMP, onDrawPInt8Menu, SetChamberFanSpeed, &autofans.settings.chamber_temp); + #endif + #if HAS_AUTO_COOLER_FAN + EDIT_ITEM(ICON_Temperature, MSG_FAN_COOLER_TEMP, onDrawPInt8Menu, SetCoolerFanSpeed, &autofans.settings.cooler_temp); + #endif #endif } UpdateMenu(AdvancedFanMenu); @@ -4840,7 +4860,7 @@ void Draw_AdvancedSettings_Menu() { #if HAS_TRINAMIC_CONFIG MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, Draw_TrinamicConfig_menu); #endif - #if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU, FAN_KICKSTART_MENU) + #if ANY(CONTROLLER_FAN_MENU, AUTO_FAN_MENU, FAN_KICKSTART_MENU) MENU_ITEM(ICON_FanSpeed, MSG_MISC_FANS, onDrawSubMenu, Draw_AdvancedFan_menu); #endif #if ENABLED(PRINTCOUNTER) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 73509ec331..2ae8142a3f 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -145,6 +145,8 @@ #include "../feature/kickstart.h" +#include "../feature/autofans.h" + #if ENABLED(CASE_LIGHT_ENABLE) #include "../feature/caselight.h" #endif @@ -452,7 +454,12 @@ typedef struct SettingsDataStruct { // // Fan Kickstart settings // - kickstart_settings_t kickstart_settings; // M711 + kickstart_settings_t kickstart_settings; // M711 + + // + // Auto Fans settings + // + autofans_settings_t autofans_settings; // M712 // // POWER_LOSS_RECOVERY @@ -1351,6 +1358,19 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(fks); } + // + // Auto Fans + // + { + _FIELD_TEST(autofans_settings); + #if ENABLED(AUTO_FAN_EDITABLE) + const autofans_settings_t &eauto = autofans.settings; + #else + constexpr autofans_settings_t eauto = autofans_defaults; + #endif + EEPROM_WRITE(eauto); + } + // // Power-Loss Recovery // @@ -2454,6 +2474,16 @@ void MarlinSettings::postprocess() { TERN_(FAN_KICKSTART_EDITABLE, if (!validating) kickstart.settings = fks); } + // + // Auto Fans + // + { + autofans_settings_t eauto = { 0 }; + _FIELD_TEST(autofans_settings); + EEPROM_READ(eauto); + TERN_(AUTO_FAN_EDITABLE, if (!validating) autofans.settings = eauto); + } + // // Power-Loss Recovery // @@ -3695,6 +3725,11 @@ void MarlinSettings::reset() { // TERN_(FAN_KICKSTART_EDITABLE, kickstart.reset()); + // + // Auto Fans + // + TERN_(AUTO_FAN_EDITABLE, autofans.reset()); + // // Power-Loss Recovery // diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index eb04fa5e73..09fc5b281b 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -46,6 +46,10 @@ #include "../feature/controllerfan.h" #endif +#if ENABLED(AUTO_FAN_EDITABLE) + #include "../feature/autofans.h" +#endif + #if ENABLED(EMERGENCY_PARSER) #include "motion.h" #endif diff --git a/ini/features.ini b/ini/features.ini index 0ea13f2dd2..7c55cb5917 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -229,6 +229,7 @@ CASE_LIGHT_ENABLE = build_src_filter=+ + USE_CONTROLLER_FAN = build_src_filter=+ FAN_KICKSTART_EDITABLE = build_src_filter=+ + +AUTO_FAN_EDITABLE = build_src_filter=+ + HAS_COOLER|LASER_COOLANT_FLOW_METER = build_src_filter=+ HAS_MOTOR_CURRENT_DAC = build_src_filter=+ DIRECT_STEPPING = build_src_filter=+ + From b34862644a3f913660e6ae5d360d78df7c112778 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Mon, 8 Apr 2024 18:04:22 +0300 Subject: [PATCH 06/36] Controller Fan and Auto Fans small improvements Signed-off-by: wlkmanist Conflicts: Marlin/Configuration_adv.h --- Marlin/Configuration_adv.h | 1 + Marlin/src/feature/autofans.h | 10 ++++++++++ Marlin/src/inc/Conditionals_post.h | 5 ++++- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d5f333704b..0203a42774 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -586,6 +586,7 @@ //#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 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 diff --git a/Marlin/src/feature/autofans.h b/Marlin/src/feature/autofans.h index 49574c2430..b8749adf3b 100644 --- a/Marlin/src/feature/autofans.h +++ b/Marlin/src/feature/autofans.h @@ -28,6 +28,16 @@ typedef struct { uint8_t 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, diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 8948f2f0f6..77dd0e8bc2 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2777,10 +2777,13 @@ #define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM) #endif #if ENABLED(USE_CONTROLLER_FAN) + #ifndef CONTROLLERFAN_SPEED_MAX + #define CONTROLLERFAN_SPEED_MAX FAN_MAX_PWM + #endif #if CONTROLLERFAN_SPEED_MIN == 0 && FAN_MAX_PWM == 255 #define CALC_CONTROLLER_FAN_SPEED(f) (f ?: FAN_OFF_PWM) #else - #define CALC_CONTROLLER_FAN_SPEED(f) (f ? map(f, 1, 255, CONTROLLERFAN_SPEED_MIN, FAN_MAX_PWM) : FAN_OFF_PWM) + #define CALC_CONTROLLER_FAN_SPEED(f) (f ? map(f, 1, 255, CONTROLLERFAN_SPEED_MIN, CONTROLLERFAN_SPEED_MAX) : FAN_OFF_PWM) #endif #endif #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index b11d4afd93..f61ce2a5ac 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2776,7 +2776,7 @@ void ApplyMove() { void SetControllerFanIdleSpeed() { SetIntOnClick(0, 255, controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } void SetControllerFanSpeed() { SetIntOnClick(0, 255, controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } - void SetControllerFanDuration() { SetIntOnClick(1, 4800, controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } + void SetControllerFanDuration() { SetIntOnClick(1, MAX_CONTROLLER_FAN_IDLE_TIME, controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } void SetControllerFanAutoOn() { controllerFan.settings.auto_mode ^= true; PrepareRefreshMenu(); Draw_ControllerFan_menu(); } #endif From 77c3379f476e4b3df326d9fa0f104eaa9c5a4cf2 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Mon, 8 Apr 2024 18:51:10 +0300 Subject: [PATCH 07/36] fix Controller Fan with Kickstart Signed-off-by: wlkmanist --- Marlin/src/feature/controllerfan.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index d0fbaa391d..246bf04ffb 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -93,10 +93,10 @@ void ControllerFan::update() { if (speed > FAN_OFF_PWM && kickstart.settings.enabled) { if (!fan_kick_end) { fan_kick_end = ms + kickstart.settings.duration_ms; // May be longer based on slow update interval for controller fn check. Sets minimum - speed = kickstart.settings.speed; + speed = map(kickstart.settings.speed, 0, 255, 0, CONTROLLERFAN_SPEED_MAX); } else if (PENDING(ms, fan_kick_end)) - speed = kickstart.settings.speed; + speed = map(kickstart.settings.speed, 0, 255, 0, CONTROLLERFAN_SPEED_MAX); } #else if (speed > FAN_OFF_PWM) { From 0cb89f6dd8fb9629de2d459c17745062b5ea4d1d Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Mon, 8 Apr 2024 19:26:37 +0300 Subject: [PATCH 08/36] Add RU locale for fan settings menu Signed-off-by: wlkmanist Conflicts: Marlin/src/lcd/e3v2/proui/dwin.cpp --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 18 ++---------------- Marlin/src/lcd/language/language_en.h | 9 +++++++++ Marlin/src/lcd/language/language_ru.h | 9 +++++++++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index f61ce2a5ac..dfa6ee4418 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -3736,20 +3736,6 @@ void Draw_Tune_Menu() { #endif #if ANY(CONTROLLER_FAN_MENU, AUTO_FAN_MENU, FAN_KICKSTART_MENU) - namespace GET_LANG(LCD_LANGUAGE) { - LSTR MSG_MISC_FANS = _UxGT("Fans Settings"); /// TODO: proper locale - LSTR MSG_CONTROLLER_FAN = _UxGT("Controller Fan"); - LSTR MSG_FAN_KICKSTART = _UxGT("Fan Kickstart"); - LSTR MSG_FAN_KICKSTART_ENABLE = _UxGT("Enable Kickstart"); - LSTR MSG_FAN_KICKSTART_DURATION = _UxGT("Kickstart Time"); - LSTR MSG_FAN_KICKSTART_POWER = _UxGT("Kickstart Power"); - LSTR MSG_FAN_EXTRUDER_TEMP = _UxGT("Extruder Fan Temp"); - LSTR MSG_FAN_CHAMBER_TEMP = _UxGT("Chamber Fan Temp"); - LSTR MSG_FAN_COOLER_TEMP = _UxGT("Cooler Fan Temp"); - } - - /// TODO: add extruder fan options - void Draw_AdvancedFan_menu(); #if ENABLED(CONTROLLER_FAN_MENU) @@ -3787,7 +3773,7 @@ void Draw_Tune_Menu() { void Draw_AdvancedFan_menu() { checkkey = Menu; - if (SET_MENU(AdvancedFanMenu, MSG_MISC_FANS, 6)) { + if (SET_MENU(AdvancedFanMenu, MSG_FANS_SETTINGS, 6)) { BACK_ITEM(Draw_Advanced_Menu); #if ENABLED(FAN_KICKSTART_MENU) @@ -4861,7 +4847,7 @@ void Draw_AdvancedSettings_Menu() { MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, Draw_TrinamicConfig_menu); #endif #if ANY(CONTROLLER_FAN_MENU, AUTO_FAN_MENU, FAN_KICKSTART_MENU) - MENU_ITEM(ICON_FanSpeed, MSG_MISC_FANS, onDrawSubMenu, Draw_AdvancedFan_menu); + MENU_ITEM(ICON_FanSpeed, MSG_FANS_SETTINGS, onDrawSubMenu, Draw_AdvancedFan_menu); #endif #if ENABLED(PRINTCOUNTER) MENU_ITEM(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, printStatsReset); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 0299e1f1c2..5f397f58ed 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -878,6 +878,15 @@ namespace LanguageNarrow_en { LSTR MSG_BACKLASH_CORRECTION = _UxGT("Correction"); LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Smoothing"); + LSTR MSG_FANS_SETTINGS = _UxGT("Fans Settings"); + LSTR MSG_FAN_KICKSTART = _UxGT("Fan Kickstart"); + LSTR MSG_FAN_KICKSTART_ENABLE = _UxGT("Enable Kickstart"); + LSTR MSG_FAN_KICKSTART_DURATION = _UxGT("Kickstart Time"); + LSTR MSG_FAN_KICKSTART_POWER = _UxGT("Kickstart Power"); + LSTR MSG_FAN_EXTRUDER_TEMP = _UxGT("Extruder Fan Temp"); + LSTR MSG_FAN_CHAMBER_TEMP = _UxGT("Chamber Fan Temp"); + LSTR MSG_FAN_COOLER_TEMP = _UxGT("Cooler Fan Temp"); + LSTR MSG_FIXED_TIME_MOTION = _UxGT("Fixed-Time Motion"); LSTR MSG_FTM_MODE = _UxGT("Motion Mode:"); LSTR MSG_FTM_ZV = _UxGT("ZV"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 7b86e8a7f4..e5cb0ce7ab 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -636,6 +636,15 @@ namespace LanguageNarrow_ru { LSTR MSG_TMC_STEPPING_MODE = _UxGT("Режим драйвера"); LSTR MSG_TMC_STEALTH_ENABLED = _UxGT("Тихий режим вкл"); + LSTR MSG_FANS_SETTINGS = _UxGT("Настройки кулеров"); + LSTR MSG_FAN_KICKSTART = _UxGT("Кик-старт"); + LSTR MSG_FAN_KICKSTART_ENABLE = _UxGT("Кик-старт вкл"); + LSTR MSG_FAN_KICKSTART_DURATION = _UxGT("Длительность"); + LSTR MSG_FAN_KICKSTART_POWER = _UxGT("Мощность"); + LSTR MSG_FAN_EXTRUDER_TEMP = _UxGT("Порог кулера экстр."); + LSTR MSG_FAN_CHAMBER_TEMP = _UxGT("Порог кулера камеры"); + LSTR MSG_FAN_COOLER_TEMP = _UxGT("Порог кулера лазера"); + LSTR MSG_SERVICE_RESET = _UxGT("Сброс"); LSTR MSG_SERVICE_IN = _UxGT(" в:"); LSTR MSG_BACKLASH = _UxGT("Люфт"); From 54895349077c6c1cb2d16d3d78297f3ae34ff5d3 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Mon, 8 Apr 2024 20:05:16 +0300 Subject: [PATCH 09/36] Fix fan speed calculation macro Signed-off-by: wlkmanist --- Marlin/src/inc/Conditionals_post.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 77dd0e8bc2..53b26e3c41 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2772,18 +2772,18 @@ #define FAN_MAX_PWM 255 #endif #if FAN_MIN_PWM == 0 && FAN_MAX_PWM == 255 - #define CALC_FAN_SPEED(f) (f ?: FAN_OFF_PWM) + #define CALC_FAN_SPEED(f) ((f) ?: FAN_OFF_PWM) #else - #define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM) + #define CALC_FAN_SPEED(f) ((f) ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM) #endif #if ENABLED(USE_CONTROLLER_FAN) #ifndef CONTROLLERFAN_SPEED_MAX #define CONTROLLERFAN_SPEED_MAX FAN_MAX_PWM #endif #if CONTROLLERFAN_SPEED_MIN == 0 && FAN_MAX_PWM == 255 - #define CALC_CONTROLLER_FAN_SPEED(f) (f ?: FAN_OFF_PWM) + #define CALC_CONTROLLER_FAN_SPEED(f) ((f) ?: FAN_OFF_PWM) #else - #define CALC_CONTROLLER_FAN_SPEED(f) (f ? map(f, 1, 255, CONTROLLERFAN_SPEED_MIN, CONTROLLERFAN_SPEED_MAX) : FAN_OFF_PWM) + #define CALC_CONTROLLER_FAN_SPEED(f) ((f) ? map(f, 1, 255, CONTROLLERFAN_SPEED_MIN, CONTROLLERFAN_SPEED_MAX) : FAN_OFF_PWM) #endif #endif #endif From 84d6907c3f7b9a2cdf5d8c5e933897ecbc01d3bf Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Wed, 17 Apr 2024 18:49:42 +0300 Subject: [PATCH 10/36] dwin: fix advanced settings items count Signed-off-by: wlkmanist --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index dfa6ee4418..65e7c1ddf9 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -4808,7 +4808,7 @@ void Draw_AdvancedSettings_Menu() { void Draw_Advanced_Menu() { // From Control_Menu (Control) || Default-NP AdvancedSettings_Menu (Level) checkkey = Menu; - if (SET_MENU(AdvancedMenu, MSG_ADVANCED_SETTINGS, 19)) { + if (SET_MENU(AdvancedMenu, MSG_ADVANCED_SETTINGS, 20)) { BACK_ITEM(Draw_Control_Menu); #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawMenuItem, ReadEeprom); From 24377149c3138c446f339a3d6668a5237a011289 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Thu, 18 Apr 2024 01:29:36 +0300 Subject: [PATCH 11/36] dwin: function namings Signed-off-by: wlkmanist --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 65e7c1ddf9..f09a68a2eb 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2791,9 +2791,9 @@ void ApplyMove() { #endif #if ENABLED(AUTO_FAN_MENU) - void SetExtruderFanSpeed() { SetIntOnClick(10, 120, autofans.settings.extruder_temp, []{ autofans.settings.extruder_temp = MenuData.Value; }); } - void SetChamberFanSpeed() { SetIntOnClick(10, 80, autofans.settings.chamber_temp, []{ autofans.settings.chamber_temp = MenuData.Value; }); } - void SetCoolerFanSpeed() { SetIntOnClick(10, 100, autofans.settings.cooler_temp, []{ autofans.settings.cooler_temp = MenuData.Value; }); } + void SetExtruderFanThreshold() { SetIntOnClick(10, 120, autofans.settings.extruder_temp, []{ autofans.settings.extruder_temp = MenuData.Value; }); } + void SetChamberFanThreshold() { SetIntOnClick(10, 80, autofans.settings.chamber_temp, []{ autofans.settings.chamber_temp = MenuData.Value; }); } + void SetCoolerFanThreshold() { SetIntOnClick(10, 100, autofans.settings.cooler_temp, []{ autofans.settings.cooler_temp = MenuData.Value; }); } #endif #if ENABLED(SHOW_SPEED_IND) @@ -3786,13 +3786,13 @@ void Draw_Tune_Menu() { #if (ENABLED(AUTO_FAN_MENU)) #if HAS_AUTO_EXTRUDER_FAN - EDIT_ITEM(ICON_Temperature, MSG_FAN_EXTRUDER_TEMP, onDrawPInt8Menu, SetExtruderFanSpeed, &autofans.settings.extruder_temp); + EDIT_ITEM(ICON_Temperature, MSG_FAN_EXTRUDER_TEMP, onDrawPInt8Menu, SetExtruderFanThreshold, &autofans.settings.extruder_temp); #endif #if HAS_AUTO_CHAMBER_FAN - EDIT_ITEM(ICON_Temperature, MSG_FAN_CHAMBER_TEMP, onDrawPInt8Menu, SetChamberFanSpeed, &autofans.settings.chamber_temp); + EDIT_ITEM(ICON_Temperature, MSG_FAN_CHAMBER_TEMP, onDrawPInt8Menu, SetChamberFanThreshold, &autofans.settings.chamber_temp); #endif #if HAS_AUTO_COOLER_FAN - EDIT_ITEM(ICON_Temperature, MSG_FAN_COOLER_TEMP, onDrawPInt8Menu, SetCoolerFanSpeed, &autofans.settings.cooler_temp); + EDIT_ITEM(ICON_Temperature, MSG_FAN_COOLER_TEMP, onDrawPInt8Menu, SetCoolerFanThreshold, &autofans.settings.cooler_temp); #endif #endif } From dc89046c60042b92319b3dfc84211a639da449d0 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Thu, 18 Apr 2024 01:55:18 +0300 Subject: [PATCH 12/36] controllerfan: reduce fan speed update interval during kickstart Signed-off-by: wlkmanist --- Marlin/src/feature/controllerfan.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 246bf04ffb..ee333a8ccf 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -92,20 +92,27 @@ void ControllerFan::update() { #if ENABLED(FAN_KICKSTART_EDITABLE) if (speed > FAN_OFF_PWM && kickstart.settings.enabled) { if (!fan_kick_end) { - fan_kick_end = ms + kickstart.settings.duration_ms; // May be longer based on slow update interval for controller fn check. Sets minimum + fan_kick_end = ms + kickstart.settings.duration_ms; 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 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. + } } #endif else From 9cc15743711fc944173de45ec22de92b9189b3ab Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Thu, 18 Apr 2024 05:36:22 +0300 Subject: [PATCH 13/36] fix M711 and M712 report Signed-off-by: wlkmanist --- Marlin/src/core/language.h | 2 +- Marlin/src/module/settings.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 09f9d3f6cd..87f737de74 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -301,7 +301,7 @@ #define STR_NONLINEAR_EXTRUSION "Nonlinear Extrusion" #define STR_CONTROLLER_FAN "Controller Fan" #define STR_FAN_KICKSTART "Fan Kickstart" -#define STR_AUTOFANS "Extruder Auto Fans" +#define STR_AUTOFANS "Auto Fans" #define STR_STEPPER_MOTOR_CURRENTS "Stepper motor currents" #define STR_RETRACT_S_F_Z "Retract (S F Z)" #define STR_RECOVER_S_F "Recover (S F)" diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 2ae8142a3f..dc1f8cf273 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -4129,6 +4129,16 @@ void MarlinSettings::reset() { // TERN_(CONTROLLER_FAN_EDITABLE, gcode.M710_report(forReplay)); + // + // Fan Kickstart + // + TERN_(FAN_KICKSTART_EDITABLE, gcode.M711_report(forReplay)); + + // + // Auto Fans + // + TERN_(AUTO_FAN_EDITABLE, gcode.M712_report(forReplay)); + // // Power-Loss Recovery // From 1a5325763e4f27d99ed2f2da833496e415a0f143 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Sun, 21 Apr 2024 02:29:07 +0300 Subject: [PATCH 14/36] dwin: fix menu back item for Fans Settings Signed-off-by: wlkmanist --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index f09a68a2eb..6bf87db1f8 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -3774,7 +3774,11 @@ void Draw_Tune_Menu() { void Draw_AdvancedFan_menu() { checkkey = Menu; if (SET_MENU(AdvancedFanMenu, MSG_FANS_SETTINGS, 6)) { - BACK_ITEM(Draw_Advanced_Menu); + #if NONE(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) + BACK_ITEM(Draw_AdvancedSettings_Menu); + #else + BACK_ITEM(Draw_Advanced_Menu); + #endif #if ENABLED(FAN_KICKSTART_MENU) MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); @@ -4788,6 +4792,9 @@ void Draw_AdvancedSettings_Menu() { #if HAS_TRINAMIC_CONFIG MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, Draw_TrinamicConfig_menu); #endif + #if ANY(CONTROLLER_FAN_MENU, AUTO_FAN_MENU, FAN_KICKSTART_MENU) + MENU_ITEM(ICON_FanSpeed, MSG_FANS_SETTINGS, onDrawSubMenu, Draw_AdvancedFan_menu); + #endif #if ENABLED(PRINTCOUNTER) MENU_ITEM(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, printStatsReset); #endif From 40c3cab33d919380ae7d5d533523ded4f10f944f Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Sun, 21 Apr 2024 03:08:33 +0300 Subject: [PATCH 15/36] dwin: fix incudes for controllerfan, kickstart, autofans Signed-off-by: wlkmanist --- .vscode/extensions.json | 8 ++++---- Marlin/src/lcd/e3v2/proui/dwin.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 46cc66627a..080e70d08b 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,9 +2,9 @@ // See http://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ - "classicrocker883.kazikame-dark", - "marlinfirmware.auto-build", - "ms-vscode.cpptools-extension-pack", "platformio.platformio-ide" ], -} \ No newline at end of file + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index ed19ccb4fb..3268088ec3 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -91,15 +91,15 @@ #endif #if ENABLED(CONTROLLER_FAN_MENU) - #include "../../feature/controllerfan.h" + #include "../../../feature/controllerfan.h" #endif #if ENABLED(FAN_KICKSTART_MENU) - #include "../../feature/kickstart.h" + #include "../../../feature/kickstart.h" #endif #if ENABLED(AUTO_FAN_MENU) - #include "../../feature/autofans.h" + #include "../../../feature/autofans.h" #endif #if ANY(HAS_GCODE_PREVIEW, CV_LASER_MODULE) From bad624054b28194bd366143f2c0930dd783103fa Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Sun, 21 Apr 2024 04:21:40 +0300 Subject: [PATCH 16/36] check if fans actually connected to use with editable/menu --- Marlin/src/inc/Conditionals_post.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 2da94e9d83..342304c2b4 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2572,11 +2572,11 @@ #define AUTO_EXTRUDER_FAN_COUNT 0 #endif -#if AUTO_EXTRUDER_FAN_COUNT > 0 +#if AUTO_EXTRUDER_FAN_COUNT #define HAS_AUTO_EXTRUDER_FAN 1 #endif -#if ANY(HAS_AUTO_FAN_0, HAS_AUTO_FAN_1, HAS_AUTO_FAN_2, HAS_AUTO_FAN_3, HAS_AUTO_FAN_4, HAS_AUTO_FAN_5, HAS_AUTO_FAN_6, HAS_AUTO_FAN_7, HAS_AUTO_CHAMBER_FAN, HAS_AUTO_COOLER_FAN) +#if ANY(HAS_AUTO_EXTRUDER_FAN, HAS_AUTO_CHAMBER_FAN, HAS_AUTO_COOLER_FAN) #define HAS_AUTO_FAN 1 #define _FANOVERLAP(I,T) (T##_AUTO_FAN_PIN == E##I##_AUTO_FAN_PIN) #if HAS_AUTO_CHAMBER_FAN @@ -2595,6 +2595,15 @@ #endif #endif +#if !HAS_AUTO_FAN + #ifdef AUTO_FAN_MENU + #undef AUTO_FAN_MENU + #endif + #ifdef AUTO_FAN_EDITABLE + #undef AUTO_FAN_EDITABLE + #endif +#endif + // Fans check #if HAS_HOTEND && PIN_EXISTS(E0_FAN_TACHO) #define HAS_E0_FAN_TACHO 1 @@ -2660,6 +2669,13 @@ #else #undef CONTROLLER_FAN_TRIGGER_TEMP #endif +#else + #ifdef CONTROLLER_FAN_MENU + #undef CONTROLLER_FAN_MENU + #endif + #ifdef CONTROLLER_FAN_EDITABLE + #undef CONTROLLER_FAN_EDITABLE + #endif #endif /** @@ -2789,6 +2805,10 @@ #endif // Fan Kickstart +#if FAN_KICKSTART_TIME && NONE(HAS_FAN, USE_CONTROLLER_FAN) + #undef FAN_KICKSTART_TIME +#endif + #if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER) #define FAN_KICKSTART_POWER 180 #endif From 3db853a65f0c7d264436a834d07ea187eefa87f6 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Sun, 21 Apr 2024 04:31:10 +0300 Subject: [PATCH 17/36] return back checking every extruder auto fan for specific builds --- Marlin/src/inc/Conditionals_post.h | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 342304c2b4..73cdc43e3e 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2552,27 +2552,7 @@ #define HAS_AUTO_COOLER_FAN 1 #endif -#if HAS_AUTO_FAN_7 - #define AUTO_EXTRUDER_FAN_COUNT 8 -#elif HAS_AUTO_FAN_6 - #define AUTO_EXTRUDER_FAN_COUNT 7 -#elif HAS_AUTO_FAN_5 - #define AUTO_EXTRUDER_FAN_COUNT 6 -#elif HAS_AUTO_FAN_4 - #define AUTO_EXTRUDER_FAN_COUNT 5 -#elif HAS_AUTO_FAN_3 - #define AUTO_EXTRUDER_FAN_COUNT 4 -#elif HAS_AUTO_FAN_2 - #define AUTO_EXTRUDER_FAN_COUNT 3 -#elif HAS_AUTO_FAN_1 - #define AUTO_EXTRUDER_FAN_COUNT 2 -#elif HAS_AUTO_FAN_0 - #define AUTO_EXTRUDER_FAN_COUNT 1 -#else - #define AUTO_EXTRUDER_FAN_COUNT 0 -#endif - -#if AUTO_EXTRUDER_FAN_COUNT +#if ANY(HAS_AUTO_FAN_0, HAS_AUTO_FAN_1, HAS_AUTO_FAN_2, HAS_AUTO_FAN_3, HAS_AUTO_FAN_4, HAS_AUTO_FAN_5, HAS_AUTO_FAN_6, HAS_AUTO_FAN_7) #define HAS_AUTO_EXTRUDER_FAN 1 #endif From 7185c1d25f641d2f1ec348849bd447af8d496d35 Mon Sep 17 00:00:00 2001 From: wlkmanist Date: Mon, 22 Apr 2024 02:56:10 +0300 Subject: [PATCH 18/36] dwin: use ternary for Fans Settings menu items count --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 3268088ec3..28731a36f0 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -3743,7 +3743,7 @@ void Draw_Tune_Menu() { void Draw_AdvancedFan_menu() { checkkey = Menu; - if (SET_MENU(AdvancedFanMenu, MSG_FANS_SETTINGS, 6)) { + if (SET_MENU(AdvancedFanMenu, MSG_FANS_SETTINGS, 1 PLUS_TERN0(FAN_KICKSTART_MENU, 1) PLUS_TERN0(CONTROLLER_FAN_MENU, 1) PLUS_TERN0(AUTO_FAN_MENU, 3))) { #if NONE(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) BACK_ITEM(Draw_AdvancedSettings_Menu); #else From 4a631da83814640d6f7e3b44e320d3fbdf971686 Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Sat, 28 Dec 2024 16:00:59 -0500 Subject: [PATCH 19/36] cleanup dwin menu --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 80 +++++++++++++----------------- Marlin/src/lcd/e3v2/proui/dwin.h | 8 +++ 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index c8ba5c265f..9f843ad9b7 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -152,7 +152,7 @@ #endif #if ENABLED(CONTROLLER_FAN_MENU) - #define MAX_CONTROLLER_FAN_IDLE_TIME 4800 + #define MAX_FAN_IDLE 4800 #endif // Editable temperature limits @@ -2717,17 +2717,13 @@ void ApplyMove() { #endif #if ENABLED(CONTROLLER_FAN_MENU) - void Draw_ControllerFan_menu(); - - void SetControllerFanIdleSpeed() { SetIntOnClick(0, 255, controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } - void SetControllerFanSpeed() { SetIntOnClick(0, 255, controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } - void SetControllerFanDuration() { SetIntOnClick(1, MAX_CONTROLLER_FAN_IDLE_TIME, controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } + void SetControllerFanIdleSpeed() { SetIntOnClick(0, 255, controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } + void SetControllerFanSpeed() { SetIntOnClick(0, 255, controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } + void SetControllerFanDuration() { SetIntOnClick(1, MAX_FAN_IDLE, controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } void SetControllerFanAutoOn() { controllerFan.settings.auto_mode ^= true; PrepareRefreshMenu(); Draw_ControllerFan_menu(); } #endif #if ENABLED(FAN_KICKSTART_MENU) - void Draw_Kickstart_menu(); - void SetKickstartEnabled() { kickstart.settings.enabled ^= true; PrepareRefreshMenu(); Draw_Kickstart_menu(); } void SetKickstartSpeed() { SetIntOnClick((FAN_MIN_PWM > 96 ? FAN_MIN_PWM : 96), FAN_MAX_PWM, kickstart.settings.speed, []{ kickstart.settings.speed = MenuData.Value; }); } @@ -2737,8 +2733,8 @@ void ApplyMove() { #if ENABLED(AUTO_FAN_MENU) void SetExtruderFanThreshold() { SetIntOnClick(10, 120, autofans.settings.extruder_temp, []{ autofans.settings.extruder_temp = MenuData.Value; }); } - void SetChamberFanThreshold() { SetIntOnClick(10, 80, autofans.settings.chamber_temp, []{ autofans.settings.chamber_temp = MenuData.Value; }); } - void SetCoolerFanThreshold() { SetIntOnClick(10, 100, autofans.settings.cooler_temp, []{ autofans.settings.cooler_temp = MenuData.Value; }); } + void SetChamberFanThreshold() { SetIntOnClick(10, 80, autofans.settings.chamber_temp, []{ autofans.settings.chamber_temp = MenuData.Value; }); } + void SetCoolerFanThreshold() { SetIntOnClick(10, 100, autofans.settings.cooler_temp, []{ autofans.settings.cooler_temp = MenuData.Value; }); } #endif #if ENABLED(SHOW_SPEED_IND) @@ -3757,14 +3753,41 @@ void Draw_Tune_Menu() { #endif #if ANY(CONTROLLER_FAN_MENU, AUTO_FAN_MENU, FAN_KICKSTART_MENU) - void Draw_AdvancedFan_menu(); + + void Draw_AdvancedFan_menu() { + checkkey = Menu; + if (SET_MENU(AdvancedFanMenu, MSG_FANS_SETTINGS, 1 PLUS_TERN0(FAN_KICKSTART_MENU, 1) PLUS_TERN0(CONTROLLER_FAN_MENU, 1) PLUS_TERN0(AUTO_FAN_MENU, 3))) { + #if NONE(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) + BACK_ITEM(Draw_AdvancedSettings_Menu); + #else + BACK_ITEM(Draw_Advanced_Menu); + #endif + #if ENABLED(FAN_KICKSTART_MENU) + MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); + #endif + #if ENABLED(CONTROLLER_FAN_MENU) + MENU_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN, onDrawSubMenu, Draw_ControllerFan_menu); + #endif + #if (ENABLED(AUTO_FAN_MENU)) + #if HAS_E_AUTO_FAN + EDIT_ITEM(ICON_Temperature, MSG_FAN_EXTRUDER_TEMP, onDrawPInt8Menu, SetExtruderFanThreshold, &autofans.settings.extruder_temp); + #endif + #if HAS_AUTO_CHAMBER_FAN + EDIT_ITEM(ICON_Temperature, MSG_FAN_CHAMBER_TEMP, onDrawPInt8Menu, SetChamberFanThreshold, &autofans.settings.chamber_temp); + #endif + #if HAS_AUTO_COOLER_FAN + EDIT_ITEM(ICON_Temperature, MSG_FAN_COOLER_TEMP, onDrawPInt8Menu, SetCoolerFanThreshold, &autofans.settings.cooler_temp); + #endif + #endif + } + UpdateMenu(AdvancedFanMenu); + } #if ENABLED(CONTROLLER_FAN_MENU) void Draw_ControllerFan_menu() { checkkey = Menu; if (SET_MENU(ControllerFanMenu, MSG_CONTROLLER_FAN, 5)) { BACK_ITEM(Draw_AdvancedFan_menu); - EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_AUTO_ON, onDrawChkbMenu, SetControllerFanAutoOn, &controllerFan.settings.auto_mode); EDIT_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN_IDLE_SPEED, onDrawPInt8Menu, SetControllerFanIdleSpeed, &controllerFan.settings.idle_speed); if (controllerFan.settings.auto_mode) { @@ -3781,7 +3804,6 @@ void Draw_Tune_Menu() { checkkey = Menu; if (SET_MENU(KickstartMenu, MSG_FAN_KICKSTART, 4)) { BACK_ITEM(Draw_AdvancedFan_menu); - EDIT_ITEM(ICON_Motion, MSG_FAN_KICKSTART_ENABLE, onDrawChkbMenu, SetKickstartEnabled, &kickstart.settings.enabled); if (kickstart.settings.enabled) { EDIT_ITEM(ICON_FanSpeed, MSG_FAN_KICKSTART_POWER, onDrawPInt8Menu, SetKickstartSpeed, &kickstart.settings.speed); @@ -3792,38 +3814,6 @@ void Draw_Tune_Menu() { } #endif - void Draw_AdvancedFan_menu() { - checkkey = Menu; - if (SET_MENU(AdvancedFanMenu, MSG_FANS_SETTINGS, 1 PLUS_TERN0(FAN_KICKSTART_MENU, 1) PLUS_TERN0(CONTROLLER_FAN_MENU, 1) PLUS_TERN0(AUTO_FAN_MENU, 3))) { - #if NONE(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) - BACK_ITEM(Draw_AdvancedSettings_Menu); - #else - BACK_ITEM(Draw_Advanced_Menu); - #endif - - #if ENABLED(FAN_KICKSTART_MENU) - MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); - #endif - - #if ENABLED(CONTROLLER_FAN_MENU) - MENU_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN, onDrawSubMenu, Draw_ControllerFan_menu); - #endif - - #if (ENABLED(AUTO_FAN_MENU)) - #if HAS_E_AUTO_FAN - EDIT_ITEM(ICON_Temperature, MSG_FAN_EXTRUDER_TEMP, onDrawPInt8Menu, SetExtruderFanThreshold, &autofans.settings.extruder_temp); - #endif - #if HAS_AUTO_CHAMBER_FAN - EDIT_ITEM(ICON_Temperature, MSG_FAN_CHAMBER_TEMP, onDrawPInt8Menu, SetChamberFanThreshold, &autofans.settings.chamber_temp); - #endif - #if HAS_AUTO_COOLER_FAN - EDIT_ITEM(ICON_Temperature, MSG_FAN_COOLER_TEMP, onDrawPInt8Menu, SetCoolerFanThreshold, &autofans.settings.cooler_temp); - #endif - #endif - } - UpdateMenu(AdvancedFanMenu); - } - #endif void Draw_Motion_Menu() { diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index ad19881981..610073ac51 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -358,6 +358,14 @@ void Draw_MaxAccel_Menu(); void Draw_GetColor_Menu(); #endif +// Controller Fan / Kickstart Menu +#if ENABLED(CONTROLLER_FAN_MENU) + void Draw_ControllerFan_menu(); +#endif +#if ENABLED(FAN_KICKSTART_MENU) + void Draw_Kickstart_menu(); +#endif + // PID #if HAS_PID_HEATING #include "../../../module/temperature.h" From 1c5f5d9afad6874921fa3da54caa6949d9d64e53 Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Sat, 28 Dec 2024 16:11:01 -0500 Subject: [PATCH 20/36] rename CALC_FAN_SPEED --- Marlin/src/feature/controllerfan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 1ddfe5010e..eab20ef16d 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -86,7 +86,7 @@ void ControllerFan::update() { * - If AutoMode is on and hot components have been powered for CONTROLLERFAN_IDLE_TIME seconds. * - If System is on idle and idle fan speed settings is activated. */ - speed = CALC_CONTROLLER_FAN_SPEED(settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) + speed = CALC_FAN_SPEED(settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) ? settings.active_speed : settings.idle_speed); #if FAN_KICKSTART_TIME From 8989ab82f2652368b559c535e8d3209316709def Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Sat, 28 Dec 2024 16:18:46 -0500 Subject: [PATCH 21/36] update configs_adv --- Marlin/Configuration_adv.h | 394 ++++++++++++++++++++++++------------- 1 file changed, 260 insertions(+), 134 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 7af866e1dd..996e59184f 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -22,7 +22,7 @@ #pragma once // Edited by classicrocker883 for ProUI -// https://github.com/classicrocker883/MriscocProUI +// https://github.com/classicrocker883/MRiscoCProUI // Created by configs generator for Professional firmware // https://github.com/mriscoc/Ender3V2S1 @@ -53,8 +53,9 @@ * 2 = config.ini - File format for PlatformIO preprocessing. * 3 = schema.json - The entire configuration schema. (13 = pattern groups) * 4 = schema.yml - The entire configuration schema. + * 5 = Config.h - Minimal configuration by popular demand. */ -//#define CONFIG_EXPORT 2 // :[1:'JSON', 2:'config.ini', 3:'schema.json', 4:'schema.yml'] +//#define CONFIG_EXPORT 2 // :[1:'JSON', 2:'config.ini', 3:'schema.json', 4:'schema.yml', 5:'Config.h'] //=========================================================================== //============================= Thermal Settings ============================ @@ -208,7 +209,7 @@ // #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control - #if ENABLED(BED_LIMIT_SWITCHING) + #if ANY(BED_LIMIT_SWITCHING, PELTIER_BED) #define BED_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > BED_HYSTERESIS #endif #endif @@ -216,18 +217,19 @@ // // Heated Chamber options // -#if DISABLED(PIDTEMPCHAMBER) - #define CHAMBER_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control - #if ENABLED(CHAMBER_LIMIT_SWITCHING) - #define CHAMBER_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > CHAMBER_HYSTERESIS - #endif -#endif #if TEMP_SENSOR_CHAMBER //#define HEATER_CHAMBER_PIN P2_04 // Required heater on/off pin (example: SKR 1.4 Turbo HE1 plug) //#define HEATER_CHAMBER_INVERTING false //#define FAN1_PIN -1 // Remove the fan signal on pin P2_04 (example: SKR 1.4 Turbo HE1 plug) + #if DISABLED(PIDTEMPCHAMBER) + #define CHAMBER_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control + #if ENABLED(CHAMBER_LIMIT_SWITCHING) + #define CHAMBER_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > CHAMBER_HYSTERESIS + #endif + #endif + //#define CHAMBER_FAN // Enable a fan on the chamber #if ENABLED(CHAMBER_FAN) //#define CHAMBER_FAN_INDEX 2 // Index of a fan to repurpose as the chamber fan. (Default: first unused fan) @@ -309,9 +311,9 @@ * If you get false positives for "Thermal Runaway", increase * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD */ -#if ENABLED(THERMAL_PROTECTION_HOTENDS) - #define THERMAL_PROTECTION_PERIOD 40 // (seconds) - #define THERMAL_PROTECTION_HYSTERESIS 4 // (°C) +#if ALL(HAS_HOTEND, THERMAL_PROTECTION_HOTENDS) + #define THERMAL_PROTECTION_PERIOD 40 // (seconds) + #define THERMAL_PROTECTION_HYSTERESIS 4 // (°C) //#define ADAPTIVE_FAN_SLOWING // Slow down the part-cooling fan if the temperature drops #if ENABLED(ADAPTIVE_FAN_SLOWING) @@ -340,7 +342,7 @@ /** * Thermal Protection parameters for the bed are just as above for hotends. */ -#if ENABLED(THERMAL_PROTECTION_BED) +#if TEMP_SENSOR_BED && ENABLED(THERMAL_PROTECTION_BED) #define THERMAL_PROTECTION_BED_PERIOD 60 // (seconds) #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // (°C) @@ -354,7 +356,7 @@ /** * Thermal Protection parameters for the heated chamber. */ -#if ENABLED(THERMAL_PROTECTION_CHAMBER) +#if TEMP_SENSOR_CHAMBER && ENABLED(THERMAL_PROTECTION_CHAMBER) #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // (seconds) #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // (°C) @@ -368,7 +370,7 @@ /** * Thermal Protection parameters for the laser cooler. */ -#if ENABLED(THERMAL_PROTECTION_COOLER) +#if TEMP_SENSOR_COOLER && ENABLED(THERMAL_PROTECTION_COOLER) #define THERMAL_PROTECTION_COOLER_PERIOD 10 // (seconds) #define THERMAL_PROTECTION_COOLER_HYSTERESIS 3 // (°C) @@ -433,7 +435,7 @@ * kf = (power_fan * eff_fan) / power_heater * 255 * where eff_fan is between 0.0 and 1.0, based on fan-efficiency and airflow to the nozzle / heater. * - * Example: + * EXAMPLE: * Heater: 40W, Fan: 0.1A * 24V = 2.4W, eff_fan = 0.8 * Kf = (2.4W * 0.8) / 40W * 255 = 12.24 * @@ -579,7 +581,7 @@ * The fan turns on automatically whenever any driver is enabled and turns * off (or reduces to idle speed) shortly after drivers are turned off. */ -#define USE_CONTROLLER_FAN +//#define USE_CONTROLLER_FAN #if ENABLED(USE_CONTROLLER_FAN) //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan //#define CONTROLLER_FAN2_PIN -1 // Set a custom pin for second controller fan @@ -597,14 +599,16 @@ // Use TEMP_SENSOR_SOC as a trigger for enabling the controller fan //#define CONTROLLER_FAN_MIN_SOC_TEMP 40 // (°C) Turn on the fan if the SoC reaches this temperature - #define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings (472 bytes of flash) + #define CONTROLLER_FAN_BED_HEATING // Turn on the fan when heating the bed + + #define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings #if ENABLED(CONTROLLER_FAN_EDITABLE) - #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu (456 bytes of flash) + #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu #endif - #define AUTO_FAN_EDITABLE // Enable M712 configurable settings (320 bytes of flash) + #define AUTO_FAN_EDITABLE // Enable M712 configurable settings #if ENABLED(AUTO_FAN_EDITABLE) - #define AUTO_FAN_MENU // Enable the Extruder Auto Fans submenu (104 bytes of flash) + #define AUTO_FAN_MENU // Enable the Extruder Auto Fans submenu #endif #endif @@ -615,13 +619,15 @@ * gets it spinning reliably for a short time before setting the requested speed. * (Does not work on Sanguinololu with FAN_SOFT_PWM.) */ -#define FAN_KICKSTART_TIME 100 // (ms) -#define FAN_KICKSTART_POWER 180 // 64-255 +//#define FAN_KICKSTART_TIME 100 // (ms) +//#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. #if FAN_KICKSTART_TIME - #define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings (320 bytes of flash) + #define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings #if ENABLED(FAN_KICKSTART_EDITABLE) - #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu (384 bytes of flash) + #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu #endif #endif // Some coolers may require a non-zero "off" state. @@ -1098,9 +1104,11 @@ #define HOME_AFTER_G34 #endif -// -// Add the G35 command to read bed corners to help adjust screws. Requires a bed probe. -// +/** + * Assisted Tramming + * + * Add the G35 command to measure bed corners and help adjust screws. Requires a bed probe. + */ //#define ASSISTED_TRAMMING #if ENABLED(ASSISTED_TRAMMING) @@ -1121,29 +1129,35 @@ //#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment /** - * Screw thread: - * M3: 30 = Clockwise, 31 = Counter-Clockwise - * M4: 40 = Clockwise, 41 = Counter-Clockwise - * M5: 50 = Clockwise, 51 = Counter-Clockwise + * Screw Thread. Use one of the following defines: + * + * M3_CW = M3 Clockwise, M3_CCW = M3 Counter-Clockwise + * M4_CW = M4 Clockwise, M4_CCW = M4 Counter-Clockwise + * M5_CW = M5 Clockwise, M5_CCW = M5 Counter-Clockwise + * + * :{'M3_CW':'M3 Clockwise','M3_CCW':'M3 Counter-Clockwise','M4_CW':'M4 Clockwise','M4_CCW':'M4 Counter-Clockwise','M5_CW':'M5 Clockwise','M5_CCW':'M5 Counter-Clockwise'} */ - #define TRAMMING_SCREW_THREAD 40 + #define TRAMMING_SCREW_THREAD M4_CW #endif // @section motion control /** - * Fixed-time-based Motion Control -- EXPERIMENTAL + * Fixed-time-based Motion Control -- BETA FEATURE * Enable/disable and set parameters with G-code M493. + * See ft_types.h for named values used by FTM options. */ //#define FT_MOTION #if ENABLED(FT_MOTION) - #define FTM_DEFAULT_MODE ftMotionMode_DISABLED // Default mode of fixed time control. (Enums in ft_types.h) - #define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (Enums in ft_types.h) - #define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers - #define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers + //#define FTM_IS_DEFAULT_MOTION // Use FT Motion as the factory default? + #define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (DISABLED, Z_BASED, MASS_BASED) + #define FTM_DEFAULT_SHAPER_X ftMotionShaper_NONE // Default shaper mode on X axis (NONE, ZV, ZVD, ZVDD, ZVDDD, EI, 2HEI, 3HEI, MZV) + #define FTM_DEFAULT_SHAPER_Y ftMotionShaper_NONE // Default shaper mode on Y axis + #define FTM_SHAPING_DEFAULT_FREQ_X 37.0f // (Hz) Default peak frequency used by input shapers + #define FTM_SHAPING_DEFAULT_FREQ_Y 37.0f // (Hz) Default peak frequency used by input shapers #define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false) - #define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain + #define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. (Acceleration-based scaling factor.) #define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis #define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis @@ -1166,18 +1180,13 @@ #define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS) #define FTM_TS 0.001f // (s) Time step for trajectory generation. (Reciprocal of FTM_FS) - // These values may be configured to adjust the duration of loop(). - #define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop() - #define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop() - #if DISABLED(COREXY) #define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update // Use this to adjust the time required to consume the command buffer. // Try increasing this value if stepper motion is choppy. #define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers - // (FTM_STEPS_PER_LOOP * FTM_POINTS_PER_LOOP) is a good start - // If you run out of memory, fall back to 3000 and increase progressively + #else // CoreXY motion needs a larger buffer size. These values are based on our testing. #define FTM_STEPPER_FS 30000 @@ -1199,29 +1208,24 @@ #endif /** - * Input Shaping -- EXPERIMENTAL + * Input Shaping * * Zero Vibration (ZV) Input Shaping for X and/or Y movements. * * This option uses a lot of SRAM for the step buffer. The buffer size is - * calculated automatically from SHAPING_FREQ_[XY], DEFAULT_AXIS_STEPS_PER_UNIT, + * calculated automatically from SHAPING_FREQ_[XYZ], DEFAULT_AXIS_STEPS_PER_UNIT, * DEFAULT_MAX_FEEDRATE and ADAPTIVE_STEP_SMOOTHING. The default calculation can * be overridden by setting SHAPING_MIN_FREQ and/or SHAPING_MAX_FEEDRATE. * The higher the frequency and the lower the feedrate, the smaller the buffer. * If the buffer is too small at runtime, input shaping will have reduced * effectiveness during high speed movements. * - * Tune with M593 D F: - * - * D Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes. - * F Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes. - * T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet) - * X<1> Set the given parameters only for the X axis. - * Y<1> Set the given parameters only for the Y axis. + * Tune with M593 D F */ //#define INPUT_SHAPING_X //#define INPUT_SHAPING_Y -#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y) +//#define INPUT_SHAPING_Z +#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y, INPUT_SHAPING_Z) #if ENABLED(INPUT_SHAPING_X) #define SHAPING_FREQ_X 40.0 // (Hz) The default dominant resonant frequency on the X axis. #define SHAPING_ZETA_X 0.15 // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). @@ -1230,6 +1234,10 @@ #define SHAPING_FREQ_Y 40.0 // (Hz) The default dominant resonant frequency on the Y axis. #define SHAPING_ZETA_Y 0.15 // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). #endif + #if ENABLED(INPUT_SHAPING_Z) + #define SHAPING_FREQ_Z 40.0 // (Hz) The default dominant resonant frequency on the Z axis. + #define SHAPING_ZETA_Z 0.15 // Damping ratio of the Z axis (range: 0.0 = no damping to 1.0 = critical damping). + #endif //#define SHAPING_MIN_FREQ 20.0 // (Hz) By default the minimum of the shaping frequencies. Override to affect SRAM usage. //#define SHAPING_MAX_STEPRATE 10000 // By default the maximum total step rate of the shaped axes. Override to affect SRAM usage. #define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. @@ -1272,12 +1280,8 @@ #define DISABLE_IDLE_E // Shut down all idle extruders // Default Minimum Feedrates for printing and travel moves -#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S. -#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T. -#if HAS_ROTATIONAL_AXES - #define DEFAULT_ANGULAR_MINIMUMFEEDRATE 0.0 // (°/s) Minimum feedrate for rotational-only moves. Set with M205 P. - #define DEFAULT_ANGULAR_MINTRAVELFEEDRATE 0.0 // (°/s) Minimum travel feedrate for rotational-only moves. Set with M205 Q. -#endif +#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S. +#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T. // Minimum time that a segment needs to take as the buffer gets emptied #define DEFAULT_MINSEGMENTTIME 50000 // (µs) Set with M205 B. @@ -1355,8 +1359,6 @@ //#define CALIBRATION_SCRIPT_PRE "M117 Starting Auto-Calibration\nT0\nG28\nG12\nM117 Calibrating..." //#define CALIBRATION_SCRIPT_POST "M500\nM117 Calibration data saved" - #define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm - #define CALIBRATION_FEEDRATE_SLOW 60 // mm/min #define CALIBRATION_FEEDRATE_FAST 1200 // mm/min #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/min @@ -1493,7 +1495,7 @@ // @section lcd #if HAS_MANUAL_MOVE_MENU - #define MANUAL_FEEDRATE { 60*60, 60*60, 8*60, 2*60 } // (mm/min) Feedrates for manual moves along X, Y, Z, E from panel + #define MANUAL_FEEDRATE { 60*60, 60*60, 10*60, 2*60 } // (mm/min) Feedrates for manual moves along X, Y, Z, E from panel #define FINE_MANUAL_MOVE 0.025 // (mm) Smallest manual move (< 0.1mm) applying to Z on most machines #if IS_ULTIPANEL #define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position" @@ -1517,24 +1519,37 @@ #define FEEDRATE_CHANGE_BEEP_FREQUENCY 440 #endif +/** + * Probe Offset Wizard + * Add a Probe Z Offset calibration option to the LCD menu. + * Use this helper to get a perfect 'M851 Z' probe offset. + * When launched this powerful wizard: + * - Measures the bed height at the configured position with the probe. + * - Moves the nozzle to the same position for a "paper" measurement. + * - The difference is used to set the probe Z offset. + */ #if HAS_BED_PROBE && ANY(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI) - //#define PROBE_OFFSET_WIZARD // Add a Probe Z Offset calibration option to the LCD menu + #define PROBE_OFFSET_WIZARD #if ENABLED(PROBE_OFFSET_WIZARD) /** * Enable to init the Probe Z-Offset when starting the Wizard. * Use a height slightly above the estimated nozzle-to-probe Z offset. * For example, with an offset of -5, consider a starting height of -4. */ - //#define PROBE_OFFSET_WIZARD_START_Z -4.0 + #define PROBE_OFFSET_WIZARD_START_Z -1.0 // Set a convenient position to do the calibration (probing point and nozzle/bed-distance) - //#define PROBE_OFFSET_WIZARD_XY_POS { X_CENTER, Y_CENTER } + #define PROBE_OFFSET_WIZARD_XY_POS { X_CENTER, Y_CENTER } #endif #endif #if HAS_MARLINUI_MENU #if HAS_BED_PROBE + + // Show Deploy / Stow Probe options in the Motion menu. + #define PROBE_DEPLOY_STOW_MENU + // Add calibration in the Probe Offsets menu to compensate for X-axis twist. //#define X_AXIS_TWIST_COMPENSATION #if ENABLED(X_AXIS_TWIST_COMPENSATION) @@ -1549,12 +1564,10 @@ #define XATC_Z_OFFSETS { 0, 0, 0 } // Z offsets for X axis sample points #endif - // Show Deploy / Stow Probe options in the Motion menu. - #define PROBE_DEPLOY_STOW_MENU #endif // Include a page of printer information in the LCD Main Menu - //#define LCD_INFO_MENU + #define LCD_INFO_MENU #if ENABLED(LCD_INFO_MENU) //#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages #endif @@ -1565,7 +1578,6 @@ * Axis moves <= 1/2 the axis length and Extruder moves <= EXTRUDE_MAXLENGTH * will be shown in the move submenus. */ - #define MANUAL_MOVE_DISTANCE_MM 10, 1.0, 0.1 // (mm) //#define MANUAL_MOVE_DISTANCE_MM 100, 50, 10, 1.0, 0.1 // (mm) //#define MANUAL_MOVE_DISTANCE_MM 500, 100, 50, 10, 1.0, 0.1 // (mm) @@ -1581,6 +1593,9 @@ // BACK menu items keep the highlight at the top //#define TURBO_BACK_MENU_ITEM + // BACK menu items show "Back" instead of the previous menu name + //#define GENERIC_BACK_MENU_ITEM + // Insert a menu for preheating at the top level to allow for quick access //#define PREHEAT_SHORTCUT_MENU_ITEM @@ -1609,7 +1624,7 @@ #if HAS_MARLINUI_U8GLIB //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash. #endif - #if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE) + #if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, HAS_MARLINUI_HD44780) #define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup. #endif #endif @@ -1644,9 +1659,6 @@ // Display a negative temperature instead of "err" //#define SHOW_TEMPERATURE_BELOW_ZERO - // Change Title Menu Text to Centered - #define TITLE_CENTERED - /** * LED Control Menu * Add LED Control to the LCD menu @@ -1742,7 +1754,7 @@ #define SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls // MRiscoC save program memory #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "G27 P2" // Use "M84XYE" to keep Z enabled so your bed stays in place + #define SD_FINISHED_RELEASECOMMAND "G27P2" // Use "M84XYE" to keep Z enabled so your bed stays in place // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -1772,9 +1784,9 @@ * an option on the LCD screen to continue the print from the last-known * point in the file. */ - //#define POWER_LOSS_RECOVERY // (3400 bytes of flash) + #define POWER_LOSS_RECOVERY // (3400 bytes of flash) #if ENABLED(POWER_LOSS_RECOVERY) - #define PLR_ENABLED_DEFAULT true // Power-Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) + #define PLR_ENABLED_DEFAULT false // Power-Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) //#define PLR_BED_THRESHOLD BED_MAXTEMP // (°C) Skip user confirmation at or above this bed temperature (0 to disable) //#define POWER_LOSS_PIN 44 // Pin to detect power-loss. Set to -1 to disable default pin on boards without module, or comment to use board default. @@ -2368,8 +2380,9 @@ * * Control extrusion rate based on instantaneous extruder velocity. Can be used to correct for * underextrusion at high extruder speeds that are otherwise well-behaved (i.e., not skipping). + * For better results also enable ADAPTIVE_STEP_SMOOTHING. */ -//#define NONLINEAR_EXTRUSION // (560 bytes of flash) +#define NONLINEAR_EXTRUSION // (560 bytes of flash) // @section leveling @@ -2509,7 +2522,8 @@ #define PTC_PARK_POS { 0, 0, 100 } // Probe position to probe and wait for probe to reach target temperature - //#define PTC_PROBE_POS { 12.0f, 7.3f } // Example: MK52 magnetic heatbed + //#define PTC_PROBE_POS { 12.0f, 7.3f } + /// EXAMPLE: MK52 magnetic heatbed #define PTC_PROBE_POS { 90, 100 } // The temperature the probe should be at while taking measurements during @@ -2595,27 +2609,28 @@ //#define MINIMUM_STEPPER_PRE_DIR_DELAY 650 /** - * Minimum stepper driver pulse width (in µs) - * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers - * 0 : Minimum 500ns for LV8729, adjusted in stepper.h - * 1 : Minimum for A4988 and A5984 stepper drivers - * 2 : Minimum for DRV8825 stepper drivers - * 3 : Minimum for TB6600 stepper drivers - * 30 : Minimum for TB6560 stepper drivers + * Minimum stepper driver pulse width (in ns) + * If undefined, these defaults (from Conditionals-4-adv.h) apply: + * 100 : Minimum for TMC2xxx stepper drivers + * 500 : Minimum for LV8729 + * 1000 : Minimum for A4988 and A5984 stepper drivers + * 2000 : Minimum for DRV8825 stepper drivers + * 3000 : Minimum for TB6600 stepper drivers + * 30000 : Minimum for TB6560 stepper drivers * * Override the default value based on the driver type set in Configuration.h. */ -//#define MINIMUM_STEPPER_PULSE 2 +//#define MINIMUM_STEPPER_PULSE_NS 2000 /** * Maximum stepping rate (in Hz) the stepper driver allows - * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) + * If undefined, these defaults (from Conditionals-4-adv.h) apply: * 5000000 : Maximum for TMC2xxx stepper drivers * 1000000 : Maximum for LV8729 stepper driver - * 500000 : Maximum for A4988 stepper driver - * 250000 : Maximum for DRV8825 stepper driver - * 150000 : Maximum for TB6600 stepper driver - * 15000 : Maximum for TB6560 stepper driver + * 500000 : Maximum for A4988 stepper driver + * 250000 : Maximum for DRV8825 stepper driver + * 150000 : Maximum for TB6600 stepper driver + * 15000 : Maximum for TB6560 stepper driver * * Override the default value based on the driver type set in Configuration.h. */ @@ -2743,7 +2758,7 @@ /** * Set the number of proportional font spaces required to fill up a typical character space. - * This can help to better align the output of commands like `G29 O` Mesh Output. + * This can help to better align the output of commands like 'G29 O' Mesh Output. * * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. * Otherwise, adjust according to your client and font. @@ -2991,12 +3006,15 @@ * Some boards have simple jumper connections! See your board's documentation. * - These drivers can also be used with Hardware Serial. * + * The TMC26XStepper library is required for TMC26X stepper drivers. + * https://github.com/MarlinFirmware/TMC26XStepper + * * The TMCStepper library is required for other TMC stepper drivers. * https://github.com/teemuatlut/TMCStepper * * @section tmc/config */ -#if HAS_TRINAMIC_CONFIG +#if HAS_TRINAMIC_CONFIG || HAS_TMC26X #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current @@ -3008,7 +3026,7 @@ #if AXIS_IS_TMC_CONFIG(X) #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. - #define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing + #define X_CURRENT_HOME X_CURRENT // (mA) RMS current for homing. (Typically lower than *_CURRENT.) #define X_MICROSTEPS 16 // 0..256 #define X_RSENSE 0.11 #define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ... @@ -3218,6 +3236,13 @@ //#define E7_HOLD_MULTIPLIER 0.5 #endif + /** + * Use the homing current for all probing. (e.g., Current may be reduced to the + * point where a collision makes the motor skip instead of damaging the bed, + * though this is unlikely to save delicate probes from being damaged. + */ + //#define PROBING_USE_CURRENT_HOME + // @section tmc/spi /** @@ -3495,7 +3520,7 @@ * A list of available functions can be found on the library github page * https://github.com/teemuatlut/TMCStepper * - * Example: + * EXAMPLE: * #define TMC_ADV() { \ * stepperX.diag0_otpw(1); \ * stepperY.intpol(0); \ @@ -3503,7 +3528,7 @@ */ #define TMC_ADV() { } -#endif // HAS_TRINAMIC_CONFIG +#endif // HAS_TRINAMIC_CONFIG || HAS_TMC26X // @section i2cbus @@ -3564,7 +3589,7 @@ //#define PHOTOGRAPH_PIN 23 // Canon Hack Development Kit - // https://web.archive.org/web/20200920094805/https://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + // https://web.archive.org/web/20200920094805/captain-slow.dk/2014/03/09/3d-printing-timelapses/ //#define CHDK_PIN 4 // Optional second move with delay to trigger the camera shutter @@ -3919,7 +3944,7 @@ /** * Extra options for the M114 "Current Position" report */ -//#define M114_DETAIL // Use 'M114' for details to check planner calculations +#define M114_DETAIL // Use 'M114' for details to check planner calculations //#define M114_REALTIME // Real current position based on forward kinematics //#define M114_LEGACY // M114 used to synchronize on every call. Enable if needed. @@ -3934,7 +3959,7 @@ /** * Auto-report temperatures with M155 S */ -#define AUTO_REPORT_TEMPERATURES +#define AUTO_REPORT_TEMPERATURES // (288 bytes of flash) #if ENABLED(AUTO_REPORT_TEMPERATURES) && TEMP_SENSOR_REDUNDANT //#define AUTO_REPORT_REDUNDANT // Include the "R" sensor in the auto-report #endif @@ -3956,7 +3981,7 @@ // Include capabilities in M115 output #define EXTENDED_CAPABILITIES_REPORT // (1000 bytes of flash) #if ENABLED(EXTENDED_CAPABILITIES_REPORT) - //#define M115_GEOMETRY_REPORT // (448 bytes of flash) MRiscoC Enabled + #define M115_GEOMETRY_REPORT // (448 bytes of flash) MRiscoC Enabled #endif #endif @@ -4299,7 +4324,8 @@ /** * Instant freeze / unfreeze functionality - * Potentially useful for emergency stop that allows being resumed. + * Potentially useful for rapid stop that allows being resumed. Halts stepper movement. + * Note this does NOT pause spindles, lasers, fans, heaters or any other auxiliary device. * @section interface */ //#define FREEZE_FEATURE @@ -4416,31 +4442,37 @@ //#define E_MUX0_PIN 40 // Always Required //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs -#elif HAS_PRUSA_MMU2 - // Serial port used for communication with MMU2. - #define MMU2_SERIAL_PORT 2 - // Use hardware reset for MMU if a pin is defined for it - //#define MMU2_RST_PIN 23 +#elif HAS_PRUSA_MMU2 || HAS_PRUSA_MMU3 + // Common settings for MMU2/MMU2S/MMU3 + // Serial port used for communication with MMU2/MMU2S/MMU3. + #define MMU_SERIAL_PORT 2 + #define MMU_BAUD 115200 + + //#define MMU_RST_PIN 23 // Define this pin to use Hardware Reset for MMU2/MMU2S/MMU3 - // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) - //#define MMU2_MODE_12V + //#define MMU_MENUS // Add an LCD menu for MMU2/MMU2S/MMU3 - // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout - #define MMU2_FILAMENT_RUNOUT_SCRIPT "M600" + //#define MMU_DEBUG // Write debug info to serial output + + // Options pertaining to MMU2 and MMU2S + #if HAS_PRUSA_MMU2 + // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) + //#define MMU2_MODE_12V - // Add an LCD menu for MMU2 - //#define MMU2_MENUS - #if ANY(MMU2_MENUS, HAS_PRUSA_MMU2S) // Settings for filament load / unload from the LCD menu. // This is for Průša MK3-style extruders. Customize for your hardware. #define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0 + + // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout + #define MMU2_FILAMENT_RUNOUT_SCRIPT "M600" + + // MMU2 sequences use mm/min. Not compatible with MMU3, which use mm/sec. #define MMU2_LOAD_TO_NOZZLE_SEQUENCE \ - { 7.2, 1145 }, \ - { 14.4, 871 }, \ - { 36.0, 1393 }, \ - { 14.4, 871 }, \ - { 50.0, 198 } + { 4.4, 871 }, \ + { 10.0, 1393 }, \ + { 4.4, 871 }, \ + { 10.0, 198 } #define MMU2_RAMMING_SEQUENCE \ { 1.0, 1000 }, \ @@ -4454,21 +4486,37 @@ { 10.0, 700 }, \ { -10.0, 400 }, \ { -50.0, 2000 } - #endif + + #endif // HAS_PRUSA_MMU2 /** - * Using a sensor like the MMU2S - * This mode requires a MK3S extruder with a sensor at the extruder idler, like the MMU2S. + * Options pertaining to MMU2S devices + * Requires the MK3S extruder with a sensor at the extruder idler, like the MMU2S. * See https://help.prusa3d.com/guide/3b-mk3s-mk2-5s-extruder-upgrade_41560#42048, step 11 */ #if HAS_PRUSA_MMU2S #define MMU2_C0_RETRY 5 // Number of retries (total time = timeout*retries) + /** + * This is called after the filament runout sensor is triggered to check if + * the filament has been loaded properly by moving the filament back and + * forth to see if the filament runout sensor is going to get triggered + * again, which should not occur if the filament is properly loaded. + * + * Thus, the MMU2_CAN_LOAD_SEQUENCE should contain some forward and + * backward moves. The forward moves should be greater than the backward + * moves. + * + * This is useless if your filament runout sensor is way behind the gears. + * In that case use {0, MMU2_CAN_LOAD_FEEDRATE} + * + * Adjust MMU2_CAN_LOAD_SEQUENCE according to your setup. + */ #define MMU2_CAN_LOAD_FEEDRATE 800 // (mm/min) #define MMU2_CAN_LOAD_SEQUENCE \ - { 0.1, MMU2_CAN_LOAD_FEEDRATE }, \ - { 60.0, MMU2_CAN_LOAD_FEEDRATE }, \ - { -52.0, MMU2_CAN_LOAD_FEEDRATE } + { 5.0, MMU2_CAN_LOAD_FEEDRATE }, \ + { 15.0, MMU2_CAN_LOAD_FEEDRATE }, \ + { -10.0, MMU2_CAN_LOAD_FEEDRATE } #define MMU2_CAN_LOAD_RETRACT 6.0 // (mm) Keep under the distance between Load Sequence values #define MMU2_CAN_LOAD_DEVIATION 0.8 // (mm) Acceptable deviation @@ -4479,10 +4527,90 @@ // Continue unloading if sensor detects filament after the initial unload move //#define MMU_IR_UNLOAD_MOVE - #else + + #elif HAS_PRUSA_MMU3 + + // MMU3 settings + + #define MMU3_HAS_CUTTER // Enable cutter related functionality + + #define MMU3_MAX_RETRIES 3 // Number of retries (total time = timeout*retries) + + // As discussed with our PrusaSlicer profile specialist + // - ToolChange shall not try to push filament into the very tip of the nozzle + // to have some space for additional G-code to tune the extruded filament length + // in the profile + // Beware - this value is used to initialize the MMU logic layer - it will be sent to the MMU upon line up (written into its 8bit register 0x0b) + // However - in the G-code we can get a request to set the extra load distance at runtime to something else (M708 A0xb Xsomething). + // The printer intercepts such a call and sets its extra load distance to match the new value as well. + #define MMU3_FILAMENT_SENSOR_E_POSITION 0 // (mm) + #define _MMU3_LOAD_DISTANCE_PAST_GEARS 5 // (mm) + #define MMU3_TOOL_CHANGE_LOAD_LENGTH (MMU3_FILAMENT_SENSOR_E_POSITION + _MMU3_LOAD_DISTANCE_PAST_GEARS) // (mm) + + #define MMU3_LOAD_TO_NOZZLE_FEED_RATE 20.0 // (mm/s) + + #define MMU3_VERIFY_LOAD_TO_NOZZLE_FEED_RATE 50.0 // (mm/s) + #define _MMU3_VERIFY_LOAD_TO_NOZZLE_TWEAK -5.0 // (mm) Amount to adjust the length for verifying load-to-nozzle + + // The first thing the MMU does is initialize its axis. + // Meanwhile the E-motor will unload 20mm of filament in about 1 second. + #define MMU3_RETRY_UNLOAD_TO_FINDA_LENGTH 80.0 // (mm) + #define MMU3_RETRY_UNLOAD_TO_FINDA_FEED_RATE 80.0 // (mm/s) + + // After loading a new filament, the printer will extrude this length of filament + // then retract to the original position. This is used to check if the filament sensor + // reading flickers or filament is jammed. + #define _MMU_EXTRUDER_PTFE_LENGTH 42.3 // (mm) + #define _MMU_EXTRUDER_HEATBREAK_LENGTH 17.7 // (mm) + #define MMU3_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH (MMU3_FILAMENT_SENSOR_E_POSITION + _MMU_EXTRUDER_PTFE_LENGTH + _MMU_EXTRUDER_HEATBREAK_LENGTH + _MMU3_VERIFY_LOAD_TO_NOZZLE_TWEAK) // (mm) /** - * MMU1 Extruder Sensor + * SpoolJoin Consumes All Filament -- EXPERIMENTAL + * + * SpoolJoin normally triggers when FINDA sensor untriggers while printing. + * This is the default behaviour and it doesn't consume all the filament + * before triggering a filament change. This leaves some filament in the + * current slot and before switching to the next slot it is unloaded. + * + * Enabling this option will trigger the filament change when both FINDA + * and Filament Runout Sensor triggers during the print and it allows the + * filament in the current slot to be completely consumed before doing the + * filament change. But this can cause problems as a little bit of filament + * will be left between the extruder gears (thinking that the filament + * sensor is triggered through the gears) and the end of the PTFE tube and + * can cause filament load issues. + */ + //#define MMU3_SPOOL_JOIN_CONSUMES_ALL_FILAMENT + + // MMU3 sequences use mm/sec. Not compatible with MMU2 which use mm/min. + #define MMU3_LOAD_TO_NOZZLE_SEQUENCE \ + { _MMU_EXTRUDER_PTFE_LENGTH, MMM_TO_MMS(810) }, /* (13.5 mm/s) Fast load ahead of heatbreak */ \ + { _MMU_EXTRUDER_HEATBREAK_LENGTH, MMM_TO_MMS(198) } /* ( 3.3 mm/s) Slow load after heatbreak */ + + #define MMU3_RAMMING_SEQUENCE \ + { 0.2816, MMM_TO_MMS(1339.0) }, \ + { 0.3051, MMM_TO_MMS(1451.0) }, \ + { 0.3453, MMM_TO_MMS(1642.0) }, \ + { 0.3990, MMM_TO_MMS(1897.0) }, \ + { 0.4761, MMM_TO_MMS(2264.0) }, \ + { 0.5767, MMM_TO_MMS(2742.0) }, \ + { 0.5691, MMM_TO_MMS(3220.0) }, \ + { 0.1081, MMM_TO_MMS(3220.0) }, \ + { 0.7644, MMM_TO_MMS(3635.0) }, \ + { 0.8248, MMM_TO_MMS(3921.0) }, \ + { 0.8483, MMM_TO_MMS(4033.0) }, \ + { -15.0, MMM_TO_MMS(6000.0) }, \ + { -24.5, MMM_TO_MMS(1200.0) }, \ + { -7.0, MMM_TO_MMS( 600.0) }, \ + { -3.5, MMM_TO_MMS( 360.0) }, \ + { 20.0, MMM_TO_MMS( 454.0) }, \ + { -20.0, MMM_TO_MMS( 303.0) }, \ + { -35.0, MMM_TO_MMS(2000.0) } + + #else // MMU2 (not MMU2S) + + /** + * MMU2 Extruder Sensor * * Support for a Průša (or other) IR Sensor to detect filament near the extruder * and make loading more reliable. Suitable for an extruder equipped with a filament @@ -4492,16 +4620,14 @@ * move up to the gears. If no filament is detected, the MMU2 can make some more attempts. * If all attempts fail, a filament runout will be triggered. */ - //#define MMU_EXTRUDER_SENSOR - #if ENABLED(MMU_EXTRUDER_SENSOR) - #define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail + //#define MMU2_EXTRUDER_SENSOR + #if ENABLED(MMU2_EXTRUDER_SENSOR) + #define MMU2_LOADING_ATTEMPTS_NR 5 // Number of times to try loading filament before failure #endif #endif - //#define MMU2_DEBUG // Write debug info to serial output - -#endif // HAS_PRUSA_MMU2 +#endif // HAS_PRUSA_MMU2 || HAS_PRUSA_MMU3 /** * Advanced Print Counter settings From 1f803bbffe64b858b4f5f8b88ed9965215531b09 Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Sun, 29 Dec 2024 08:04:05 -0500 Subject: [PATCH 22/36] fix errors, rearrange - update --- Marlin/Configuration_adv.h | 38 +++++++++++++---------- Marlin/src/feature/autofans.h | 8 +++-- Marlin/src/feature/controllerfan.cpp | 11 +++---- Marlin/src/feature/kickstart.h | 11 +++++-- Marlin/src/module/planner.cpp | 46 ++++++++++++++-------------- Marlin/src/module/planner.h | 2 +- Marlin/src/module/settings.cpp | 40 +++++++++++++++--------- 7 files changed, 89 insertions(+), 67 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 996e59184f..f10b03cadc 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -605,12 +605,6 @@ #if ENABLED(CONTROLLER_FAN_EDITABLE) #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu #endif - - #define AUTO_FAN_EDITABLE // Enable M712 configurable settings - #if ENABLED(AUTO_FAN_EDITABLE) - #define AUTO_FAN_MENU // Enable the Extruder Auto Fans submenu - #endif - #endif /** @@ -623,13 +617,11 @@ //#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. - -#if FAN_KICKSTART_TIME - #define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings - #if ENABLED(FAN_KICKSTART_EDITABLE) - #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu - #endif +//#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 @@ -695,18 +687,22 @@ #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 // Ender3V2 Configs +#define E0_AUTO_FAN_PIN -1//PC0 // Ender3V2 Configs #define E1_AUTO_FAN_PIN -1 #define E2_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1 @@ -718,12 +714,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 * diff --git a/Marlin/src/feature/autofans.h b/Marlin/src/feature/autofans.h index b8749adf3b..5748e629fd 100644 --- a/Marlin/src/feature/autofans.h +++ b/Marlin/src/feature/autofans.h @@ -21,11 +21,12 @@ #pragma once #include "../inc/MarlinConfigPre.h" +#if HAS_AUTO_FAN typedef struct { - uint8_t extruder_temp; // Auto fans temperature thresholds - uint8_t chamber_temp; - uint8_t cooler_temp; + uint8_t extruder_temp; // Auto fans temperature thresholds + uint8_t chamber_temp; + uint8_t cooler_temp; } autofans_settings_t; #ifndef EXTRUDER_AUTO_FAN_TEMPERATURE @@ -64,3 +65,4 @@ extern Autofans autofans; #define COOLER_AUTO_FAN_TEMPERATURE (autofans.settings.cooler_temp) #endif +#endif \ No newline at end of file diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index eab20ef16d..9dc2b843da 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -89,22 +89,20 @@ void ControllerFan::update() { speed = CALC_FAN_SPEED(settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) ? settings.active_speed : settings.idle_speed); - #if FAN_KICKSTART_TIME - static millis_t fan_kick_end = 0; - #if ENABLED(FAN_KICKSTART_EDITABLE) + static millis_t fan_kick_end = 0; + #if ENABLED(FAN_KICKSTART_EDITABLE) if (speed > FAN_OFF_PWM && kickstart.settings.enabled) { if (!fan_kick_end) { fan_kick_end = ms + kickstart.settings.duration_ms; 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)) - { + 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 + #else if (speed > FAN_OFF_PWM) { if (!fan_kick_end) { fan_kick_end = ms + FAN_KICKSTART_TIME; @@ -119,7 +117,6 @@ void ControllerFan::update() { #endif else fan_kick_end = 0; - #endif #if ENABLED(FAN_SOFT_PWM) soft_pwm_speed = speed; diff --git a/Marlin/src/feature/kickstart.h b/Marlin/src/feature/kickstart.h index e91e93c411..fc2ce649dc 100644 --- a/Marlin/src/feature/kickstart.h +++ b/Marlin/src/feature/kickstart.h @@ -22,20 +22,27 @@ #include "../inc/MarlinConfigPre.h" +#if ENABLED(FAN_KICKSTART_EDITABLE) + typedef struct { uint16_t duration_ms; // Duration in milliseconds for the fan to run at kickstart speed uint8_t speed; // 0-255 (fullspeed); Fans first start 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 }; -#if ENABLED(FAN_KICKSTART_EDITABLE) - class Kickstart { public: static kickstart_settings_t settings; diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 902c9f6456..f72e2da1f9 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1180,7 +1180,7 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { /** * Apply fan speeds */ -#if HAS_FAN +#if HAS_FAN || ENABLED(FAN_KICKSTART_EDITABLE) void Planner::sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]) { @@ -1198,35 +1198,35 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { TERN_(HAS_FAN6, FAN_SET(6)); TERN_(HAS_FAN7, FAN_SET(7)); } - #if FAN_KICKSTART_TIME + #ifdef FAN_KICKSTART_TIME void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) { #if ENABLED(FAN_KICKSTART_EDITABLE) - if (!kickstart.settings.enabled) return; + if (!kickstart.settings.enabled) return; - static millis_t fan_kick_end[FAN_COUNT] = { 0 }; - if (fan_speed[f] > FAN_OFF_PWM) { - if (fan_kick_end[f] == 0) { - fan_kick_end[f] = ms + kickstart.settings.duration_ms; - fan_speed[f] = kickstart.settings.speed; + static millis_t fan_kick_end[FAN_COUNT] = { 0 }; + if (fan_speed[f] > FAN_OFF_PWM) { + if (fan_kick_end[f] == 0) { + fan_kick_end[f] = ms + kickstart.settings.duration_ms; + fan_speed[f] = kickstart.settings.speed; + } + else if (PENDING(ms, fan_kick_end[f])) + fan_speed[f] = kickstart.settings.speed; } - else if (PENDING(ms, fan_kick_end[f])) - fan_speed[f] = kickstart.settings.speed; - } #else - static millis_t fan_kick_end[FAN_COUNT] = { 0 }; - #if ENABLED(FAN_KICKSTART_LINEAR) - static uint8_t set_fan_speed[FAN_COUNT] = { 0 }; - #endif - if (fan_speed[f] > FAN_OFF_PWM) { - const bool first_kick = fan_kick_end[f] == 0 && TERN1(FAN_KICKSTART_LINEAR, fan_speed[f] > set_fan_speed[f]); - if (first_kick) - fan_kick_end[f] = ms + (FAN_KICKSTART_TIME) TERN_(FAN_KICKSTART_LINEAR, * (fan_speed[f] - set_fan_speed[f]) / 255); - if (first_kick || PENDING(ms, fan_kick_end[f])) { - fan_speed[f] = FAN_KICKSTART_POWER; - return; + static millis_t fan_kick_end[FAN_COUNT] = { 0 }; + #if ENABLED(FAN_KICKSTART_LINEAR) + static uint8_t set_fan_speed[FAN_COUNT] = { 0 }; + #endif + if (fan_speed[f] > FAN_OFF_PWM) { + const bool first_kick = fan_kick_end[f] == 0 && TERN1(FAN_KICKSTART_LINEAR, fan_speed[f] > set_fan_speed[f]); + if (first_kick) + fan_kick_end[f] = ms + (FAN_KICKSTART_TIME) TERN_(FAN_KICKSTART_LINEAR, * (fan_speed[f] - set_fan_speed[f]) / 255); + if (first_kick || PENDING(ms, fan_kick_end[f])) { + fan_speed[f] = FAN_KICKSTART_POWER; + return; + } } - } #endif fan_kick_end[f] = 0; TERN_(FAN_KICKSTART_LINEAR, set_fan_speed[f] = fan_speed[f]); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 359d1161b0..6bf74807fe 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -641,7 +641,7 @@ class Planner { // Apply fan speeds #if HAS_FAN static void sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]); - #if FAN_KICKSTART_TIME + #if FAN_KICKSTART_TIME || ENABLED(FAN_KICKSTART_EDITABLE) static void kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f); #else FORCE_INLINE static void kickstart_fan(uint8_t (&)[FAN_COUNT], const millis_t &, const uint8_t) {} diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index a48eb8658e..4861e3efd6 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -141,11 +141,15 @@ #include "../feature/probe_temp_comp.h" #endif -#include "../feature/controllerfan.h" - -#include "../feature/kickstart.h" - -#include "../feature/autofans.h" +#if ENABLED(CONTROLLER_FAN_EDITABLE) + #include "../feature/controllerfan.h" +#endif +#if ENABLED(FAN_KICKSTART_EDITABLE) + #include "../feature/kickstart.h" +#endif +#if HAS_AUTO_FAN + #include "../feature/autofans.h" +#endif #if ENABLED(CASE_LIGHT_ENABLE) #include "../feature/caselight.h" @@ -471,24 +475,24 @@ typedef struct SettingsDataStruct { #endif // - // Fan Kickstart settings + // Controller fan // - #ifdef FAN_KICKSTART_TIME - kickstart_settings_t kickstart_settings; // M711 + #if ENABLED(USE_CONTROLLER_FAN) + controllerFan_settings_t controllerFan_settings; // M710 #endif // - // Auto Fans settings + // Fan Kickstart settings // - #if ENABLED(AUTO_FAN_EDITABLE) - autofans_settings_t autofans_settings; // M712 + #if ENABLED(FAN_KICKSTART_EDITABLE) + kickstart_settings_t kickstart_settings; // M711 #endif // - // Controller fan + // Auto Fans settings // - #if ENABLED(USE_CONTROLLER_FAN) - controllerFan_settings_t controllerFan_settings; // M710 + #if HAS_AUTO_FAN + autofans_settings_t autofans_settings; // M712 #endif // @@ -1427,6 +1431,7 @@ void MarlinSettings::postprocess() { // // Fan Kickstart // + #if ENABLED(FAN_KICKSTART_EDITABLE) { _FIELD_TEST(kickstart_settings); #if ENABLED(FAN_KICKSTART_EDITABLE) @@ -1436,10 +1441,12 @@ void MarlinSettings::postprocess() { #endif EEPROM_WRITE(fks); } + #endif // // Auto Fans // + #if HAS_AUTO_FAN { _FIELD_TEST(autofans_settings); #if ENABLED(AUTO_FAN_EDITABLE) @@ -1449,6 +1456,7 @@ void MarlinSettings::postprocess() { #endif EEPROM_WRITE(eauto); } + #endif // // Power-Loss Recovery @@ -2578,22 +2586,26 @@ void MarlinSettings::postprocess() { // // Fan Kickstart // + #if ENABLED(FAN_KICKSTART_EDITABLE) { kickstart_settings_t fks = { 0 }; _FIELD_TEST(kickstart_settings); EEPROM_READ(fks); TERN_(FAN_KICKSTART_EDITABLE, if (!validating) kickstart.settings = fks); } + #endif // // Auto Fans // + #if HAS_AUTO_FAN { autofans_settings_t eauto = { 0 }; _FIELD_TEST(autofans_settings); EEPROM_READ(eauto); TERN_(AUTO_FAN_EDITABLE, if (!validating) autofans.settings = eauto); } + #endif // // Power-Loss Recovery From 3f26c7e546120bf5a5e50fb4387862f7e523737c Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Mon, 30 Dec 2024 10:10:14 -0500 Subject: [PATCH 23/36] Update BTT SKR Mini configs --- .../BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h | 25 ++++++++++++++++--- .../UBL/Configuration_adv.h | 25 ++++++++++++++++--- .../BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h | 25 ++++++++++++++++--- .../UBL/Configuration_adv.h | 25 ++++++++++++++++--- 4 files changed, 84 insertions(+), 16 deletions(-) diff --git a/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h index 4057656f6d..4a52bf342e 100644 --- a/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h @@ -588,6 +588,7 @@ //#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_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 @@ -616,6 +617,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 @@ -682,16 +687,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 + * 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 @@ -705,12 +714,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 * diff --git a/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h index e3c673ef9c..8f88a7c080 100644 --- a/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h @@ -588,6 +588,7 @@ //#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_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 @@ -616,6 +617,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 @@ -682,16 +687,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 + * 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 @@ -705,12 +714,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 * diff --git a/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h index 22a00c09ab..822e60f295 100644 --- a/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h @@ -588,6 +588,7 @@ //#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_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 @@ -616,6 +617,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 @@ -682,16 +687,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 + * 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 FAN1_PIN #define E1_AUTO_FAN_PIN -1 @@ -705,12 +714,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 * diff --git a/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h index 22a00c09ab..822e60f295 100644 --- a/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h @@ -588,6 +588,7 @@ //#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_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 @@ -616,6 +617,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 @@ -682,16 +687,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 + * 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 FAN1_PIN #define E1_AUTO_FAN_PIN -1 @@ -705,12 +714,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 * From ad674b8c0c9204889cd8d828412e185bd5816831 Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Mon, 30 Dec 2024 10:11:29 -0500 Subject: [PATCH 24/36] Update feature/controllerfan --- Marlin/src/feature/controllerfan.cpp | 26 +++++++++++++++++++++----- Marlin/src/feature/controllerfan.h | 1 + 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 9dc2b843da..12fb28b93a 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -54,6 +54,10 @@ void ControllerFan::setup() { init(); } +void ControllerFan::set_fan_speed(const uint8_t s) { + speed = s < (CONTROLLERFAN_SPEED_MIN) ? 0 : s; // Fan OFF below minimum +} + void ControllerFan::update() { static millis_t lastComponentOn = 0, // Last time a stepper, heater, etc. was turned on nextFanCheck = 0; // Last time the state was checked @@ -86,11 +90,20 @@ void ControllerFan::update() { * - If AutoMode is on and hot components have been powered for CONTROLLERFAN_IDLE_TIME seconds. * - If System is on idle and idle fan speed settings is activated. */ - speed = CALC_FAN_SPEED(settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) - ? settings.active_speed : settings.idle_speed); + #if ENABLED(FAN_KICKSTART_EDITABLE) + speed = CALC_FAN_SPEED(settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) + ? settings.active_speed : settings.idle_speed); + #else + set_fan_speed( + settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) + ? settings.active_speed : settings.idle_speed + ); + + speed = CALC_FAN_SPEED(speed); + #endif - static millis_t fan_kick_end = 0; #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_ms; @@ -102,7 +115,10 @@ void ControllerFan::update() { nextFanCheck = ms + 20UL; // reduce update interval for controller fn check while Kickstart is active. } } - #else + 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; @@ -114,9 +130,9 @@ void ControllerFan::update() { nextFanCheck = ms + 20UL; // reduce update interval for controller fn check while Kickstart is active. } } - #endif else fan_kick_end = 0; + #endif #if ENABLED(FAN_SOFT_PWM) soft_pwm_speed = speed; diff --git a/Marlin/src/feature/controllerfan.h b/Marlin/src/feature/controllerfan.h index 431990a977..68502afa66 100644 --- a/Marlin/src/feature/controllerfan.h +++ b/Marlin/src/feature/controllerfan.h @@ -52,6 +52,7 @@ static constexpr controllerFan_settings_t controllerFan_defaults = { class ControllerFan { private: static uint8_t speed; + static void set_fan_speed(const uint8_t s); public: #if ENABLED(CONTROLLER_FAN_EDITABLE) From bd7361a491537eb605c7f0ec03646151c6c3e867 Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Mon, 30 Dec 2024 23:54:44 -0500 Subject: [PATCH 25/36] arrange and define changes --- Marlin/Configuration_adv.h | 6 +++--- Marlin/src/feature/autofans.h | 31 ++++++++++++++-------------- Marlin/src/feature/controllerfan.cpp | 23 ++++++++------------- Marlin/src/feature/kickstart.h | 2 +- Marlin/src/inc/Conditionals-5-post.h | 16 ++++---------- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- Marlin/src/module/settings.cpp | 18 +++++++++------- ini/features.ini | 4 ++-- 8 files changed, 47 insertions(+), 55 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index f10b03cadc..dd30fc39ac 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -601,7 +601,7 @@ #define CONTROLLER_FAN_BED_HEATING // Turn on the fan when heating the bed - #define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings + //#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings #if ENABLED(CONTROLLER_FAN_EDITABLE) #define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu #endif @@ -617,7 +617,7 @@ //#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 +//#define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings #if ENABLED(FAN_KICKSTART_EDITABLE) #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu #endif @@ -723,7 +723,7 @@ /** * Allow Auto Cooling Fans to be editable */ -//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings +//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings #if ENABLED(AUTO_FAN_EDITABLE) #define AUTO_FAN_MENU // Enable the Editable Auto Fans submenu #endif diff --git a/Marlin/src/feature/autofans.h b/Marlin/src/feature/autofans.h index 5748e629fd..958281d73a 100644 --- a/Marlin/src/feature/autofans.h +++ b/Marlin/src/feature/autofans.h @@ -21,6 +21,7 @@ #pragma once #include "../inc/MarlinConfigPre.h" + #if HAS_AUTO_FAN typedef struct { @@ -45,24 +46,24 @@ static constexpr autofans_settings_t autofans_defaults = { COOLER_AUTO_FAN_TEMPERATURE }; -#if ENABLED(AUTO_FAN_EDITABLE) + #if ENABLED(AUTO_FAN_EDITABLE) -class Autofans { - public: - static autofans_settings_t settings; + class Autofans { + public: + static autofans_settings_t settings; - static void reset() { TERN_(AUTO_FAN_EDITABLE, settings = autofans_defaults); } - static void setup() { reset(); } -}; + static void reset() { settings = autofans_defaults; } + static void setup() { reset(); } + }; -extern Autofans autofans; + 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) + #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 + #endif #endif \ No newline at end of file diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 12fb28b93a..0061cbc629 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -90,17 +90,12 @@ void ControllerFan::update() { * - If AutoMode is on and hot components have been powered for CONTROLLERFAN_IDLE_TIME seconds. * - If System is on idle and idle fan speed settings is activated. */ - #if ENABLED(FAN_KICKSTART_EDITABLE) - speed = CALC_FAN_SPEED(settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) - ? settings.active_speed : settings.idle_speed); - #else - set_fan_speed( - settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) - ? settings.active_speed : settings.idle_speed - ); + set_fan_speed( + settings.auto_mode && lastComponentOn && PENDING(ms, lastComponentOn + SEC_TO_MS(settings.duration)) + ? settings.active_speed : settings.idle_speed + ); - speed = CALC_FAN_SPEED(speed); - #endif + speed = CALC_FAN_SPEED(speed); #if ENABLED(FAN_KICKSTART_EDITABLE) static millis_t fan_kick_end = 0; @@ -108,11 +103,11 @@ void ControllerFan::update() { if (!fan_kick_end) { fan_kick_end = ms + kickstart.settings.duration_ms; 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. + 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. + nextFanCheck = ms + 20UL; // Reduce update interval for controller fn check while Kickstart is active. } } else @@ -123,11 +118,11 @@ void ControllerFan::update() { if (!fan_kick_end) { 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. + nextFanCheck = ms + 20UL; // Reduce update interval for controller fn check while Kickstart is active. } 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. + nextFanCheck = ms + 20UL; // Reduce update interval for controller fn check while Kickstart is active. } } else diff --git a/Marlin/src/feature/kickstart.h b/Marlin/src/feature/kickstart.h index fc2ce649dc..a7d1ead952 100644 --- a/Marlin/src/feature/kickstart.h +++ b/Marlin/src/feature/kickstart.h @@ -47,7 +47,7 @@ class Kickstart { public: static kickstart_settings_t settings; - static void reset() { TERN_(FAN_KICKSTART_EDITABLE, settings = kickstart_defaults); } + static void reset() { settings = kickstart_defaults; } static void setup() { reset(); } }; diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index 423c857263..8a87a9931b 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -2729,12 +2729,8 @@ #endif #if !HAS_AUTO_FAN - #ifdef AUTO_FAN_MENU - #undef AUTO_FAN_MENU - #endif - #ifdef AUTO_FAN_EDITABLE - #undef AUTO_FAN_EDITABLE - #endif + #undef AUTO_FAN_MENU + #undef AUTO_FAN_EDITABLE #endif // Fans check @@ -2816,12 +2812,8 @@ #undef CONTROLLER_FAN_TRIGGER_TEMP #endif #else - #ifdef CONTROLLER_FAN_MENU - #undef CONTROLLER_FAN_MENU - #endif - #ifdef CONTROLLER_FAN_EDITABLE - #undef CONTROLLER_FAN_EDITABLE - #endif + #undef CONTROLLER_FAN_MENU + #undef CONTROLLER_FAN_EDITABLE #endif /** diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 9f843ad9b7..4dc10f803e 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -327,7 +327,7 @@ MenuClass *MaxAccelMenu = nullptr; #if HAS_TRINAMIC_CONFIG MenuClass *TrinamicConfigMenu = nullptr; #endif -#if ANY(CONTROLLER_FAN_MENU, EXTRUDER_AUTO_FAN_MENU, FAN_KICKSTART_MENU) +#if ANY(CONTROLLER_FAN_MENU, AUTO_FAN_MENU, FAN_KICKSTART_MENU) MenuClass *AdvancedFanMenu = nullptr; #endif #if ENABLED(CONTROLLER_FAN_MENU) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 4861e3efd6..86ad1baae9 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -141,10 +141,10 @@ #include "../feature/probe_temp_comp.h" #endif -#if ENABLED(CONTROLLER_FAN_EDITABLE) +#if ENABLED(USE_CONTROLLER_FAN) #include "../feature/controllerfan.h" #endif -#if ENABLED(FAN_KICKSTART_EDITABLE) +#if FAN_KICKSTART_TIME #include "../feature/kickstart.h" #endif #if HAS_AUTO_FAN @@ -484,8 +484,8 @@ typedef struct SettingsDataStruct { // // Fan Kickstart settings // - #if ENABLED(FAN_KICKSTART_EDITABLE) - kickstart_settings_t kickstart_settings; // M711 + #if FAN_KICKSTART_TIME + kickstart_settings_t kickstart_settings; // M711 #endif // @@ -1423,7 +1423,11 @@ void MarlinSettings::postprocess() { #if ENABLED(USE_CONTROLLER_FAN) { _FIELD_TEST(controllerFan_settings); - const controllerFan_settings_t &cfs = controllerFan.settings; + #if ENABLED(CONTROLLER_FAN_EDITABLE) + const controllerFan_settings_t &cfs = controllerFan.settings; + #else + constexpr controllerFan_settings_t cfs = controllerFan_defaults; + #endif EEPROM_WRITE(cfs); } #endif @@ -1431,7 +1435,7 @@ void MarlinSettings::postprocess() { // // Fan Kickstart // - #if ENABLED(FAN_KICKSTART_EDITABLE) + #if FAN_KICKSTART_TIME { _FIELD_TEST(kickstart_settings); #if ENABLED(FAN_KICKSTART_EDITABLE) @@ -2586,7 +2590,7 @@ void MarlinSettings::postprocess() { // // Fan Kickstart // - #if ENABLED(FAN_KICKSTART_EDITABLE) + #if FAN_KICKSTART_TIME { kickstart_settings_t fks = { 0 }; _FIELD_TEST(kickstart_settings); diff --git a/ini/features.ini b/ini/features.ini index f8d52223c7..107732ef4d 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -225,8 +225,6 @@ CANCEL_OBJECTS = build_src_filter=+ + EXTERNAL_CLOSED_LOOP_CONTROLLER = build_src_filter=+ + USE_CONTROLLER_FAN = build_src_filter=+ -FAN_KICKSTART_EDITABLE = build_src_filter=+ + -AUTO_FAN_EDITABLE = build_src_filter=+ + HAS_COOLER|LASER_COOLANT_FLOW_METER = build_src_filter=+ HAS_MOTOR_CURRENT_DAC = build_src_filter=+ DIRECT_STEPPING = build_src_filter=+ + @@ -310,6 +308,8 @@ FT_MOTION = build_src_filter=+ PHOTO_GCODE = build_src_filter=+ CONTROLLER_FAN_EDITABLE = build_src_filter=+ +FAN_KICKSTART_EDITABLE = build_src_filter=+ + +AUTO_FAN_EDITABLE = build_src_filter=+ + HAS_ZV_SHAPING = build_src_filter=+ GCODE_MACROS = build_src_filter=+ GRADIENT_MIX = build_src_filter=+ From 81ec1c000f00a9c6d5c2fc57dc5a75e345775e3b Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Thu, 2 Jan 2025 04:06:25 -0500 Subject: [PATCH 26/36] Update - check-pr.yml --- .github/workflows/check-pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 347cfd3933..afe5c568f5 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -8,6 +8,8 @@ name: PR Bad Target on: pull_request_target: types: [opened] + branches: + - 2024-* jobs: bad_target: @@ -17,9 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Close invalid PR - if: ${{ github.event.pull_request.base.ref != '2024-December' }} - uses: superbrothers/close-pull-request@v3.1.2 + - uses: superbrothers/close-pull-request@v3.1.2 with: comment: > Thanks for your contribution! From e859eff6914236ac5280b9750af508f60cc3c357 Mon Sep 17 00:00:00 2001 From: classicrocker883 Date: Sun, 19 Jan 2025 21:54:24 -0500 Subject: [PATCH 27/36] config addons --- Marlin/src/module/planner.cpp | 2 +- configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h | 4 ++-- configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h | 4 ++-- configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index f72e2da1f9..2abb1d5790 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1198,7 +1198,7 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { TERN_(HAS_FAN6, FAN_SET(6)); TERN_(HAS_FAN7, FAN_SET(7)); } - #ifdef FAN_KICKSTART_TIME + #if FAN_KICKSTART_TIME void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) { #if ENABLED(FAN_KICKSTART_EDITABLE) diff --git a/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h index e2bbbc3a97..ca4807d982 100644 --- a/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h @@ -619,7 +619,7 @@ //#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 +#define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings #if ENABLED(FAN_KICKSTART_EDITABLE) #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu #endif @@ -725,7 +725,7 @@ /** * Allow Auto Cooling Fans to be editable */ -//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings +#define AUTO_FAN_EDITABLE // Enable M712 configurable settings #if ENABLED(AUTO_FAN_EDITABLE) #define AUTO_FAN_MENU // Enable the Editable Auto Fans submenu #endif diff --git a/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h index fff491213c..bad6505dc9 100644 --- a/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h @@ -619,7 +619,7 @@ //#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 +#define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings #if ENABLED(FAN_KICKSTART_EDITABLE) #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu #endif @@ -725,7 +725,7 @@ /** * Allow Auto Cooling Fans to be editable */ -//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings +#define AUTO_FAN_EDITABLE // Enable M712 configurable settings #if ENABLED(AUTO_FAN_EDITABLE) #define AUTO_FAN_MENU // Enable the Editable Auto Fans submenu #endif diff --git a/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h index fff491213c..bad6505dc9 100644 --- a/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h @@ -619,7 +619,7 @@ //#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 +#define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings #if ENABLED(FAN_KICKSTART_EDITABLE) #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu #endif @@ -725,7 +725,7 @@ /** * Allow Auto Cooling Fans to be editable */ -//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings +#define AUTO_FAN_EDITABLE // Enable M712 configurable settings #if ENABLED(AUTO_FAN_EDITABLE) #define AUTO_FAN_MENU // Enable the Editable Auto Fans submenu #endif From c2526a99f01b43b403b4feb52533d1814aaf6481 Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Fri, 29 Aug 2025 18:12:20 -0400 Subject: [PATCH 28/36] Update check-pr.yml date --- .github/workflows/check-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 0328743bce..a5858a1f06 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -9,7 +9,7 @@ on: pull_request_target: types: [opened] branches: - - 2024-* + - 2025-* jobs: bad_target: From 02561e9dcb18e0fdc1dd4dc3c167eedcf77d064f Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 30 Aug 2025 00:46:45 -0400 Subject: [PATCH 29/36] revert configs --- .../BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h | 25 +++---------------- .../UBL/Configuration_adv.h | 25 +++---------------- .../BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h | 25 +++---------------- .../UBL/Configuration_adv.h | 25 +++---------------- 4 files changed, 16 insertions(+), 84 deletions(-) diff --git a/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h index 34e08b4a24..85c221f49e 100644 --- a/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V2/MM/Configuration_adv.h @@ -590,7 +590,6 @@ //#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_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 @@ -619,10 +618,6 @@ //#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 @@ -689,20 +684,16 @@ #endif /** - * Cooling fans + * Extruder cooling fans * - * Fans automatically turn on when their - * temperatures go above threshold. + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. * * 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 @@ -716,20 +707,12 @@ #define COOLER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed #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 * diff --git a/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h index d35243a02f..89cd6a4339 100644 --- a/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V2/UBL/Configuration_adv.h @@ -590,7 +590,6 @@ //#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_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 @@ -619,10 +618,6 @@ //#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 @@ -689,20 +684,16 @@ #endif /** - * Cooling fans + * Extruder cooling fans * - * Fans automatically turn on when their - * temperatures go above threshold. + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. * * 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 @@ -716,20 +707,12 @@ #define COOLER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed #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 * diff --git a/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h index 44e6c6deb8..7a7ec70300 100644 --- a/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V3/MM/Configuration_adv.h @@ -590,7 +590,6 @@ //#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_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 @@ -619,10 +618,6 @@ //#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 @@ -689,20 +684,16 @@ #endif /** - * Cooling fans + * Extruder cooling fans * - * Fans automatically turn on when their - * temperatures go above threshold. + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. * * 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 FAN1_PIN #define E1_AUTO_FAN_PIN -1 @@ -716,20 +707,12 @@ #define COOLER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed #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 * diff --git a/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h b/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h index 44e6c6deb8..7a7ec70300 100644 --- a/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h +++ b/configurations/BTT_SKR-Mini-E3-V3/UBL/Configuration_adv.h @@ -590,7 +590,6 @@ //#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_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 @@ -619,10 +618,6 @@ //#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 @@ -689,20 +684,16 @@ #endif /** - * Cooling fans + * Extruder cooling fans * - * Fans automatically turn on when their - * temperatures go above threshold. + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. * * 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 FAN1_PIN #define E1_AUTO_FAN_PIN -1 @@ -716,20 +707,12 @@ #define COOLER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed #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 * From 8cb23e7836bba873e90f942ce728e68dafb7453f Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 30 Aug 2025 03:21:11 -0400 Subject: [PATCH 30/36] move kickstart and autofans to controllerfan --- Marlin/Configuration_adv.h | 8 +- Marlin/src/MarlinCore.cpp | 10 +- Marlin/src/feature/autofans.cpp | 30 ------ Marlin/src/feature/autofans.h | 69 -------------- Marlin/src/feature/controllerfan.cpp | 25 +++-- Marlin/src/feature/controllerfan.h | 93 ++++++++++++++++++- Marlin/src/feature/kickstart.cpp | 30 ------ Marlin/src/feature/kickstart.h | 56 ----------- .../{kickstart => controllerfan}/M711.cpp | 16 ++-- .../{autofans => controllerfan}/M712.cpp | 14 ++- Marlin/src/inc/Conditionals-5-post.h | 4 +- Marlin/src/inc/SanityCheck.h | 4 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 20 +--- Marlin/src/module/planner.cpp | 6 +- Marlin/src/module/planner.h | 2 +- Marlin/src/module/settings.cpp | 48 ++++------ Marlin/src/module/temperature.cpp | 4 - 17 files changed, 154 insertions(+), 285 deletions(-) delete mode 100644 Marlin/src/feature/autofans.cpp delete mode 100644 Marlin/src/feature/autofans.h delete mode 100644 Marlin/src/feature/kickstart.cpp delete mode 100644 Marlin/src/feature/kickstart.h rename Marlin/src/gcode/feature/{kickstart => controllerfan}/M711.cpp (87%) rename Marlin/src/gcode/feature/{autofans => controllerfan}/M712.cpp (88%) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 98fb75d6aa..e5b3684ef1 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -619,9 +619,9 @@ //#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 +//#define FAN_KICKSTART_EDITABLE // Enable M711 configurable settings #if ENABLED(FAN_KICKSTART_EDITABLE) - #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu + #define FAN_KICKSTART_MENU // Enable the Fan Kickstart submenu #endif // Some coolers may require a non-zero "off" state. @@ -725,9 +725,9 @@ /** * Allow Auto Cooling Fans to be editable */ -//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings +//#define AUTO_FAN_EDITABLE // Enable M712 configurable settings #if ENABLED(AUTO_FAN_EDITABLE) - #define AUTO_FAN_MENU // Enable the Editable Auto Fans submenu + #define AUTO_FAN_MENU // Enable the Editable Auto Fans submenu #endif /** diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 873453e3d5..ec3e68c8ab 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -225,15 +225,7 @@ #include "feature/fancheck.h" #endif -#if ENABLED(FAN_KICKSTART_EDITABLE) - #include "feature/kickstart.h" -#endif - -#if ENABLED(AUTO_FAN_EDITABLE) - #include "feature/autofans.h" -#endif - -#if ENABLED(USE_CONTROLLER_FAN) +#if ANY(USE_CONTROLLER_FAN, FAN_KICKSTART_EDITABLE, AUTO_FAN_EDITABLE) #include "feature/controllerfan.h" #endif diff --git a/Marlin/src/feature/autofans.cpp b/Marlin/src/feature/autofans.cpp deleted file mode 100644 index b6ac5a2f15..0000000000 --- a/Marlin/src/feature/autofans.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Auto Fans settings (Extruder Cooling Fans) - * Author: wlkmanist - * Date: 2024/04/08 - * - * 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 . - * - */ - -#include "../inc/MarlinConfig.h" - -#if ENABLED(AUTO_FAN_EDITABLE) - -#include "autofans.h" - -Autofans autofans; -autofans_settings_t Autofans::settings; // {0} - -#endif diff --git a/Marlin/src/feature/autofans.h b/Marlin/src/feature/autofans.h deleted file mode 100644 index 958281d73a..0000000000 --- a/Marlin/src/feature/autofans.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Auto Fans settings (Extruder Cooling Fans) - * Author: wlkmanist - * Date: 2024/04/08 - * - * 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 . - * - */ - -#pragma once - -#include "../inc/MarlinConfigPre.h" - -#if HAS_AUTO_FAN - -typedef struct { - uint8_t extruder_temp; // Auto fans temperature thresholds - uint8_t chamber_temp; - uint8_t 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 -}; - - #if ENABLED(AUTO_FAN_EDITABLE) - - 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 -#endif \ No newline at end of file diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 971b290c7d..eaf21564fa 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -22,24 +22,33 @@ #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" -#if ENABLED(FAN_KICKSTART_EDITABLE) - #include "kickstart.h" -#endif - ControllerFan controllerFan; 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) @@ -122,7 +131,7 @@ void ControllerFan::update() { 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_ms; + 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. } diff --git a/Marlin/src/feature/controllerfan.h b/Marlin/src/feature/controllerfan.h index 68502afa66..d1d09b91ec 100644 --- a/Marlin/src/feature/controllerfan.h +++ b/Marlin/src/feature/controllerfan.h @@ -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 @@ -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 + diff --git a/Marlin/src/feature/kickstart.cpp b/Marlin/src/feature/kickstart.cpp deleted file mode 100644 index d5f69d1321..0000000000 --- a/Marlin/src/feature/kickstart.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Fan Kickstart settings - * Author: wlkmanist - * Date: 2024/04/03 - * - * 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 . - * - */ - -#include "../inc/MarlinConfig.h" - -#if ENABLED(FAN_KICKSTART_EDITABLE) - -#include "kickstart.h" - -Kickstart kickstart; -kickstart_settings_t Kickstart::settings; // {0} - -#endif diff --git a/Marlin/src/feature/kickstart.h b/Marlin/src/feature/kickstart.h deleted file mode 100644 index a7d1ead952..0000000000 --- a/Marlin/src/feature/kickstart.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Fan Kickstart settings - * Author: wlkmanist - * Date: 2024/04/03 - * - * 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 . - * - */ - -#pragma once - -#include "../inc/MarlinConfigPre.h" - -#if ENABLED(FAN_KICKSTART_EDITABLE) - -typedef struct { - uint16_t duration_ms; // Duration in milliseconds for the fan to run at kickstart speed - uint8_t speed; // 0-255 (fullspeed); Fans first start 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 diff --git a/Marlin/src/gcode/feature/kickstart/M711.cpp b/Marlin/src/gcode/feature/controllerfan/M711.cpp similarity index 87% rename from Marlin/src/gcode/feature/kickstart/M711.cpp rename to Marlin/src/gcode/feature/controllerfan/M711.cpp index fde4983769..2f7a34c608 100644 --- a/Marlin/src/gcode/feature/kickstart/M711.cpp +++ b/Marlin/src/gcode/feature/controllerfan/M711.cpp @@ -23,7 +23,7 @@ #if ENABLED(FAN_KICKSTART_EDITABLE) #include "../../gcode.h" -#include "../../../feature/kickstart.h" +#include "../../../feature/controllerfan.h" /** * M711: Set Fan Kickstart settings @@ -43,16 +43,14 @@ void GcodeSuite::M711() { const bool seenR = parser.seen('R'); - if (seenR) kickstart.reset(); - const bool seenS = parser.seenval('S'); - if (seenS) kickstart.settings.speed = parser.value_byte(); - const bool seenD = parser.seenval('D'); - if (seenD) kickstart.settings.duration_ms = parser.value_ushort(); - const bool seenE = parser.seenval('E'); - if (seenE) kickstart.settings.enabled = parser.value_bool(); + + 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(); @@ -64,7 +62,7 @@ void GcodeSuite::M711_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_FAN_KICKSTART)); SERIAL_ECHOLNPGM(" M711" " S", int(kickstart.settings.speed), - " D", int(kickstart.settings.duration_ms), + " D", int(kickstart.settings.duration), " E", int(kickstart.settings.enabled), " ; (", (int(kickstart.settings.speed) * 100) / 255, "%)" ); diff --git a/Marlin/src/gcode/feature/autofans/M712.cpp b/Marlin/src/gcode/feature/controllerfan/M712.cpp similarity index 88% rename from Marlin/src/gcode/feature/autofans/M712.cpp rename to Marlin/src/gcode/feature/controllerfan/M712.cpp index 2818332dbf..a318a0d437 100644 --- a/Marlin/src/gcode/feature/autofans/M712.cpp +++ b/Marlin/src/gcode/feature/controllerfan/M712.cpp @@ -23,7 +23,7 @@ #if ENABLED(AUTO_FAN_EDITABLE) #include "../../gcode.h" -#include "../../../feature/autofans.h" +#include "../../../feature/controllerfan.h" /** * M712: Set Extruder Auto Fans settings @@ -42,16 +42,14 @@ void GcodeSuite::M712() { const bool seenR = parser.seen('R'); - if (seenR) autofans.reset(); - const bool seenE = parser.seenval('E'); - if (seenE) autofans.settings.extruder_temp = parser.value_byte(); - const bool seenH = parser.seenval('H'); - if (seenH) autofans.settings.chamber_temp = parser.value_byte(); - const bool seenC = parser.seenval('C'); - if (seenC) autofans.settings.cooler_temp = parser.value_byte(); + + if (seenR) autofans.reset(); + else if (seenE) autofans.settings.extruder_temp = parser.value_byte(); + else if (seenH) autofans.settings.chamber_temp = parser.value_byte(); + else if (seenC) autofans.settings.cooler_temp = parser.value_byte(); if (!(seenR || seenE || seenH || seenC)) M712_report(); diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index 10175f3ebb..61e0806df9 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -2965,11 +2965,11 @@ #endif // Fan Kickstart -#if FAN_KICKSTART_TIME && NONE(HAS_FAN, USE_CONTROLLER_FAN) +#if defined(FAN_KICKSTART_TIME) && NONE(HAS_FAN, USE_CONTROLLER_FAN) #undef FAN_KICKSTART_TIME #endif -#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER) +#if defined(FAN_KICKSTART_TIME) && !defined(FAN_KICKSTART_POWER) #define FAN_KICKSTART_POWER TERN(FAN_KICKSTART_LINEAR, 255, 180) #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 08d2b1c219..6ffa574d25 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1061,7 +1061,7 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i #endif // Fan Kickstart power -#if FAN_KICKSTART_TIME +#ifdef FAN_KICKSTART_TIME #if ENABLED(FAN_KICKSTART_LINEAR) && FAN_KICKSTART_POWER != 255 #error "FAN_KICKSTART_LINEAR requires a FAN_KICKSTART_POWER of 255." #elif !WITHIN(FAN_KICKSTART_POWER, 64, 255) @@ -1073,7 +1073,7 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i * Synchronous M106/M107 checks */ #if ENABLED(LASER_SYNCHRONOUS_M106_M107) - #if FAN_KICKSTART_TIME + #ifdef FAN_KICKSTART_TIME #error "FAN_KICKSTART_TIME must be 0 with LASER_SYNCHRONOUS_M106_M107 (because the laser will always come on at FULL power)." #elif FAN_MIN_PWM #error "FAN_MIN_PWM must be 0 with LASER_SYNCHRONOUS_M106_M107 (otherwise the laser will never turn OFF)." diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index df597e0525..11879362e0 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -88,18 +88,10 @@ #include "../../../feature/tmc_util.h" #endif -#if ENABLED(CONTROLLER_FAN_MENU) +#if ANY(CONTROLLER_FAN_MENU, FAN_KICKSTART_MENU, AUTO_FAN_MENU) #include "../../../feature/controllerfan.h" #endif -#if ENABLED(FAN_KICKSTART_MENU) - #include "../../../feature/kickstart.h" -#endif - -#if ENABLED(AUTO_FAN_MENU) - #include "../../../feature/autofans.h" -#endif - #if ANY(HAS_GCODE_PREVIEW, CV_LASER_MODULE) #include "gcode_preview.h" #endif @@ -2765,11 +2757,9 @@ void SetFlow() { SetPIntOnClick(FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refres #endif #if ENABLED(FAN_KICKSTART_MENU) - void SetKickstartEnabled() { kickstart.settings.enabled ^= true; PrepareRefreshMenu(); Draw_Kickstart_menu(); } - void SetKickstartSpeed() { SetIntOnClick((FAN_MIN_PWM > 96 ? FAN_MIN_PWM : 96), FAN_MAX_PWM, - kickstart.settings.speed, []{ kickstart.settings.speed = MenuData.Value; }); } - void SetKickstartDuration() { SetIntOnClick(10, 1500, - kickstart.settings.duration_ms, []{ kickstart.settings.duration_ms = MenuData.Value; }); } + void SetKickstartEnabled() { kickstart.settings.enabled ^= true; PrepareRefreshMenu(); Draw_Kickstart_menu(); } + void SetKickstartSpeed() { SetIntOnClick((FAN_MIN_PWM > 96 ? FAN_MIN_PWM : 96), FAN_MAX_PWM, kickstart.settings.speed, []{ kickstart.settings.speed = MenuData.Value; }); } + void SetKickstartDuration() { SetIntOnClick(10, 1500, kickstart.settings.duration, []{ kickstart.settings.duration = MenuData.Value; }); } #endif #if ENABLED(AUTO_FAN_MENU) @@ -3872,7 +3862,7 @@ void Draw_Tune_Menu() { EDIT_ITEM(ICON_Motion, MSG_FAN_KICKSTART_ENABLE, onDrawChkbMenu, SetKickstartEnabled, &kickstart.settings.enabled); if (kickstart.settings.enabled) { EDIT_ITEM(ICON_FanSpeed, MSG_FAN_KICKSTART_POWER, onDrawPInt8Menu, SetKickstartSpeed, &kickstart.settings.speed); - EDIT_ITEM(ICON_RemainTime, MSG_FAN_KICKSTART_DURATION, onDrawPIntMenu, SetKickstartDuration, &kickstart.settings.duration_ms); + EDIT_ITEM(ICON_RemainTime, MSG_FAN_KICKSTART_DURATION, onDrawPIntMenu, SetKickstartDuration, &kickstart.settings.duration); } } UpdateMenu(KickstartMenu); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 7292f2a2d0..bde47fec0a 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -114,7 +114,7 @@ #endif #if ENABLED(FAN_KICKSTART_EDITABLE) - #include "../feature/kickstart.h" + #include "../feature/controllerfan.h" #endif // Delay for delivery of first block to the stepper ISR, if the queue contains 2 or @@ -1220,7 +1220,7 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { TERN_(HAS_FAN7, FAN_SET(7)); } - #if FAN_KICKSTART_TIME + #ifdef FAN_KICKSTART_TIME void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) { #if ENABLED(FAN_KICKSTART_EDITABLE) @@ -1229,7 +1229,7 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { static millis_t fan_kick_end[FAN_COUNT] = { 0 }; if (fan_speed[f] > FAN_OFF_PWM) { if (fan_kick_end[f] == 0) { - fan_kick_end[f] = ms + kickstart.settings.duration_ms; + fan_kick_end[f] = ms + kickstart.settings.duration; fan_speed[f] = kickstart.settings.speed; } else if (PENDING(ms, fan_kick_end[f])) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 1502192a1a..506497d111 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -676,7 +676,7 @@ class Planner { // Apply fan speeds #if HAS_FAN static void sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]); - #if FAN_KICKSTART_TIME || ENABLED(FAN_KICKSTART_EDITABLE) + #if defined(FAN_KICKSTART_TIME) || ENABLED(FAN_KICKSTART_EDITABLE) static void kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f); #else FORCE_INLINE static void kickstart_fan(uint8_t (&)[FAN_COUNT], const millis_t &, const uint8_t) {} diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 3e0b725d2a..a14b3fdd47 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -145,15 +145,9 @@ #include "../feature/probe_temp_comp.h" #endif -#if ENABLED(USE_CONTROLLER_FAN) +#if ANY(USE_CONTROLLER_FAN, FAN_KICKSTART_EDITABLE, AUTO_FAN_EDITABLE) #include "../feature/controllerfan.h" #endif -#if FAN_KICKSTART_TIME - #include "../feature/kickstart.h" -#endif -#if HAS_AUTO_FAN - #include "../feature/autofans.h" -#endif #if ENABLED(CASE_LIGHT_ENABLE) #include "../feature/caselight.h" @@ -474,17 +468,17 @@ typedef struct SettingsDataStruct { #endif // - // Fan Kickstart settings + // Fan Kickstart // - #if FAN_KICKSTART_TIME - kickstart_settings_t kickstart_settings; // M711 + #if ENABLED(FAN_KICKSTART_EDITABLE) + kickstart_settings_t kickstart_settings; // M711 #endif // - // Auto Fans settings + // Auto Fans // - #if HAS_AUTO_FAN - autofans_settings_t autofans_settings; // M712 + #if ENABLED(AUTO_FAN_EDITABLE) + autofans_settings_t autofans_settings; // M712 #endif // @@ -1472,14 +1466,10 @@ void MarlinSettings::postprocess() { // // Fan Kickstart // - #if FAN_KICKSTART_TIME + #if ENABLED(FAN_KICKSTART_EDITABLE) { _FIELD_TEST(kickstart_settings); - #if ENABLED(FAN_KICKSTART_EDITABLE) const kickstart_settings_t &fks = kickstart.settings; - #else - constexpr kickstart_settings_t fks = kickstart_defaults; - #endif EEPROM_WRITE(fks); } #endif @@ -1487,15 +1477,11 @@ void MarlinSettings::postprocess() { // // Auto Fans // - #if HAS_AUTO_FAN + #if ENABLED(AUTO_FAN_EDITABLE) { _FIELD_TEST(autofans_settings); - #if ENABLED(AUTO_FAN_EDITABLE) - const autofans_settings_t &eauto = autofans.settings; - #else - constexpr autofans_settings_t eauto = autofans_defaults; - #endif - EEPROM_WRITE(eauto); + const autofans_settings_t &afs = autofans.settings; + EEPROM_WRITE(afs); } #endif @@ -2633,24 +2619,24 @@ void MarlinSettings::postprocess() { // // Fan Kickstart // - #if FAN_KICKSTART_TIME + #if ENABLED(FAN_KICKSTART_EDITABLE) { kickstart_settings_t fks = { 0 }; _FIELD_TEST(kickstart_settings); EEPROM_READ(fks); - TERN_(FAN_KICKSTART_EDITABLE, if (!validating) kickstart.settings = fks); + if (!validating) kickstart.settings = fks; } #endif // // Auto Fans // - #if HAS_AUTO_FAN + #if ENABLED(AUTO_FAN_EDITABLE) { - autofans_settings_t eauto = { 0 }; + autofans_settings_t afs = { 0 }; _FIELD_TEST(autofans_settings); - EEPROM_READ(eauto); - TERN_(AUTO_FAN_EDITABLE, if (!validating) autofans.settings = eauto); + EEPROM_READ(afs); + if (!validating) autofans.settings = afs; } #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d183500c22..29a812d333 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -46,10 +46,6 @@ #include "../feature/controllerfan.h" #endif -#if ENABLED(AUTO_FAN_EDITABLE) - #include "../feature/autofans.h" -#endif - #if ENABLED(EMERGENCY_PARSER) #include "motion.h" #endif From 64257fb3364923c4b88ecb488eef961fc26fd34c Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 30 Aug 2025 03:36:14 -0400 Subject: [PATCH 31/36] small changes --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 8 ++++---- ini/features.ini | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 11879362e0..038f14762c 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2750,10 +2750,10 @@ void SetFlow() { SetPIntOnClick(FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refres #endif #if ENABLED(CONTROLLER_FAN_MENU) + void SetControllerFanAutoOn() { controllerFan.settings.auto_mode ^= true; PrepareRefreshMenu(); Draw_ControllerFan_menu(); } void SetControllerFanIdleSpeed() { SetIntOnClick(0, 255, controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } void SetControllerFanSpeed() { SetIntOnClick(0, 255, controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } void SetControllerFanDuration() { SetIntOnClick(1, MAX_FAN_IDLE, controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } - void SetControllerFanAutoOn() { controllerFan.settings.auto_mode ^= true; PrepareRefreshMenu(); Draw_ControllerFan_menu(); } #endif #if ENABLED(FAN_KICKSTART_MENU) @@ -3817,12 +3817,12 @@ void Draw_Tune_Menu() { #else BACK_ITEM(Draw_Advanced_Menu); #endif - #if ENABLED(FAN_KICKSTART_MENU) - MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); - #endif #if ENABLED(CONTROLLER_FAN_MENU) MENU_ITEM(ICON_FanSpeed, MSG_CONTROLLER_FAN, onDrawSubMenu, Draw_ControllerFan_menu); #endif + #if ENABLED(FAN_KICKSTART_MENU) + MENU_ITEM(ICON_Motion, MSG_FAN_KICKSTART, onDrawSubMenu, Draw_Kickstart_menu); + #endif #if (ENABLED(AUTO_FAN_MENU)) #if HAS_E_AUTO_FAN EDIT_ITEM(ICON_Temperature, MSG_FAN_EXTRUDER_TEMP, onDrawPInt8Menu, SetExtruderFanThreshold, &autofans.settings.extruder_temp); diff --git a/ini/features.ini b/ini/features.ini index c86cc0b53e..4cfc70b329 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -311,8 +311,8 @@ FT_MOTION = build_src_filter=+ PHOTO_GCODE = build_src_filter=+ CONTROLLER_FAN_EDITABLE = build_src_filter=+ -FAN_KICKSTART_EDITABLE = build_src_filter=+ + -AUTO_FAN_EDITABLE = build_src_filter=+ + +FAN_KICKSTART_EDITABLE = build_src_filter=+ + +AUTO_FAN_EDITABLE = build_src_filter=+ + HAS_ZV_SHAPING = build_src_filter=+ GCODE_MACROS = build_src_filter=+ GRADIENT_MIX = build_src_filter=+ From 9f3d00e330dcdff292adf74850b66807835da79a Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 31 Aug 2025 19:18:03 -0400 Subject: [PATCH 32/36] use FLIP --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 038f14762c..983e6f5912 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2750,14 +2750,14 @@ void SetFlow() { SetPIntOnClick(FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refres #endif #if ENABLED(CONTROLLER_FAN_MENU) - void SetControllerFanAutoOn() { controllerFan.settings.auto_mode ^= true; PrepareRefreshMenu(); Draw_ControllerFan_menu(); } + void SetControllerFanAutoOn() { FLIP(controllerFan.settings.auto_mode); PrepareRefreshMenu(); Draw_ControllerFan_menu(); } void SetControllerFanIdleSpeed() { SetIntOnClick(0, 255, controllerFan.settings.idle_speed, []{ controllerFan.settings.idle_speed = MenuData.Value; }); } void SetControllerFanSpeed() { SetIntOnClick(0, 255, controllerFan.settings.active_speed, []{ controllerFan.settings.active_speed = MenuData.Value; }); } void SetControllerFanDuration() { SetIntOnClick(1, MAX_FAN_IDLE, controllerFan.settings.duration, []{ controllerFan.settings.duration = MenuData.Value; }); } #endif #if ENABLED(FAN_KICKSTART_MENU) - void SetKickstartEnabled() { kickstart.settings.enabled ^= true; PrepareRefreshMenu(); Draw_Kickstart_menu(); } + void SetKickstartEnabled() { FLIP(kickstart.settings.enabled); PrepareRefreshMenu(); Draw_Kickstart_menu(); } void SetKickstartSpeed() { SetIntOnClick((FAN_MIN_PWM > 96 ? FAN_MIN_PWM : 96), FAN_MAX_PWM, kickstart.settings.speed, []{ kickstart.settings.speed = MenuData.Value; }); } void SetKickstartDuration() { SetIntOnClick(10, 1500, kickstart.settings.duration, []{ kickstart.settings.duration = MenuData.Value; }); } #endif From 37ce7a24bd8495d5b43ea59fb62862633a676772 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 23 Sep 2025 18:01:10 -0400 Subject: [PATCH 33/36] add fans to test --- Marlin/Configuration_adv.h | 2 +- buildroot/tests/GD32F103RC_voxelab_maple | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 1be2a1ed3d..a99986bb12 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -590,7 +590,7 @@ //#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 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_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 diff --git a/buildroot/tests/GD32F103RC_voxelab_maple b/buildroot/tests/GD32F103RC_voxelab_maple index 0054bbd649..c5d583aa05 100755 --- a/buildroot/tests/GD32F103RC_voxelab_maple +++ b/buildroot/tests/GD32F103RC_voxelab_maple @@ -43,3 +43,11 @@ use_example_configs "Voxelab Aquila/X3" # opt_enable # opt_add exec_test $1 $2 "Aquila GD32 - ProUI X3" "$3" + +use_example_configs "Voxelab Aquila/UBL" +opt_set CONTROLLERFAN_SPEED_MIN 40 CONTROLLERFAN_SPEED_MAX 127 \ + E0_AUTO_FAN_PIN UART5_TX_PIN CONTROLLER_FAN_PIN UART5_RX_PIN +# opt_disable +opt_enable USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE +opt_add FAN_KICKSTART_EDITABLE FAN_KICKSTART_MENU AUTO_FAN_EDITABLE AUTO_FAN_MENU +exec_test $1 $2 "Aquila GD32 - ProUI Unified (UBL) Adv Misc Fans" "$3" From 7f7716cf0a9ba2983b1ccdc9f016ce96fedec33b Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 23 Sep 2025 23:51:39 -0400 Subject: [PATCH 34/36] update pioutil.py --- buildroot/share/PlatformIO/scripts/pioutil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/pioutil.py b/buildroot/share/PlatformIO/scripts/pioutil.py index f824106e80..3a1cfa3d42 100644 --- a/buildroot/share/PlatformIO/scripts/pioutil.py +++ b/buildroot/share/PlatformIO/scripts/pioutil.py @@ -6,7 +6,9 @@ # Make sure 'vscode init' is not the current command def is_pio_build(): - if "IsCleanTarget" in dir(env) and env.IsCleanTarget(): return False + if "IsCleanTarget" in dir(env): + if env.IsCleanTarget(): + return False return not env.IsIntegrationDump() def get_pio_version(): From 26028488f6c952473caa33ac40228e09d68321fe Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 24 Sep 2025 01:24:00 -0400 Subject: [PATCH 35/36] check unwam --- Marlin/src/HAL/shared/backtrace/unwarm.cpp | 4 ++-- Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm.cpp index 823f54c157..3f85ec0593 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm.cpp @@ -112,7 +112,7 @@ bool UnwReportRetAddr(UnwState * const state, uint32_t addr) { // Check if name descriptor is valid if ((v & 0xFFFFFF00) == 0xFF000000 && (v & 0xFF) > 1) { // Assume the name was found! - entry.name = ((const char*)pf) - 4 - (v & 0xFF); + entry.name = reinterpret_cast(pf) - 4 - (v & 0xFF); entry.function = pf; break; } @@ -125,7 +125,7 @@ bool UnwReportRetAddr(UnwState * const state, uint32_t addr) { /* Cast away const from reportData. * The const is only to prevent the unw module modifying the data. */ - return state->cb->report((void *)state->reportData, &entry); + return state->cb->report(const_cast(state->reportData), &entry); } /** diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp index e4d67c0b44..f372f9b232 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp @@ -238,7 +238,12 @@ UnwResult UnwStartArm(UnwState * const state) { case 1: /* logical right */ if (!regShift && shiftDist == 0) shiftDist = 32; - op2val = state->regData[rm].v >> shiftDist; + if (shiftDist >= 32) { + op2val = 0; + } + else { + op2val = state->regData[rm].v >> shiftDist; + } break; case 2: /* arithmetic right */ From b65f779fb50db0ab8e5c0610e1170c6911a52351 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 25 Dec 2025 22:32:17 -0500 Subject: [PATCH 36/36] update M710-712 --- .../src/gcode/feature/controllerfan/M710.cpp | 37 +++++++++---------- .../src/gcode/feature/controllerfan/M711.cpp | 20 +++++----- .../src/gcode/feature/controllerfan/M712.cpp | 26 ++++++------- 3 files changed, 38 insertions(+), 45 deletions(-) diff --git a/Marlin/src/gcode/feature/controllerfan/M710.cpp b/Marlin/src/gcode/feature/controllerfan/M710.cpp index 6bdfcd9b32..ac1ad59c13 100644 --- a/Marlin/src/gcode/feature/controllerfan/M710.cpp +++ b/Marlin/src/gcode/feature/controllerfan/M710.cpp @@ -37,31 +37,28 @@ * D : Set auto mode idle duration * * Examples: - * M710 ; Report current Settings - * M710 R ; Reset SIAD to defaults - * M710 I64 ; Set controller fan Idle Speed to 25% - * M710 S255 ; Set controller fan Active Speed to 100% - * M710 S0 ; Set controller fan Active Speed to OFF - * M710 I255 A0 ; Set controller fan Idle Speed to 100% with Auto Mode OFF - * M710 I127 A1 S255 D160 ; Set controller fan idle speed 50%, AutoMode On, Fan speed 100%, duration to 160 Secs + * M710 : Report current Settings + * M710 R : Reset SIAD to defaults + * M710 S255 : Set controller fan Active Speed to 100% + * M710 S0 : Set controller fan Active Speed to OFF + * M710 I64 : Set controller fan Idle Speed to 25% + * M710 I255 A0 : Set controller fan Idle Speed to 100% with Auto Mode OFF + * M710 I127 A1 S255 D160 : Set controller fan idle speed 50%, AutoMode On, Fan speed 100%, duration to 160 Secs */ void GcodeSuite::M710() { if (!parser.seen("ADIRS")) return M710_report(); - if (parser.seen_test('R')) - controllerFan.reset(); + const bool seenR = parser.seen_test('R'); + const bool seenS = parser.seenval('S'); + const bool seenI = parser.seenval('I'); + const bool seenA = parser.seenval('A'); + const bool seenD = parser.seenval('D'); - if (parser.seenval('S')) - controllerFan.settings.active_speed = parser.value_byte(); - - if (parser.seenval('I')) - controllerFan.settings.idle_speed = parser.value_byte(); - - if (parser.seenval('A')) - controllerFan.settings.auto_mode = parser.value_bool(); - - if (parser.seenval('D')) - controllerFan.settings.duration = parser.value_ushort(); + if (seenR) controllerFan.reset(); + if (seenS) controllerFan.settings.active_speed = parser.value_byte(); + if (seenI) controllerFan.settings.idle_speed = parser.value_byte(); + if (seenA) controllerFan.settings.auto_mode = parser.value_bool(); + if (seenD) controllerFan.settings.duration = parser.value_ushort(); } void GcodeSuite::M710_report(const bool forReplay/*=true*/) { diff --git a/Marlin/src/gcode/feature/controllerfan/M711.cpp b/Marlin/src/gcode/feature/controllerfan/M711.cpp index 2f7a34c608..b30e07252f 100644 --- a/Marlin/src/gcode/feature/controllerfan/M711.cpp +++ b/Marlin/src/gcode/feature/controllerfan/M711.cpp @@ -34,13 +34,14 @@ * 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 + * M711 : Report current Settings + * M711 R : Reset SDE to defaults + * M711 S255 : Set Kickstart fan speed to 100% + * M711 E1 S180 D100 : Set Kickstart to ON, Kickstart fan speed 70%, duration to 100 milliseconds + * M711 E0 : Set Kickstart to OFF */ void GcodeSuite::M711() { + if (!parser.seen("DERS")) return M711_report(); const bool seenR = parser.seen('R'); const bool seenS = parser.seenval('S'); @@ -48,12 +49,9 @@ void GcodeSuite::M711() { 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(); + if (seenS) kickstart.settings.speed = parser.value_byte(); + if (seenD) kickstart.settings.duration = parser.value_ushort(); + if (seenE) kickstart.settings.enabled = parser.value_bool(); } void GcodeSuite::M711_report(const bool forReplay/*=true*/) { diff --git a/Marlin/src/gcode/feature/controllerfan/M712.cpp b/Marlin/src/gcode/feature/controllerfan/M712.cpp index a318a0d437..b6f493d7b8 100644 --- a/Marlin/src/gcode/feature/controllerfan/M712.cpp +++ b/Marlin/src/gcode/feature/controllerfan/M712.cpp @@ -28,18 +28,19 @@ /** * M712: Set Extruder Auto Fans settings * - * R : Reset to defaults - * E : Set Extruder fans temperature threshold - * H : Set Chamber fan temperature threshold - * C : Set Cooler fan temperature threshold + * R : Reset to defaults + * E : Set Extruder fans temperature threshold + * H : Set Chamber fan temperature threshold + * C : Set Cooler fan temperature threshold * * Examples: - * M712 ; Report current Settings - * M712 R ; Reset EHC to defaults - * M712 E60 ; Set Extruder temp to 60 - * M712 E50 H30 C18 ; Set Extruder temp to 50, Chamber temp to 30, Cooler temp to 18 + * M712 : Report current Settings + * M712 R : Reset EHC to defaults + * M712 E60 : Set Extruder temp to 60 + * M712 E50 H30 C18 : Set Extruder temp to 50, Chamber temp to 30, Cooler temp to 18 */ void GcodeSuite::M712() { + if (!parser.seen("CEHR")) return M712_report(); const bool seenR = parser.seen('R'); const bool seenE = parser.seenval('E'); @@ -47,12 +48,9 @@ void GcodeSuite::M712() { const bool seenC = parser.seenval('C'); if (seenR) autofans.reset(); - else if (seenE) autofans.settings.extruder_temp = parser.value_byte(); - else if (seenH) autofans.settings.chamber_temp = parser.value_byte(); - else if (seenC) autofans.settings.cooler_temp = parser.value_byte(); - - if (!(seenR || seenE || seenH || seenC)) - M712_report(); + if (seenE) autofans.settings.extruder_temp = parser.value_byte(); + if (seenH) autofans.settings.chamber_temp = parser.value_byte(); + if (seenC) autofans.settings.cooler_temp = parser.value_byte(); } void GcodeSuite::M712_report(const bool forReplay/*=true*/) {