From a8fa275dc6e9d0938da4d83e8e9d9ac3a527f12b Mon Sep 17 00:00:00 2001 From: Sam Lane <9569766+SJ-Innovation@users.noreply.github.com> Date: Sun, 24 Mar 2019 04:00:31 +0000 Subject: [PATCH] Fix Fan 0 responding to all fan speeds (#13444) --- Marlin/src/gcode/temperature/M106_M107.cpp | 4 ++-- Marlin/src/module/temperature.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 49558a7716..5994f34761 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -58,8 +58,8 @@ void GcodeSuite::M106() { const uint16_t t = parser.intval('T'); if (t > 0) return thermalManager.set_temp_fan_speed(p, t); #endif - - uint16_t s = parser.ushortval('S', 255); + uint16_t d = parser.seen('A') ? thermalManager.fan_speed[active_extruder] : 255; + uint16_t s = parser.ushortval('S', d); NOMORE(s, 255U); thermalManager.set_fan_speed(p, s); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 166c585ba3..0122367bca 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2379,7 +2379,7 @@ void Temperature::isr() { #if ENABLED(FAN_SOFT_PWM) #define _FAN_PWM(N) do{ \ soft_pwm_count_fan[N] = (soft_pwm_count_fan[N] & pwm_mask) + (soft_pwm_amount_fan[N] >> 1); \ - WRITE_FAN(soft_pwm_count_fan[N] > pwm_mask ? HIGH : LOW); \ + WRITE_FAN_N(N, soft_pwm_count_fan[N] > pwm_mask ? HIGH : LOW); \ }while(0) #if HAS_FAN0 _FAN_PWM(0);