From f959c57c9fa3995c3d226add496331969f47359e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=9F=D0=B5=D1=80=D1=88=D0=B8?= =?UTF-8?q?=D0=BD?= Date: Tue, 19 Nov 2019 19:42:01 +0500 Subject: [PATCH] =?UTF-8?q?fix=20#2=20M106=20P1=20S100=20=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D1=8C=D1=88=D0=B5=20=D0=BD=D0=B8=D1=87=D0=B5=D0=B3=D0=BE?= =?UTF-8?q?=20=D0=BD=D0=B5=20=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=D0=B0=20(?= =?UTF-8?q?=D1=82.=D0=BA.=20=D0=B5=D1=81=D1=82=D1=8C=20=D1=82=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=BA=D0=BE=20P0=20-=20=D0=BE=D0=B1=D0=B4=D1=83=D0=B2=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8)=20-=20=D1=82=D0=B5=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D1=8C=20=D0=B7=D0=B0=D0=BF=D0=BE=D0=BC=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D0=B5=D1=82,=20=D1=81=20=D0=BA=D0=B0=D0=BA=D0=BE=D0=B9?= =?UTF-8?q?=20=D1=81=D0=BA=D0=BE=D1=80=D0=BE=D1=81=D1=82=D1=8C=D1=8E=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=2050=C2=B0=20=D0=BD=D0=B0=D0=B4?= =?UTF-8?q?=D0=BE=20=D0=BE=D0=B1=D0=B4=D1=83=D0=B2=D0=B0=D1=82=D1=8C=20col?= =?UTF-8?q?dend.=20100=20=D0=B3=D0=BE=D1=80=D0=B0=D0=B7=D0=B4=D0=BE=20?= =?UTF-8?q?=D1=82=D0=B8=D1=88=D0=B5,=20=D1=87=D0=B5=D0=BC=20200=20-=20?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=BD=D1=80=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BB=D0=B8=20=D1=8D=D1=82=D0=BE=20=D0=BF=D0=BB?= =?UTF-8?q?=D0=B0=D1=81=D1=82=D0=B8=D0=BA=D0=B0=D0=BC=3F=20=D0=92=D1=80?= =?UTF-8?q?=D0=B5=D0=BC=D1=8F=20=D0=BF=D0=BE=D0=BA=D0=B0=D0=B6=D0=B5=D1=82?= =?UTF-8?q?.=20=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D1=8F=D1=82=D1=8C=20?= =?UTF-8?q?=D0=B2=20EEPROM=20=D0=BD=D0=B5=20=D1=81=D1=82=D0=B0=D0=BB,=20?= =?UTF-8?q?=D1=82.=D0=BA.=20=D1=80=D0=B0=D0=B7=D0=BD=D1=8B=D0=BC=20=D0=BF?= =?UTF-8?q?=D0=BB=D0=B0=D1=81=D1=82=D0=B8=D0=BA=D0=B0=D0=BC=20(=D0=B2?= =?UTF-8?q?=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE)=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=D0=BD=D1=8B=D0=B5=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BD=D1=83=D0=B6=D0=BD=D1=8B,=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=8D=D1=82=D0=BE=D0=BC=D1=83=20=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=20=D0=B2=20=D1=81=D0=BB=D0=B0=D0=B9=D1=81=D0=B5=D1=80=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82=D1=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 1 + Marlin/src/gcode/temperature/M106_M107.cpp | 7 +++++++ Marlin/src/inc/SanityCheck.h | 4 ++-- Marlin/src/module/temperature.cpp | 20 ++++++++++++-------- Marlin/src/module/temperature.h | 4 ++++ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 3ecb5d3d6d4d..08a32beb7d5e 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -359,6 +359,7 @@ #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 200 // 255 == full speed +#define EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE //#define CHAMBER_AUTO_FAN_TEMPERATURE 30 //#define CHAMBER_AUTO_FAN_SPEED 255 diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index ede826a3f16d..c73ef2d060c2 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -64,6 +64,13 @@ void GcodeSuite::M106() { thermalManager.set_fan_speed(p, s); } +#if ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE) + if (p == _CNT_P) { + uint16_t s = parser.ushortval('S', EXTRUDER_AUTO_FAN_SPEED); + NOMORE(s, 255U); + thermalManager.extruder_auto_fan_speed = (uint8_t)s; + } +#endif } /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 8eaf10a75fbf..6170bfc301b8 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1850,8 +1850,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Auto Fan check for PWM pins */ -#if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255 - #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255." +#if HAS_AUTO_FAN && (EXTRUDER_AUTO_FAN_SPEED != 255 || ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE)) + #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255 and disable EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE." #if HAS_AUTO_FAN_0 static_assert(PWM_PIN(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF); #elif HAS_AUTO_FAN_1 diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index f48ce8e57283..7ad476a637fd 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -124,6 +124,10 @@ Temperature thermalManager; uint8_t Temperature::chamberfan_speed; // = 0 #endif +#if ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE) + uint8_t Temperature::extruder_auto_fan_speed = EXTRUDER_AUTO_FAN_SPEED; +#endif + #if FAN_COUNT > 0 uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 } @@ -682,29 +686,29 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { #endif default: #if ENABLED(AUTO_POWER_E_FANS) - autofan_speed[realFan] = fan_on ? EXTRUDER_AUTO_FAN_SPEED : 0; + autofan_speed[realFan] = fan_on ? extruder_auto_fan_speed : 0; #endif break; } switch (f) { #if HAS_AUTO_FAN_0 - case 0: _UPDATE_AUTO_FAN(E0, fan_on, EXTRUDER_AUTO_FAN_SPEED); break; + case 0: _UPDATE_AUTO_FAN(E0, fan_on, extruder_auto_fan_speed); break; #endif #if HAS_AUTO_FAN_1 - case 1: _UPDATE_AUTO_FAN(E1, fan_on, EXTRUDER_AUTO_FAN_SPEED); break; + case 1: _UPDATE_AUTO_FAN(E1, fan_on, extruder_auto_fan_speed); break; #endif #if HAS_AUTO_FAN_2 - case 2: _UPDATE_AUTO_FAN(E2, fan_on, EXTRUDER_AUTO_FAN_SPEED); break; + case 2: _UPDATE_AUTO_FAN(E2, fan_on, extruder_auto_fan_speed); break; #endif #if HAS_AUTO_FAN_3 - case 3: _UPDATE_AUTO_FAN(E3, fan_on, EXTRUDER_AUTO_FAN_SPEED); break; + case 3: _UPDATE_AUTO_FAN(E3, fan_on, extruder_auto_fan_speed); break; #endif #if HAS_AUTO_FAN_4 - case 4: _UPDATE_AUTO_FAN(E4, fan_on, EXTRUDER_AUTO_FAN_SPEED); break; + case 4: _UPDATE_AUTO_FAN(E4, fan_on, extruder_auto_fan_speed); break; #endif #if HAS_AUTO_FAN_5 - case 5: _UPDATE_AUTO_FAN(E5, fan_on, EXTRUDER_AUTO_FAN_SPEED); break; + case 5: _UPDATE_AUTO_FAN(E5, fan_on, extruder_auto_fan_speed); break; #endif #if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E case CHAMBER_FAN_INDEX: _UPDATE_AUTO_FAN(CHAMBER, fan_on, CHAMBER_AUTO_FAN_SPEED); break; @@ -1521,7 +1525,7 @@ void Temperature::updateTemperaturesFromRawValues() { #define SET_FAST_PWM_FREQ(P) NOOP #endif #define INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0) -#if EXTRUDER_AUTO_FAN_SPEED != 255 +#if EXTRUDER_AUTO_FAN_SPEED != 255 || ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE) #define INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(FAST_PWM_FAN_FREQUENCY); } else SET_OUTPUT(P); }while(0) #else #define INIT_E_AUTO_FAN_PIN(P) SET_OUTPUT(P) diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index e3d7c2498e2b..0c7dfde779cb 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -292,6 +292,10 @@ class Temperature { static uint8_t chamberfan_speed; #endif + #if ENABLED(EXTRUDER_AUTO_FAN_SPEED_CONFIGURABLE) + static uint8_t extruder_auto_fan_speed; + #endif + #if ENABLED(FAN_SOFT_PWM) static uint8_t soft_pwm_amount_fan[FAN_COUNT], soft_pwm_count_fan[FAN_COUNT];