From a1d03fe7ba62c3c2832b46a5a3c0c29fa6fc8251 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Wed, 30 Jan 2019 21:54:04 -0500 Subject: [PATCH] Fix single nozzle fan (#13038) --- Marlin/src/gcode/temperature/M106_M107.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 25160669ee..4821ec6b73 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -28,6 +28,13 @@ #include "../../module/motion.h" #include "../../module/temperature.h" +#if ENABLED(SINGLENOZZLE) + #define _ALT_P active_extruder + #define _CNT_P EXTRUDERS +#else + #define _ALT_P MIN(active_extruder, FAN_COUNT - 1) + #define _CNT_P MIN(EXTRUDERS, FAN_COUNT) +#endif /** * M106: Set Fan Speed @@ -43,9 +50,9 @@ * 3-255 = Set the speed for use with T2 */ void GcodeSuite::M106() { - const uint8_t p = parser.byteval('P', MIN(active_extruder, FAN_COUNT - 1)); + const uint8_t p = parser.byteval('P', _ALT_P); - if (p < MIN(EXTRUDERS, FAN_COUNT)) { + if (p < _CNT_P) { #if ENABLED(EXTRA_FAN_SPEED) const uint16_t t = parser.intval('T'); @@ -63,7 +70,7 @@ void GcodeSuite::M106() { * M107: Fan Off */ void GcodeSuite::M107() { - const uint8_t p = parser.byteval('P', MIN(active_extruder, FAN_COUNT - 1)); + const uint8_t p = parser.byteval('P', _ALT_P); thermalManager.set_fan_speed(p, 0); }